Indicators Used
0
Views
0
Downloads
0
Favorites
MAadaptive (rsi)
//+------------------------------------------------------------------+
//| MAadaptive (rsi).mq4 |
//| |
//| based on MA adaptive RSI by Perry Kaufman |
//+------------------------------------------------------------------+
#property copyright "copyleft mladen"
#property link "mladenfx@gmail.com"
#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Red
//
//
//
//
//
extern int MA.period = 20;
extern int MA.price = PRICE_CLOSE;
//
//
//
//
//
double buffer[];
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
//
//
//
//
//
int init()
{
SetIndexBuffer(0,buffer);
return(0);
}
int deinit() { return(0); }
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
//
//
//
//
//
int start()
{
int countedBars=IndicatorCounted();
int i,limit;
if (countedBars<0) return(-1);
if (countedBars>0) countedBars--;
limit = Bars-countedBars;
//
//
//
//
//
for(i = limit; i >=0; i--)
{
double price = iMA(NULL,0,1,0,MODE_SMA,MA.price,i);
if (i>Bars-MA.period)
{
buffer[i]=price; continue;
}
//
//
//
//
//
double sc = 2.0*MathAbs(iRSI(NULL,0,MA.period,MA.price,i)/100.0-0.5);
buffer[i] = buffer[i+1] +sc*(price-buffer[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
---