Stop_reversal_mod1_v1

Download script
Author: emsjoflo
Stop_reversal_mod1_v1

This tool is designed to identify potential price reversals in the financial markets by tracking specific behavior in price movement. It functions as a visual indicator and notification system that monitors how price interacts with previous historical levels, specifically looking for signs that a trend might be exhausting and about to turn around.

Core Logic and Mechanism

The script operates by constantly calculating a dynamic "Stop Level." Instead of relying on standard indicators like moving averages, it focuses on the relationship between current closing prices and the preceding price points.

1. Tracking Price Momentum The tool analyzes the direction of the market bar by bar. It determines if the price is trending upward, downward, or remaining stagnant. Based on this direction, it calculates a reference level (the Stop Level) that adjusts automatically:

  • If the price is moving down, the script establishes a floor based on the previous movement plus a small percentage buffer.
  • If the price is moving up, it establishes a ceiling based on the previous movement minus a small percentage buffer.

2. Identifying Reversal Signals The primary objective of the script is to detect "Stop Reversals." It looks for specific mathematical "crossovers" where the current price breaks through the established trend level in a way that suggests a shift in sentiment:

  • Buy Opportunities: When the price has been moving downward but suddenly closes above the calculated support level, the tool identifies this as a potential shift toward a bullish move.
  • Sell Opportunities: When the price has been moving upward but suddenly closes below the calculated resistance level, it identifies this as a potential shift toward a bearish move.

Visual and Notification Features

To assist the user in making trading decisions, the script provides several layers of feedback:

  • On-Chart Visuals: The tool plots colored bars (Blue and Red) directly on your chart to highlight the specific areas where these reversal conditions have been met. It also draws arrows or markers to pinpoint the exact moment the logic was triggered.
  • Automated Alerts: Because price movements can happen quickly, the script includes an alert system. When a potential setup is detected, it can trigger a pop-up notification on your screen.
  • Email Notifications: For traders who are not constantly watching their screens, the tool can be configured to send email alerts. These messages notify you of possible "Buy" or "Sell" setups on specific currency pairs or assets, including a time buffer to help you prepare for the move.

Summary for the User

In simple terms, this script acts as an early-warning system. It watches the market's "path of least resistance" and alerts you when the price behaves in a way that suggests it is about to break its current trend and head in the opposite direction, allowing for more proactive trading decisions.

Miscellaneous
Implements a curve of type %1It sends emails
12 Views
0 Downloads
0 Favorites
Stop_reversal_mod1_v1
/*-----------------------------+
|			       |
| Shared by www.Aptrafx.com    |
|			       |
+------------------------------*/

//+------------------------------------------------------------------
//|                                            Stopreversal Mt4.mq4 
//|                                                                  
//|                                                                  
//|                                 Conversion only Dr. Gaines       
//|                                 dr_richard_gaines@yahoo.com 
//|                                 modifications by Emsjoflo joel@emsjoflo.com     
//|                                                                  
//+------------------------------------------------------------------


#property copyright " emsjoflo"
#property link      "automaticforec.invisionzone.com"
#property indicator_chart_window
#include <stdlib.mqh>
#property indicator_buffers 4
#property indicator_color1 Lime
#property indicator_width1 2 
#property indicator_color2 Red
#property indicator_width2 2
#property indicator_color3 DodgerBlue
#property indicator_color4 Tomato



extern double nPips = 0.004;
extern bool SendAlert = true;
extern bool SendEmail = true;
extern int AlertMinutesB4Close =30;


int LastTradeTime;
double ExtHistoBuffer[];
double ExtHistoBuffer2[];
double BlueBar[],RedBar[];

void SetLoopCount(int loops)
{
}

void SetIndexValue(int shift, double value)
{
  ExtHistoBuffer[shift] = value;
}

void SetIndexValue2(int shift, double value)
{
  ExtHistoBuffer2[shift] = value;
}

int init()
{
   SetIndexStyle(0, DRAW_ARROW, STYLE_SOLID);
   SetIndexArrow(0, 233);
   SetIndexBuffer(0, ExtHistoBuffer);
   SetIndexStyle(1, DRAW_ARROW, STYLE_SOLID);
   SetIndexArrow(1, 234);
   SetIndexBuffer(1, ExtHistoBuffer2);
   SetIndexStyle(2,DRAW_HISTOGRAM,0,2);
   SetIndexBuffer(2,BlueBar); 
   SetIndexStyle(3,DRAW_HISTOGRAM,0,2);
   SetIndexBuffer(3,RedBar);
   
   
   
   return(0);
}
int start()
{
//+------------------------------------------------------------------

//| Local variables                                                  

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

int shift = 0;
double cnt = 0;
double TrStopLevel = 0;
double PREV = 0;
double pass = 0;

SetLoopCount(0);
// loop from first bar to current bar (with shift=0)
for(shift=Bars-2;shift>=0 ;shift--){ 


if( (Close[shift] == PREV) ) 
{
TrStopLevel=PREV;

}
else 
{
if( (Close[shift+1])<PREV && (Close[shift]<PREV)  ) 
{
TrStopLevel=MathMin(PREV,Close[shift]*(1+nPips));
}
      else 
      {
            if( ((Close[shift+1])>PREV) && (Close[shift]>PREV) ) 
            {
            TrStopLevel=MathMax(PREV,Close[shift]*(1-nPips));
            }

           else 
                  {
                  if( (Close[shift]>PREV) ) 
                  {                   
                  TrStopLevel=Close[shift]*(1-nPips);
                  }

                        else TrStopLevel=Close[shift]*
(1+nPips);
                  }
      }
}


if( Close[shift] > TrStopLevel &&  Close[shift+1]<PREV && PREV !=0 ) 
{
if (CurTime() -iTime(NULL,0,1)==(iTime(NULL,0,1)-iTime(NULL,0,2)-AlertMinutesB4Close*60) 
&& CurTime() -iTime(NULL,0,1)>=(iTime(NULL,0,2)-iTime(NULL,0,3)-AlertMinutesB4Close*60)
&& CurTime() -iTime(NULL,0,2)>=(iTime(NULL,0,1)-iTime(NULL,0,3)-AlertMinutesB4Close*60))
   {
   if(SendAlert) Alert("Look for Buying opportunity soon");
   if(SendEmail) SendMail("Possible Buy setup on "+Symbol(),"Stop Reversal Indicator is anticipating a Buy setup on "+Symbol()+Period()+"in "+AlertMinutesB4Close+" minutes"); 
   }
   RedBar[shift]=Low[shift];
   BlueBar[shift]=High[shift];
//SetOrder(OP_BUY,1,ask,2,0,ask+TakeProfit*Point,blue);
//Alert("buy");
SetIndexValue(shift, TrStopLevel);
}


if( Close[shift] < TrStopLevel &&  Close[shift+1]>PREV  && PREV !=0) 
{
if ((CurTime() -iTime(NULL,0,1))==(iTime(NULL,0,1)-iTime(NULL,0,2)-AlertMinutesB4Close*60)
&& (CurTime() -iTime(NULL,0,1))>=(iTime(NULL,0,2)-iTime(NULL,0,3)-AlertMinutesB4Close*60)
&& (CurTime() -iTime(NULL,0,2))>=(iTime(NULL,0,1)-iTime(NULL,0,3)-AlertMinutesB4Close*60))
   {
   if (SendAlert)Alert("Look for Selling opportunity soon");
   if(SendEmail) SendMail("Possible Sell setup on "+Symbol(),"Stop Reversal Indicator is anticipating a Sellz setup on "+Symbol()+Period()+"in "+AlertMinutesB4Close+" minutes");
   
   }
   
   
   BlueBar[shift]=Low[shift];
   RedBar[shift]=High[shift];
//SetOrder(OP_SELL,1,bid,2,0,bid-TakeProfit*Point,Red);
SetIndexValue2(shift, TrStopLevel);
//Alert("Sell");
}


PREV=TrStopLevel;
//Alert(TrStopLevel);
} 

  return(0);
}

Comments