RSI-R2_voting_Ron3ax





//+-----------------------------------+
//| 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++;
        }


      
      
      }
  }





Sample





Analysis



Market Information Used:

Series array that contains open time of each bar
Series array that contains open prices of each bar


Indicator Curves created:


Indicators Used:

Relative strength index


Custom Indicators Used:

Order Management characteristics:

Other Features: