High Low Breakdown

Download script
Author: Copyright © 2021, Vladimir Karputov

This tool is a specialized visual indicator designed for the MetaTrader 5 platform. Its primary purpose is to help traders identify "breakdown" moments on a price chart by highlighting specific price movements where new highs or lows are established.

Core Logic and Functionality

The script works by scanning the price history of a financial instrument and comparing each current price bar to the one immediately preceding it. It focuses on two specific types of data points:

1. High Price Breakdowns (Upper Markers) The tool monitors the highest price reached during each period. If the "High" price of the current candle is higher than the "High" price of the previous candle, the script triggers a visual marker. These are displayed as blue arrows on your chart. This helps traders quickly spot upward momentum or the creation of new local ceilings.

2. Low Price Breakdowns (Lower Markers) Similarly, the tool monitors the lowest price reached during each period. If the "Low" price of the current candle drops below the "Low" price of the previous candle, the script triggers a visual marker. These appear as red arrows on your chart. This is designed to alert traders to downward momentum or the formation of new local floors.

Customization Options

To ensure the tool fits your specific trading style and visual preferences, it includes several adjustable settings:

  • Visual Styling: You can choose the specific shape of the arrows (using Wingdings font codes) so they stand out clearly against your background.
  • Positioning (Offset): Both the High and Low markers have "Shift" settings. This allows you to move the arrows vertically (up or down in pixels) away from the actual price candles. This is useful for preventing the markers from overlapping with the bars, ensuring a cleaner and more readable chart.
  • Color Coordination: The tool uses distinct colors—Blue for Highs and Red for Lows—providing an immediate visual cue of market direction.

Summary for Traders

Instead of manually checking every candle to see if a previous high or low was breached, this script automates that observation. It effectively "filters" the price action to highlight only the points of significant expansion. By looking at where these arrows cluster, traders can better visualize trend strength and identify key structural shifts in the market.

12 Views
0 Downloads
0 Favorites
High Low Breakdown
ÿþ//+------------------------------------------------------------------+

//|                                           High Low Breakdown.mq5 |

//|                              Copyright © 2021, Vladimir Karputov |

//|                     https://www.mql5.com/ru/market/product/43516 |

//+------------------------------------------------------------------+

#property copyright "Copyright © 2021, Vladimir Karputov"

#property link      "https://www.mql5.com/ru/market/product/43516"

#property version   "1.001"

#property indicator_chart_window

#property indicator_buffers 2

#property indicator_plots   2

//--- plot Upper

#property indicator_label1  "High"

#property indicator_type1   DRAW_ARROW

#property indicator_color1  clrBlue

#property indicator_style1  STYLE_SOLID

#property indicator_width1  1

//--- plot Low

#property indicator_label2  "Low"

#property indicator_type2   DRAW_ARROW

#property indicator_color2  clrRed

#property indicator_style2  STYLE_SOLID

#property indicator_width2  1

//--- input parameters

input group             "High"

input uchar    InpHighCode       = 159;   // High: symbol code from the Wingdings font

input int      InpHighShift      = 15;    // High: vertical shift of arrows in pixels

input group             "Low"

input uchar    InpLowCode        = 159;   // Low: symbol code from the Wingdings font

input int      InpLowShift       = 15;    // Low: vertical shift of arrows in pixels

//--- indicator buffers

double   HighBuffer[];

double   LowBuffer[];

//+------------------------------------------------------------------+

//| Custom indicator initialization function                         |

//+------------------------------------------------------------------+

int OnInit()

  {

//--- indicator buffers mapping

   SetIndexBuffer(0,HighBuffer,INDICATOR_DATA);

   SetIndexBuffer(1,LowBuffer,INDICATOR_DATA);

//--- setting a code from the Wingdings charset as the property of PLOT_ARROW

   PlotIndexSetInteger(0,PLOT_ARROW,InpHighCode);

   PlotIndexSetInteger(1,PLOT_ARROW,InpLowCode);

//--- setting a vertical shift of arrows in pixels

   PlotIndexSetInteger(0,PLOT_ARROW_SHIFT,-InpHighShift);

   PlotIndexSetInteger(1,PLOT_ARROW_SHIFT,InpLowShift);

//--- set as an empty value 0

   PlotIndexSetDouble(0,PLOT_EMPTY_VALUE,0.0);

   PlotIndexSetDouble(1,PLOT_EMPTY_VALUE,0.0);

//---

   return(INIT_SUCCEEDED);

  }

//+------------------------------------------------------------------+

//| Custom indicator iteration function                              |

//+------------------------------------------------------------------+

int OnCalculate(const int rates_total,

                const int prev_calculated,

                const datetime &time[],

                const double &open[],

                const double &high[],

                const double &low[],

                const double &close[],

                const long &tick_volume[],

                const long &volume[],

                const int &spread[])

  {

//---

   if(rates_total<3)

      return(0);

   int limit=prev_calculated-1;

   if(prev_calculated==0)

     {

      HighBuffer[0]=0.0;

      LowBuffer[0]=0.0;

      limit=1;

     }

   for(int i=limit; i<rates_total; i++)

     {

      //--- current bar

      HighBuffer[i]=0.0;

      LowBuffer[i]=0.0;

      //---

      if(high[i]>high[i-1])

         HighBuffer[i]=high[i];

      if(low[i]<low[i-1])

         LowBuffer[i]=low[i];

     }

//--- return value of prev_calculated for next call

   return(rates_total);

  }

//+------------------------------------------------------------------+

Comments