[i]2RSIXover_v03

Download script
Author: Ron Thompson
[i]2RSIXover_v03

This tool is designed as a visual signaling system for traders who use the Relative Strength Index (RSI) to identify momentum shifts in the market. Its primary purpose is to automatically detect specific "crossover" moments where two different RSI speeds interact, translating these mathematical movements into clear visual cues on your price chart.

Core Logic and Functionality

The script operates by comparing two distinct versions of the RSI indicator simultaneously:

  • A Fast RSI: Designed to react quickly to recent price fluctuations.
  • A Slow RSI: Designed to provide a smoother, longer-term perspective of the market trend.

By monitoring these two lines at once, the tool identifies the exact moment when the faster momentum "breaks through" or crosses over the slower trend.

Signal Generation

The logic interprets these crossovers as specific entry or exit signals:

  • Bullish Signals (Upward Momentum): When the Fast RSI moves from below the Slow RSI to above it, the script identifies a bullish crossover. It automatically places a white upward arrow at the bottom of the price candle to suggest that momentum is shifting toward the upside.
  • Bearish Signals (Downward Momentum): Conversely, when the Fast RSI drops from above the Slow RSI to below it, the script identifies a bearish crossover. It places a red downward arrow at the top of the price candle, signaling a potential shift toward the downside.

User Customization

The tool is built with flexibility in mind, allowing users to adjust three key parameters to suit different trading styles:

  1. Speed Settings: You can define the specific timeframes for both the Fast and Slow RSI (e.g., setting one to a very short period and the other to a longer period).
  2. Calculation Type: The script allows for different types of RSI calculations, ensuring it can be adapted to various market conditions.
  3. Visual Clarity: The signals are programmed to appear at a slight offset from the highest and lowest points of the candles, ensuring they remain visible and do not clutter the actual price action.

In summary, this script simplifies complex momentum analysis by automating the detection of RSI crossovers, providing traders with immediate visual confirmation of potential trend changes directly on their charts.

Price Data Components
Indicators Used
Relative strength index
Miscellaneous
Implements a curve of type %1
7 Views
0 Downloads
0 Favorites
[i]2RSIXover_v03
//+------------------------------------------------------------------+
//| 5 Min RSI cross-over INDICATOR                               |
//+------------------------------------------------------------------+
#property copyright "Ron Thompson"
#property link      "http://www.lightpatch.com"

#property indicator_chart_window
#property indicator_buffers 2

// buy sell indicators 
#property indicator_color1 White
#property indicator_color2 Red

//---- buffers
double Buffer1[]; //White
double Buffer2[]; //Red

extern int    RSISlow=14;
extern int    RSIFast=7;
extern int    RSIType=1;



//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//|------------------------------------------------------------------|

int init()
  {
   // 233 up arrow
   // 234 down arrow
   // 159 big dot
   
   SetIndexStyle(0,DRAW_ARROW);
   SetIndexBuffer(0, Buffer1);
   SetIndexArrow(0,233);  //white up
   
   SetIndexStyle(1,DRAW_ARROW);
   SetIndexBuffer(1, Buffer2);
   SetIndexArrow(1,234);  // red down
  }


//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
   int i;
   
   for( i=0; i<Bars; i++ ) Buffer1[i]=0;
   for( i=0; i<Bars; i++ ) Buffer2[i]=0;
  }


//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+


int start()
  {
   int      pos=Bars-100; // leave room for moving average periods
   int      ctr=0;
   
   double p=Point();
   
   double  pRSI4=0,  RSI4=0;
   double  pRSI7=0,  RSI7=0;
 
   
   while(pos>=1)
     {
      // RSI for Crossover
      if(RSIType==1)
        {
          RSI4=iRSI(Symbol(),0,RSIFast,RSIType,pos+0);
         pRSI4=iRSI(Symbol(),0,RSIFast,RSIType,pos+1);
          RSI7=iRSI(Symbol(),0,RSISlow,RSIType,pos+0);
         pRSI7=iRSI(Symbol(),0,RSISlow,RSIType,pos+1);
        }
         else
        {
          RSI4=iRSI(Symbol(),0,RSIFast,RSIType,pos+1);
         pRSI4=iRSI(Symbol(),0,RSIFast,RSIType,pos+2);
          RSI7=iRSI(Symbol(),0,RSISlow,RSIType,pos+1);
         pRSI7=iRSI(Symbol(),0,RSISlow,RSIType,pos+2);
        }

      // Determine if there was a cross
      if(pRSI4<pRSI7 && RSI4>RSI7) {Buffer1[pos]= Low[pos]-(2*p);} // up arrow on bottom
      if(pRSI4>pRSI7 && RSI4<RSI7) {Buffer2[pos]=High[pos]+(2*p);} // down arrow on top
 	   pos--;
     }

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

Comments