RSI-R2_voting_Ron3a

Download script
Author: Ron Thompson
RSI-R2_voting_Ron3a

This tool is designed to help traders identify potential market turning points by analyzing momentum trends across multiple timeframes simultaneously. Rather than looking at a single price point, the script uses a "voting" system to determine the strength of a trend based on historical Relative Strength Index (RSI) data.

How the Logic Works

1. Multi-Period Analysis The script looks at the Daily timeframe to establish a broad market context. It evaluates a specific number of periods (which you can customize) to see how the market has behaved over time. This prevents the indicator from reacting to "noise" or minor, temporary price fluctuations.

2. The "Voting" System The core logic treats different historical data points as individual "votes." It scans through a sequence of previous daily periods and checks for two specific types of momentum:

  • Buy Signals: The script looks for instances where the RSI values are dropping consistently (each subsequent value being lower than the one before it) while staying below a certain threshold.
  • Sell Signals: Conversely, it looks for instances where RSI values are rising consistently while staying above a specific threshold.

3. Signal Confirmation Instead of providing a signal every time a trend is detected, the script requires a "quorum." It counts how many times these conditions are met across the chosen number of periods. A visual signal will only appear on your chart if the number of votes exceeds a minimum limit you set in the settings.

Visual Representation on the Chart

When the "votes" for either a buy or sell trend exceed your specified requirements, the script automatically places a text label directly on your trading chart:

  • Buy Votes: Displayed in White, showing the strength of the downward momentum (potential for a reversal/buying opportunity).
  • Sell Votes: Displayed in Red, showing the strength of the upward momentum (potential for a reversal/selling opportunity).

By using this "voting" mechanism, the indicator aims to filter out weak signals and only highlight areas where there is significant historical agreement on the direction of the market's momentum.

Indicators Used
Relative strength index
7 Views
0 Downloads
0 Favorites
RSI-R2_voting_Ron3a
//+-----------------------------------+
//| RSI multi-period voting indicator | 
//+-----------------------------------+

#property copyright "Ron Thompson"
#property link      "http://www.ForexMT4.com/forex"

// This INDICATOR is NEVER to be SOLD individually 
// This INDICATOR is NEVER to be INCLUDED as part of a collection that is SOLD

#property indicator_chart_window
#property indicator_buffers 6


//---- input parameters
extern int    numvotes              =  20;
extern int    votecount             =   0;

extern int    Day1_Rsi_low          =  65;
extern int    Day1_Rsi_hi           =  35;

extern bool   ObjDelete             =  true;


int uniq=0;
int bartime;


//+------+
//| Init |
//+------+
int init()
  {
  }


//+------+
//|DeInit|
//+------+
int deinit()
  {
   if(ObjDelete)ObjectsDeleteAll();
  } 


//+------+
//|Start |
//+------+
int start()
  {

   // draw once at open of bar 
   if(bartime==Time[0]) return(0);
   bartime=Time[0];

   
   int     buy_vote;
   int     sell_vote;
   int     voting;
   
   double  RSI1=0;
   double  RSI2=0;
   double  RSI3=0;

   for (int i=Bars; i>=0; i--)
     {
      buy_vote=0;
      sell_vote=0;
      for(voting=numvotes+1; voting>=2; voting--)
        {
         RSI1 = iRSI(Symbol(), PERIOD_D1, voting, PRICE_OPEN, i-3);
         RSI2 = iRSI(Symbol(), PERIOD_D1, voting, PRICE_OPEN, i-2);
         RSI3 = iRSI(Symbol(), PERIOD_D1, voting, PRICE_OPEN, i-1);
         if (RSI1 < Day1_Rsi_low && RSI2 < RSI1 && RSI3 < RSI2 )
           {
            buy_vote++;
           }
         if (RSI1 > Day1_Rsi_hi && RSI2 > RSI1 && RSI3 > RSI2 )
           {
            sell_vote++;
           }
        }
  
      if (  buy_vote>votecount )
        {
         ObjectCreate("myx"+DoubleToStr(uniq,0), OBJ_TEXT, 0, Time[i], Open[i] );
         ObjectSetText("myx"+DoubleToStr(uniq,0),DoubleToStr(buy_vote,0),15,"Arial",White);
         uniq++;
        }

      if ( sell_vote>votecount )
        {
         ObjectCreate("myx"+DoubleToStr(uniq,0), OBJ_TEXT, 0, Time[i], Open[i] );
         ObjectSetText("myx"+DoubleToStr(uniq,0),DoubleToStr(sell_vote,0),15,"Arial",Red);
         uniq++;
        }


      
      
      }
  }

Comments