5min_rsi_qual_02IND_v1

Download script
Author: Ron T
5min_rsi_qual_02IND_v1

This indicator is designed to identify specific momentum shifts in the market by analyzing the Relative Strength Index (RSI). It focuses on identifying "qualifying" price movements where a trend has established significant persistence but is also reaching a point of potential exhaustion or reversal.

Core Logic and Methodology

The tool operates by scanning historical price data and calculating an RSI value over a 28-period window. Rather than simply looking at whether the RSI is high or low, it evaluates the consistency of these values over specific time frames to determine the "quality" of the market position.

1. Trend Qualification (The Short Window) The script looks back at the last 11 bars (the "qual" period). To qualify a move as a consistent trend, it checks if the RSI has remained strictly on one side of the midline (50) for that entire duration:

  • Bullish: The RSI must be consistently above 50.
  • Bearish: The RSI must be consistently below 50.

2. Exhaustion Detection (The Long Window) To distinguish between a healthy trend and an overextended move, the script also analyzes a larger window of 22 bars (double the qualification period). It looks for instances where the RSI has remained on one side of the midline for this longer duration.

3. Signal Generation The indicator places a visual signal only when a specific "sweet spot" in momentum is met:

  • Buy Signals: These appear when the market shows a consistent bullish trend over the short 11-bar window, but that consistency has been broken over the longer 22-bar window. Essentially, it identifies a move that is currently strong but may be losing the long-term momentum required to sustain further growth.
  • Sell Signals: These appear when the market shows a consistent bearish trend over the short 11-bar window, but that consistency has been broken over the longer 22-bar window.

Summary for the User

In practical terms, this script ignores minor fluctuations and only highlights moments where a short-term trend is "qualified" by history but is beginning to diverge from the long-term momentum. It acts as a filter to help traders identify points where a move might be becoming overextended, providing a visual cue on the chart to monitor potential reversals or consolidation phases.

Indicators Used
Relative strength index
Miscellaneous
Implements a curve of type %1
12 Views
0 Downloads
0 Favorites
5min_rsi_qual_02IND_v1
/*-----------------------------+
|			       |
| Shared by www.Aptrafx.com    |
|			       |
+------------------------------*/

//+------------------------------------------------------------------+
//| 5 Min RSI 12-period qual INDICATOR                               |
//+------------------------------------------------------------------+
#property copyright "Ron T"
#property link      "http://www.lightpatch.com"

#property indicator_chart_window
#property indicator_buffers 8

#property indicator_color1 DodgerBlue

//#property indicator_color1 Red
#property indicator_color2 HotPink
#property indicator_color3 LightPink
#property indicator_color4 MistyRose

#property indicator_color5 DodgerBlue

//#property indicator_color5 White
#property indicator_color6 LightGray
#property indicator_color7 LightSlateGray
#property indicator_color8 DarkGray


//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];
double ExtMapBuffer5[];
double ExtMapBuffer6[];
double ExtMapBuffer7[];
double ExtMapBuffer8[];


// User Input


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

int init()
  {

   // 233 up arrow
   // 234 down arrow
   // 159 big dot
   // 168 open square
   
   SetIndexStyle(0,DRAW_ARROW);
   SetIndexBuffer(0, ExtMapBuffer1);
   SetIndexArrow(0,159);  //up
   
   SetIndexStyle(1,DRAW_ARROW);
   SetIndexBuffer(1, ExtMapBuffer2);
   SetIndexArrow(1,159);  //down

   SetIndexStyle(2,DRAW_ARROW);
   SetIndexBuffer(2, ExtMapBuffer3);
   SetIndexArrow(2,159);

   SetIndexStyle(3,DRAW_ARROW);
   SetIndexBuffer(3, ExtMapBuffer4);
   SetIndexArrow(3,159);

   SetIndexStyle(4,DRAW_ARROW);
   SetIndexBuffer(4, ExtMapBuffer5);
   SetIndexArrow(4,159);

   SetIndexStyle(5,DRAW_ARROW);
   SetIndexBuffer(5, ExtMapBuffer6);
   SetIndexArrow(5,159);

   SetIndexStyle(6,DRAW_ARROW);
   SetIndexBuffer(6, ExtMapBuffer7);
   SetIndexArrow(6,159);

   SetIndexStyle(7,DRAW_ARROW);
   SetIndexBuffer(7, ExtMapBuffer8);
   SetIndexArrow(7,159);

   return(0);
  }


//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
   int i;
   
   for( i=0; i<Bars; i++ ) ExtMapBuffer1[i]=0;
   for( i=0; i<Bars; i++ ) ExtMapBuffer2[i]=0;
   for( i=0; i<Bars; i++ ) ExtMapBuffer3[i]=0;
   for( i=0; i<Bars; i++ ) ExtMapBuffer4[i]=0;
   for( i=0; i<Bars; i++ ) ExtMapBuffer5[i]=0;
   for( i=0; i<Bars; i++ ) ExtMapBuffer6[i]=0;
   for( i=0; i<Bars; i++ ) ExtMapBuffer7[i]=0;
   for( i=0; i<Bars; i++ ) ExtMapBuffer8[i]=0;

   return(0);
  }


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

// Current position if 55/45 or over/under. Does any of 
// the previous 'qual' period ever fall below55/above45? (last11)
//
// If qual*2 periods have been above55/below45
// then lets not try to transact any more (last22)
         

int start()
  {
   double   rsi=0;        // Relative Strength Indicator
   int      i=0;
   int      pos=Bars-100; // leave room for moving average periods
   int      qual=11;       // how many bars to qualify
   
   bool   last11=true;        // qualify flag
   bool   last22=true;        // qualify flag
      
   while(pos>=0)
     {
      rsi=iRSI(Symbol(),0,28,PRICE_CLOSE,pos);
      
      if (rsi>50)
        {
         //ExtMapBuffer8[pos]=High[pos]+0.0006;
         last11=true;
         for(i=pos+1; i<=(pos+qual); i++)
           {
            if (iRSI(Symbol(),0,28,PRICE_CLOSE,i)<50) last11=false;
           }
         //if (last11==true) ExtMapBuffer7[pos]=High[pos]+0.0004;

         last22=true;
         for(i=pos+1; i<=(pos+(qual*2)); i++)
           {
            if (iRSI(Symbol(),0,28,PRICE_CLOSE,i)<50) last22=false;
           }
         //if (last22==true) ExtMapBuffer6[pos]=High[pos]+0.0002;

         if (last11==true && last22==false) ExtMapBuffer1[pos]=High[pos]+0.0003;
        }


      if (rsi<50)
        {
         //ExtMapBuffer4[pos]=Low[pos]-0.0006;
         last11=true;
         for(i=pos+1; i<=(pos+qual); i++)
           {
            if (iRSI(Symbol(),0,28,PRICE_CLOSE,i)>50) last11=false;
           }
         //if (last11==true) ExtMapBuffer3[pos]=Low[pos]-0.0004;

         last22=true;
         for(i=pos+1; i<=(pos+(qual*2)); i++)
           {
            if (iRSI(Symbol(),0,28,PRICE_CLOSE,i)>50) last22=false;
           }
         //if (last22==true) ExtMapBuffer2[pos]=Low[pos]-0.0002;

         if (last11==true && last22==false) ExtMapBuffer5[pos]=Low[pos]-0.0003;
        }




 	   pos--;
     }

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

Comments