Full_Bar_w_Spread_Shadow_v2

Download script
Author: transport_david , David W Honeywell
Full_Bar_w_Spread_Shadow_v2

This tool is designed to provide a more comprehensive view of price action on a trading chart by accounting for the "spread"—the difference between the asking price (what you pay to buy) and the bidding price (what you receive when selling).

In standard trading views, charts often only show the raw price movement. However, because the spread represents a hidden cost or gap in the market, this indicator calculates specific price levels that reflect reality for a live trader. It visualizes four distinct data points for every candle on your chart:

Key Logic and Data Points

The script analyzes each historical and current bar to calculate and display the following markers:

  • Adjusted High (TopPlus): This represents the highest possible price point reached during a period, adjusted by adding the current market spread. It provides a clearer picture of the extreme upper limit of price movement.
  • Dynamic Upper Bound: The logic compares the actual high of a candle against a calculated split price (the closing price plus the spread). It selects whichever value is higher. This ensures that the visual representation of the top of the candle reflects either the peak reached or the price level influenced by the spread, depending on which is more significant.
  • Upper Split Price: The indicator calculates a specific mid-point balance based on the closing price of the bar plus the spread.
  • Lower Split Price: This identifies the base closing price of the candle without the added spread.

How it Works for You

By processing these four different values simultaneously, the script provides a multi-layered view of market activity. Instead of looking at a single line, you are seeing a visual representation of where the "real" boundaries of the market lie. It essentially maps out the price extremes while factoring in the constant overhead of the spread, helping you see the true reach of price action more accurately than a standard chart would allow.

Miscellaneous
Implements a curve of type %1
7 Views
0 Downloads
0 Favorites
Full_Bar_w_Spread_Shadow_v2
//+------------------------------------------------------------------+
//|                                     Full_Bar_w_Spread_Shadow.mq4 |
//|                              transport_david , David W Honeywell |
//|                                        transport.david@gmail.com |
//+------------------------------------------------------------------+
#property copyright "transport_david , David W Honeywell"
#property link      "transport.david@gmail.com"

#property indicator_chart_window
#property indicator_buffers 4
#property indicator_color1 Lime
#property indicator_color2 Lime
#property indicator_color3 Coral
#property indicator_color4 Coral
//---- input parameters

//---- buffers

double ExtMapBuffer0[];
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+

int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_HISTOGRAM, STYLE_SOLID, 1);
   SetIndexBuffer(0, ExtMapBuffer0);
   SetIndexStyle(1,DRAW_HISTOGRAM, STYLE_SOLID, 1);
   SetIndexBuffer(1, ExtMapBuffer1);
   SetIndexStyle(2,DRAW_HISTOGRAM, STYLE_SOLID, 1);
   SetIndexBuffer(2, ExtMapBuffer2);
   SetIndexStyle(3,DRAW_HISTOGRAM, STYLE_SOLID, 1);
   SetIndexBuffer(3, ExtMapBuffer3);
//----
   return(0);
  }

//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+

int deinit()
  {
//---- 
   
//----
   return(0);
  }

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+

int start()
 {
   double spread, Hsplitprice, Lsplitprice, Top, TopPlus;
   int counted_bars=IndicatorCounted();
   if  (counted_bars<0) return(-1);
   if  (counted_bars>0) counted_bars--;
   int i;
   
//---- 
   
   for (i=counted_bars-1; i>=0; i--)
     {
       spread = (Ask-Bid);
       TopPlus = (High[i]+spread);
       Top = (High[i]);
       Hsplitprice = (Close[i]+spread);
       Lsplitprice = (Close[i]);
       
       ExtMapBuffer0[i] = TopPlus;
       
       if (Top <  Hsplitprice) ExtMapBuffer1[i] = Hsplitprice;
       if (Top >= Hsplitprice) ExtMapBuffer1[i] = Top;
       
       ExtMapBuffer2[i] = Hsplitprice;
       ExtMapBuffer3[i] = Lsplitprice;
     }
    
//----
   return(0);
 }
//+------------------------------------------------------------------+

Comments