Indicators Used
Miscellaneous
0
Views
0
Downloads
0
Favorites
Adaptive RSI
//+------------------------------------------------------------------+
//| ARSI.mq4
//+------------------------------------------------------------------+
#property copyright "Alexander Kirilyuk M."
#property link ""
#property indicator_separate_window
//#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 DodgerBlue
#property indicator_color2 LimeGreen
#property indicator_color3 Red
extern int ARSIPeriod = 14;
//---- buffers
double ARSI[];
double adrsiup[];
double adrsidn[];
int init()
{
string short_name = "ARSI (" + ARSIPeriod + ")";
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,ARSI);
//SetIndexDrawBegin(0,ARSIPeriod);
return(0);
}
int start()
{
int i, counted_bars = IndicatorCounted();
int limit;
if(Bars <= ARSIPeriod)
return(0);
if(counted_bars < 0)
{
return;
}
if(counted_bars == 0)
{
limit = Bars;
}
if(counted_bars > 0)
{
limit = Bars - counted_bars;
}
double sc;
for(i = limit; i >= 0; i--)
{
sc = MathAbs(iRSI(NULL, 0, ARSIPeriod, PRICE_CLOSE, i)/100.0 - 0.5) * 2.0;
if( Bars - i <= ARSIPeriod)
ARSI[i] = Close[i];
else
ARSI[i] = ARSI[i+1] + sc * (Close[i] - ARSI[i+1]);
}
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
---