Indicators Used
Miscellaneous
0
Views
0
Downloads
0
Favorites
dex_SCALP
//+------------------------------------------------------------------+
//| dex_SCALP.mq4 |
//| Copyright © 2004, akadex. |
//| tohell |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2004, akadex"
#property link "tohell"
#property indicator_buffers 2
#property indicator_color1 SteelBlue
#property indicator_color2 White
#property indicator_separate_window
extern int aPeriod = 5;//EUR 5
extern int bPeriod = 15;//EUR 15
extern double K = 1.0;//EUR 1.0
double RSIBuf[],UpZone[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_SOLID,3);
SetIndexStyle(1,DRAW_LINE);
SetIndexBuffer(0,RSIBuf);
SetIndexBuffer(1,UpZone);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
double MA, RSI[];
ArrayResize(RSI,bPeriod);
int counted_bars=IndicatorCounted();
int limit = Bars-counted_bars-1;
for(int i=limit; i>=0; i--)
{
RSIBuf[i] = iStdDev(NULL,0,aPeriod,MODE_EMA,0,PRICE_MEDIAN,i);
MA = 0;
for(int j=i; j<i+bPeriod; j++) {
RSI[j-i] = RSIBuf[j];
MA += RSIBuf[j]/bPeriod;
}
UpZone[i] = MA + (K * StDev(RSI,bPeriod));
}
//----
return(0);
}
double StDev(double& Data[], int Per)
{
return(MathSqrt(Variance(Data,Per)));
}
double Variance(double& Data[], int Per)
{
double sum, ssum;
for (int i=0; i<Per; i++)
{
sum += Data[i];
ssum += MathPow(Data[i],2);
}
return((ssum*Per - sum*sum)/(Per*(Per-1)));
}
//+------------------------------------------------------------------+
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
---