Author: transport_david , David W Honeywell
Ask_Shadow

This custom indicator, Ask_Shadow, is designed to provide traders with a visual representation of the price "gap" or "shadow" created by the spread between the buying and selling prices on a trading chart.

Here is a breakdown of how the logic works in plain English:

The Core Concept

In financial markets, there is always a difference between the price at which you can buy a currency (the Ask) and the price at which you can sell it (the Bid). This difference is known as the spread. While most standard charts only show one primary price point, this script highlights the extra distance added by that spread to help traders visualize the actual executable price.

How the Logic Operates

The script continuously scans each historical bar on your chart and performs three specific calculations:

  1. Calculating the Spread: The tool first identifies the current difference between the Ask price and the Bid price at any given moment.
  2. Determining the High Points: It looks at the "High" price of each candle (the highest point reached during that time period).
  3. Mapping the Visuals:
    • It identifies the standard High of the candle as one data point.
    • It then adds the spread value to that High to create a second, slightly higher data point.

Visual Representation

The indicator renders these two points as histograms on your chart. By displaying these values side-by-side, the tool provides a visual "shadow" or extension. This allows you to see exactly how much the spread is impacting the price action beyond what the standard candle highs might suggest.

Essentially, it translates the hidden cost of trading (the spread) into a visible metric on your screen, helping you better understand the true upper limit of price movement during active trading.

Miscellaneous
Implements a curve of type %1
11 Views
0 Downloads
0 Favorites
Ask_Shadow
//+------------------------------------------------------------------+
//|                                                   Ask_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 2
#property indicator_color1 Lime
#property indicator_color2 Lime
//---- input parameters

//---- buffers

double ExtMapBuffer1[];
double ExtMapBuffer2[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_HISTOGRAM, 0, 1, Coral);
   SetIndexBuffer(0, ExtMapBuffer1);
   SetIndexStyle(1,DRAW_HISTOGRAM, 0, 1, Coral);
   SetIndexBuffer(1, ExtMapBuffer2);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//---- 
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   double spread, 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]);
      ExtMapBuffer1[i]=TopPlus;
      ExtMapBuffer2[i]=Top;
      }
      
//----
   return(0);
  }
//+------------------------------------------------------------------+

Comments