Author: Copyright � 2005, TrendLaboratory Ltd.
StepRSI_v2

The StepRSI_v2 is a technical analysis tool designed to help traders visualize market momentum and identify potential trend exhaustion or reversals. It builds upon the standard Relative Strength Index (RSI)—a common momentum oscillator—by adding a "stepping" mechanism that tracks price movements more dynamically.

How the Logic Works

The indicator operates by analyzing three distinct components simultaneously on your chart:

1. The Core RSI Foundation At its base, the script calculates the standard RSI based on a user-defined period (defaulting to 14). This represents the raw momentum of the asset. In the visual display, this is represented by the first line, showing you the current strength of the price movement.

2. The Dual "Step" Filters (Fast and Slow) The unique logic of this script lies in how it processes two different "Step Sizes." Think of these as buffers or boundaries that react differently to market volatility:

  • Fast Step: Reacts more quickly to immediate price fluctuations. It is designed to catch shorter-term shifts in momentum.
  • Slow Step: Reacts more gradually, filtering out minor market noise to provide a broader view of the underlying trend.

3. Dynamic Boundary Tracking Instead of simply moving with the price, the "Step" logic uses a memory system. The script evaluates whether the current RSI value has pushed beyond a certain threshold (the Step Size).

  • Trend Identification: When the RSI breaks above or below these specific boundaries, the script establishes a "trend" state.
  • Memory Persistence: Once a trend is established, the indicator "remembers" the previous boundaries. This prevents the lines from jumping erratically; they only move forward when the momentum provides enough strength to break the existing step.

Visual Interpretation for Traders

The result is a visual display featuring three lines:

  • The RSI Line: Your primary reference for current momentum.
  • Fast Step Line: A boundary that helps identify short-term trend shifts.
  • Slow Step Line: A boundary that highlights the broader, more significant trends.

By observing the distance between the RSI line and these Step lines, traders can better gauge "overextended" movements. When the RSI pushes toward the outer step boundaries, it indicates a strong trend; when it pulls away or struggles to break through them, it may signal that the momentum is losing steam and a reversal could be approaching.

Indicators Used
Relative strength index
Miscellaneous
Implements a curve of type %1
10 Views
0 Downloads
0 Favorites
StepRSI_v2
//+------------------------------------------------------------------+
//|                                                   StepRSI_v2.mq4 |
//|                           Copyright © 2005, TrendLaboratory Ltd. |
//|                                       E-mail: igorad2004@list.ru |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2005, TrendLaboratory Ltd."
#property link      "E-mail: igorad2004@list.ru"

#property indicator_separate_window
#property indicator_minimum 20
#property indicator_maximum 80
#property indicator_buffers 3
#property indicator_color1 Orange
#property indicator_color2 SkyBlue
#property indicator_color3 Magenta
//---- input parameters
extern int PeriodRSI=14;
extern int StepSizeFast=5;
extern int StepSizeSlow=15;
//extern int HighLow=0;
//---- indicator buffers
double Line1Buffer[];
double Line2Buffer[];
double Line3Buffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
  int init()
  {
   string short_name;
//---- indicator line
   SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,1);
   SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,1);
   SetIndexStyle(2,DRAW_LINE,STYLE_SOLID,1);
   SetIndexBuffer(0,Line1Buffer);
   SetIndexBuffer(1,Line2Buffer);
   SetIndexBuffer(2,Line3Buffer);
   IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS));
//---- name for DataWindow and indicator subwindow label
   short_name="StepRSI("+PeriodRSI+","+StepSizeFast+","+StepSizeSlow+")";
   IndicatorShortName(short_name);
   SetIndexLabel(0,"RSI");
   SetIndexLabel(1,"StepRSI fast");
   SetIndexLabel(2,"StepRSI slow");
//----
   SetIndexDrawBegin(0,1);
   SetIndexDrawBegin(1,1);
   SetIndexDrawBegin(2,1);
//----
   return(0);
  }

//+------------------------------------------------------------------+
//| StepRSI_v2                                                         |
//+------------------------------------------------------------------+
int start()
  {
   int shift,ftrend,strend;
   double fmin0,fmax0,fmin1,fmax1,smin0,smax0,smin1,smax1,RSI0;

   
   for(shift=Bars-1;shift>=0;shift--)
   {	
   RSI0=iRSI(NULL,0,PeriodRSI,PRICE_CLOSE,shift);
   
	  fmax0=RSI0+2*StepSizeFast;
	  fmin0=RSI0-2*StepSizeFast;
	  	    
	  if (RSI0>fmax1)  ftrend=1; 
	  if (RSI0<fmin1)  ftrend=-1;

	  if(ftrend>0 && fmin0<fmin1) fmin0=fmin1;
	  if(ftrend<0 && fmax0>fmax1) fmax0=fmax1;
	  
	  smax0=RSI0+2*StepSizeSlow;
	  smin0=RSI0-2*StepSizeSlow;
		
	  if (RSI0>smax1)  strend=1; 
	  if (RSI0<smin1)  strend=-1;

	  if(strend>0 && smin0<smin1) smin0=smin1;
	  if(strend<0 && smax0>smax1) smax0=smax1;
	    
	  
	  Line1Buffer[shift]=RSI0;
	  
	  if (ftrend>0) Line2Buffer[shift]=fmin0+StepSizeFast;
	  if (ftrend<0) Line2Buffer[shift]=fmax0-StepSizeFast;
	  
	  if (strend>0) Line3Buffer[shift]=smin0+StepSizeSlow;
	  if (strend<0) Line3Buffer[shift]=smax0-StepSizeSlow;
	  
	  fmin1=fmin0;
	  fmax1=fmax0;
	  smin1=smin0;
	  smax1=smax0;
	 }
	return(0);	
 }

Comments