q-AfterBrkBar

Download script
Author: Copyright � 2009, Arshed Qureshi. ArshadFX
q-AfterBrkBar

This tool is designed to help traders visually identify and estimate the strength of a market trend by detecting significant price breakouts. Rather than just showing every small movement, the script focuses on moments where the price moves beyond a specific threshold, suggesting a potential shift in momentum.

How the Logic Works

The script scans back through a user-defined number of previous candles (the "LookBack" period) to identify two specific types of breakout events:

1. Upward Momentum Detection (Bullish) The tool looks for instances where the price on a new candle climbs significantly higher than the high of the previous candle. It doesn't just look for any increase; it calculates a minimum "breakout distance" by factoring in several variables:

  • The current market spread.
  • A user-defined offset.
  • A specific number of pips.

If the price exceeds this calculated boundary, the script marks that moment on your chart with a blue visual indicator, signaling a potential strong upward trend.

2. Downward Momentum Detection (Bearish) Similarly, the tool monitors for sharp drops. It checks if the price on a new candle falls significantly lower than the low of the previous candle, again using the spread, offset, and pip settings to determine the required distance. When this threshold is crossed, the script marks the area with a red visual indicator, suggesting a potential strong downward trend.

Visual Feedback

To make these insights easy to read at a glance, the tool places "paint bars" (horizontal line segments) directly on your chart:

  • Blue Bars: Represent detected upward breakouts.
  • Red Bars: Represent detected downward breakouts.

By highlighting only these significant movements, the script helps filter out market "noise," allowing traders to focus on high-impact price action and better estimate the power behind a prevailing trend.

9 Views
0 Downloads
0 Favorites
q-AfterBrkBar
//q-AfterBrkBar.mq4,    
//          Copyright © 2009, Arshed Qureshi arshedfx@gmail.com
/*
This indicator is to estimate power of trend after break high/Low
*/
#property copyright "Copyright © 2009, Arshed Qureshi. ArshadFX"
#property  indicator_chart_window

extern int Pips            =10;             
extern int Offset          =1;               
extern int LookBack        =20;              // 0=Look all bars
extern string D="---== Drawing Settigs ==---";
//extern bool ShowRange      =0;               // 0=Show Nothing, 1=Show Pips/Range
extern int  PaintBarWidth  =3;               // How fat paint bar will be ?       
extern color BULL          =Blue;            // Colour for UP bar
extern color BEAR          =Red;             // Colour for DOWN bar
int sp;

// --- Init & Deinit ----------------------------------------------------------
int init()     {if (LookBack==0) LookBack = Bars; sp=MarketInfo(Symbol(),MODE_SPREAD); return(0); }
int deinit()   
   {
   Comment("");
   for(int i=LookBack; i>=0; i--)
      {
      ObjectDelete("L"+i);
      ObjectDelete("H"+i);
      }	
return(0); }
// --- Main Function call -----------------------------------------------------
int start()
   {
   for(int x=LookBack; x>1; x--)
      {
      //GetRange=(High[x]-Low[x]); if(Digits<4) GetRange=GetRange*100; else GetRange=GetRange*10000;
      if (High[x-1] > High[x]+sp*Point+Offset*Point+Pips*Point)
         {
         //Alert("x : ",x,", High x : ",High[x],",  High+sp : ",High[x]+sp*Point,",  High+SP+Offset : ",High[x]+sp*Point+Offset*Point,",  High+SP+Offset+Pips : ",High[x]+sp*Point+Offset*Point+Pips*Point);
         ObjectCreate("H"+x, OBJ_TREND, 0, Time[x-1],High[x]+sp*Point+Offset*Point,Time[x-1],High[x]+sp*Point+Offset*Point+Pips*Point);
         ObjectSet("H"+x,10,0); ObjectSet("H"+x,8,PaintBarWidth); ObjectSet("H"+x,6,BULL);
         }
      if (Low[x-1] < Low[x]-sp*Point-Offset*Point-Pips*Point)
         {
         //Alert("x : ",x,", Low x : ",Low[x],",  Low-sp : ",Low[x]-sp*Point,",  Low-SP-Offset : ",Low[x]-sp*Point-Offset*Point,",  Low-SP-Offset-Pips : ",Low[x]-sp*Point-Offset*Point-Pips*Point);
         ObjectCreate("L"+x, OBJ_TREND, 0, Time[x-1],Low[x]-Offset*Point,Time[x-1],Low[x]-sp*Point-Offset*Point-Pips*Point );
         ObjectSet("L"+x,10,0); ObjectSet("L"+x,8,PaintBarWidth); ObjectSet("L"+x,6,BEAR);
         }
      }
// --- Display on Screen ------------------------------------------------------      
   Comment  ("Spread : ",sp
            ,"\n--------------"
            ,"\nPips   : ",Pips
            ,"\nOffset : ",Offset
            );

   return(0);
   }
// --- End of Main Function ---------------------------------------------------










Comments