Indicators Used
Miscellaneous
0
Views
0
Downloads
0
Favorites
ShashiRSI2Ind
//compile//
//+------------------------------------------------------------------+
//| EMA_58_Crossover_Alert.mq4 |
//| Copyright © 2006, Robert Hill |
//| |
//| Written Robert Hill for use with AIME for the EMA 5/8 cross to |
//| draw arrows and popup alert or send email |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, Robert Hill"
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 LawnGreen
#property indicator_color2 Red
#property indicator_width1 2
#property indicator_width2 2
double CrossUp[];
double CrossDown[];
double RSI1, RSI2, RSI3;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0, DRAW_ARROW, EMPTY);
SetIndexArrow(0, 233);
SetIndexBuffer(0, CrossUp);
SetIndexStyle(1, DRAW_ARROW, EMPTY);
SetIndexArrow(1, 234);
SetIndexBuffer(1, CrossDown);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start() {
int limit, i, counter;
double tmp=0;
double Range, AvgRange;
int counted_bars=IndicatorCounted();
//---- check for possible errors
if(counted_bars<0) return(-1);
//---- last counted bar will be recounted
if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;
for(i = 1; i <= limit; i++) {
counter=i;
Range=0;
AvgRange=0;
for (counter=i ;counter<=i+9;counter++)
{
AvgRange=AvgRange+MathAbs(High[counter]-Low[counter]);
}
Range=AvgRange/10;
RSI1=iRSI(Symbol(),0,2,PRICE_CLOSE,i);
RSI2=iRSI(Symbol(),0,2,PRICE_CLOSE,i+1);
RSI3=iRSI(Symbol(),0,2,PRICE_CLOSE,i+2);
CrossUp[i] = 0;
CrossDown[i] = 0;
if (RSI3<50 && RSI2<RSI3 && RSI1<RSI2)
{
CrossUp[i] = Low[i] - Range*0.75;
}
else if (RSI3>50 && RSI2>RSI3 && RSI1>RSI2)
{
CrossDown[i] = High[i] + Range*0.75;
}
}
return(0);
}
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
---