Full_Bar_w_Spread_Shadow_v1

Download script
Author: transport_david , David W Honeywell
Full_Bar_w_Spread_Shadow_v1

This tool is designed to provide traders with a more comprehensive visual representation of market price action by incorporating the "Spread" (the difference between the buying and selling price) into the standard candlestick data. While standard charts often simplify these values, this indicator aims to highlight the actual boundaries where transactions occur.

Core Logic Overview

The script processes every candle on your chart to identify four distinct price levels. It achieves this by taking the standard high, low, and closing prices and adjusting them based on the live market spread. By doing so, it provides a more "full" picture of the bar's range.

How the Data is Processed

The indicator calculates the following specific components for every historical and current candle:

  • The Adjusted High: It identifies the highest point of the price movement and adds the current spread to it. This represents the maximum potential price a buyer might face.
  • The Dynamic Split Point: The logic evaluates the relationship between the high of the candle and its closing price (plus the spread). Depending on which value is higher, it selects the most significant boundary. This helps in identifying where the "true" upper limit of a move occurred relative to the closing price.
  • The Adjusted Closing Price: It calculates the price at which a trade would actually be executed based on the current spread, rather than just the theoretical closing price shown on a standard chart.
  • The Base Closing Price: It tracks the standard closing price as a baseline for comparison against the spread-adjusted figures.

Visual Representation

These four distinct data points are plotted as histograms on your chart. By visualizing these values simultaneously, the tool allows you to see the "shadows" cast by the market spread. Instead of looking at a simplified bar, you can see the actual space between the bid and ask prices, providing a clearer view of the price volatility and the true boundaries of market activity.

Miscellaneous
Implements a curve of type %1
6 Views
0 Downloads
0 Favorites
Full_Bar_w_Spread_Shadow_v1
/*-----------------------------+
|			       |
| Shared by www.Aptrafx.com    |
|			       |
+------------------------------*/

//+------------------------------------------------------------------+
//|                                     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, 0, 1);
   SetIndexBuffer(0, ExtMapBuffer0);
   SetIndexStyle(1,DRAW_HISTOGRAM, 0, 1);
   SetIndexBuffer(1, ExtMapBuffer1);
   SetIndexStyle(2,DRAW_HISTOGRAM, 0, 1);
   SetIndexBuffer(2, ExtMapBuffer2);
   SetIndexStyle(3,DRAW_HISTOGRAM, 0, 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