5 bar reversal v1[real][1].5_v1

Download script
Author: Copyright � 2006, EvgeniX
5 bar reversal v1[real][1].5_v1

This tool is designed to assist traders by identifying potential trend reversals on a price chart. It works by analyzing the relationship between recent price movements and a specific historical window of 5 bars to spot instances where the market's momentum may be shifting significantly.

How the Logic Works

The script constantly scans the history of the chart, looking back at two different snapshots of time: the current immediate movement and a previous "reference" period. It compares several key metrics between these two periods, including the highest highs, lowest lows, and closing prices.

Key components of its logic include:

  • Historical Comparison: The script looks at a 5-bar window of data. It establishes a baseline by identifying the price extremes (the highest peak and lowest valley) from a point slightly further back in history.
  • Trend Breakout Detection: It monitors the current price action to see if it has "broken out" of those historical boundaries. It looks for specific mathematical conditions where the current high or low surpasses the previous period's limits, combined with a closing price that suggests a change in direction.
  • Visual Signaling: When the script detects these specific conditions, it places visual markers directly on your chart:
    • Sell Signals: Represented by red arrows, appearing when the current price action suggests a downward reversal.
    • Buy Signals: Represented by yellow arrows, appearing when the current price action suggests an upward reversal.
  • Real-Time Alerts: Beyond just visual markings, the script includes a notification system. When a new signal is generated on the most recent bar of the chart, it triggers an instant alert to notify the trader of the specific "Buy" or "Sell" opportunity as it happens in real-time.

Summary for the Trader

In simple terms, this tool acts as a "reversal detector." Instead of just following a trend, it waits for the price to move outside of its recent historical range in a way that suggests the old trend is exhausted and a new one is beginning. It then highlights these spots on your screen with colored arrows and alerts you immediately so you can react to the potential change in market direction.

Miscellaneous
Implements a curve of type %1
9 Views
0 Downloads
0 Favorites
5 bar reversal v1[real][1].5_v1
//+------------------------------------------------------------------+
//|                                                       5 Bars.mq4 |
//|                      Copyright © 2006, EvgeniX                   |
//|                                        
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, EvgeniX"
#property link      "EvgeniX"

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_width1 3
#property indicator_color2 Yellow
#property indicator_width2 3
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];

double fhigh;
double flow;
double fclose;

double shigh;
double slow;
double sclose;
double ttfn;



//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_ARROW,4);
   SetIndexArrow(0,218);
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexEmptyValue(0,0.0);
   SetIndexStyle(1,DRAW_ARROW,4);
   SetIndexArrow(1,217);
   SetIndexBuffer(1,ExtMapBuffer2);
   SetIndexEmptyValue(1,0.0);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//---- 
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    counted_bars=IndicatorCounted();
//---- 
  //for(int i=1  ;i<=500;i++)
   for(int i=500; i>0; i--)

    {
//Comment (i);

shigh=High[Highest(NULL, 0,2,5,i)];
slow=Low[Lowest(NULL,0,1,5,i)];
sclose=Close[i];

fhigh=High[Highest(NULL, 0, 2, 5, (i+5))];
flow=Low[Lowest(NULL,0,1,5,(i+5))];
fclose=Close[i+9];

//ExtMapBuffer2[i+5]=High[i]+0.0005;

//ExtMapBuffer1[i]=High[i]+0.0005;
Comment (i);
if ((shigh>fhigh) && (sclose<flow))
   {
      ExtMapBuffer1[i]=High[i+5]+0.0005;
      if (i==1 && !ttfn )Alert ("5Bar Reverse  S E L L ", Symbol()," M",Period());
      {
      ttfn=Time[0];
      }
   }
   
if ((slow<flow) && (sclose>fhigh))
   {
      ExtMapBuffer2[i]=Low[i+5]-0.0005;
      {
      if (i==1 && !ttfn ) Alert ("5Bar Reverse  B U Y ", Symbol()," M",Period());
            ttfn=Time[0];
      }
   }

//     Comment(Close[i+4]+" "+" "+DoubleToStr(i,1)+"  "+TimeToStr(Time[i],TIME_MINUTES)+
//     "\n"+" "+shigh+" "+slow+" "+sclose+
//     "\n"+" "+fhigh+" "+flow+" "+fclose);
    }


 
 
 
 
   
//----
   return(0);
  }
//+------------------------------------------------------------------+

Comments