ShashiRSI2Ind

Download script
Author: Copyright � 2006, Robert Hill
ShashiRSI2Ind

This tool is designed to act as an automated visual assistant for traders, identifying specific momentum shifts in the market and highlighting them directly on a price chart. Rather than requiring the trader to manually monitor every price movement, the script scans historical and real-time data to pinpoint moments where the market's underlying strength begins to trend in a particular direction.

Core Logic and Mechanics

The script operates by analyzing two primary components of market data: Price Volatility (Range) and Relative Strength (RSI).

1. Volatility Measurement To ensure that the visual signals are appropriately placed on the chart, the tool calculates an average "Range." It looks at the difference between the highest and lowest prices over a recent 10-bar period. By determining this average, the script can accurately calculate how far above or below the current price it should place its visual markers, ensuring they remain clear and easy to see regardless of how volatile the market is at that moment.

2. Momentum Analysis The heart of the logic lies in the analysis of the Relative Strength Index (RSI). The script specifically looks for a "sequence" of momentum changes over three consecutive bars. It isn't just looking for a high or low value; it is looking for a specific directional progression:

  • Upward Momentum Detection: The tool identifies a potential bullish signal when the RSI values across three consecutive points are declining significantly and stay below a mid-point threshold of 50.
  • Downward Momentum Detection: Conversely, it identifies a potential bearish signal when the RSI values increase sequentially across three consecutive points while remaining above that same mid-point threshold.

Visual Output

Once these specific conditions are met—where the momentum shows a consistent, sequential trend relative to the 50-level—the script automatically generates visual cues on your chart:

  • Buy Signals: When the upward momentum criteria are satisfied, the script places an arrow below the "Low" of the current candle.
  • Sell Signals: When the downward momentum criteria are satisfied, the script places an arrow above the "High" of the current candle.

By combining these elements, the tool provides a streamlined way for traders to identify trend continuations or reversals based on sequential momentum shifts, removing the need to manually interpret complex RSI fluctuations.

Indicators Used
Relative strength index
Miscellaneous
Implements a curve of type %1
14 Views
0 Downloads
0 Favorites
ShashiRSI2Ind
//compile//
//+------------------------------------------------------------------+
//|                                       EMA_58_Crossover_Alert.mq4 |
//|                         Copyright © 2006, Robert Hill            |
//|                                                                  |
//| Written Robert Hill for use with AIME for the EMA 5/8 cross to   |
//| draw arrows and popup alert or send email                        |
//+------------------------------------------------------------------+

#property copyright "Copyright © 2006, Robert Hill"

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 LawnGreen
#property indicator_color2 Red
#property indicator_width1  2
#property indicator_width2  2

double CrossUp[];
double CrossDown[];
double RSI1, RSI2, RSI3;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0, DRAW_ARROW, EMPTY);
   SetIndexArrow(0, 233);
   SetIndexBuffer(0, CrossUp);
   SetIndexStyle(1, DRAW_ARROW, EMPTY);
   SetIndexArrow(1, 234);
   SetIndexBuffer(1, CrossDown);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//---- 

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


//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start() {
   int limit, i, counter;
   double tmp=0;
   double Range, AvgRange;
   int counted_bars=IndicatorCounted();
//---- check for possible errors
   if(counted_bars<0) return(-1);
//---- last counted bar will be recounted
   if(counted_bars>0) counted_bars--;

   limit=Bars-counted_bars;
   
   for(i = 1; i <= limit; i++) {
   
      counter=i;
      Range=0;
      AvgRange=0;
      for (counter=i ;counter<=i+9;counter++)
      {
         AvgRange=AvgRange+MathAbs(High[counter]-Low[counter]);
      }
      Range=AvgRange/10;
       

      RSI1=iRSI(Symbol(),0,2,PRICE_CLOSE,i);
      RSI2=iRSI(Symbol(),0,2,PRICE_CLOSE,i+1);
      RSI3=iRSI(Symbol(),0,2,PRICE_CLOSE,i+2);
      
      CrossUp[i] = 0;
      CrossDown[i] = 0;
      if (RSI3<50 && RSI2<RSI3 && RSI1<RSI2)
      {
         CrossUp[i] = Low[i] - Range*0.75;
      }
      else if (RSI3>50 && RSI2>RSI3 && RSI1>RSI2)
      {
         CrossDown[i] = High[i] + Range*0.75;
      }
   }

   return(0);
}

Comments