Indicators Used
0
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
Markdown Formatting Guide
# H1
## H2
### H3
**bold text**
*italicized text*
[title](https://www.example.com)

`code`
```
code block
```
> blockquote
- Item 1
- Item 2
1. First item
2. Second item
---