Indicators Used
Miscellaneous
0
Views
0
Downloads
0
Favorites
ytg_Def_RSI
//+------------------------------------------------------------------+
//| ytg_Def_RSI.mq4 |
//| Yuriy Tokman |
//| yuriytokman@gmail.com |
//+------------------------------------------------------------------+
#property copyright "Yuriy Tokman"
#property link "yuriytokman@gmail.com"
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Green
#property indicator_level1 0
extern int RSI_1_Period = 14;//ïåðèîä ïåðâîãî èíäèêàòîðà ÐÑÈ
extern int RSI_2_Period = 28;//ïåðèîä âòîðîãî èíäèêàòîðà ÐÑÈ
extern int applied_price = 0;//èñïîëüçóåìàÿ öåíà 0-6
extern int ma_period = 14;//ïåðèîä ñãëàæèâàíèÿ
extern int ma_method = 0;//ìåòîä ñãëàæèâàíèÿ 0-3
double buf[];
double MA_buf[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,2);
SetIndexBuffer(0, buf);
SetIndexStyle(1,DRAW_NONE);
SetIndexBuffer(1,MA_buf);
IndicatorShortName("ytg_Def_RSI");
Comment("yuriytokman@gmail.com");
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
Comment("");
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
//----
double RSI_1,RSI_2;
int limit;
int counted_bars=IndicatorCounted();
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;
for(int i=limit; i>=0; i--)
{
RSI_1 = iRSI(NULL,0,RSI_1_Period,applied_price,i);
RSI_2 = iRSI(NULL,0,RSI_2_Period,applied_price,i);
MA_buf[i] = (RSI_1-RSI_2);
}
for(i=limit; i>=0; i--)
{
buf[i] = iMAOnArray(MA_buf,0,ma_period,0,ma_method,i);
}
//----
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
---