Price Data Components
Indicators Used
Miscellaneous
0
Views
0
Downloads
0
Favorites
dex_2Trales_V1
//+------------------------------------------------------------------+
//| dex_2TralesV1.mq4 |
//| Copyright © 2007, akadex. |
//| tohell |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2007, akadex"
#property link "tohell"
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 DeepSkyBlue //up
#property indicator_color2 Red //down
extern int PerDev=12;
extern bool StdDev_Atr=true;
extern int CountBars=3000;
double ExtMapBuffer1[]; // up
double ExtMapBuffer2[]; // down
double Amp[],AmpTemp[],D,D1,D5,D10,D20,Dev,Dev1;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
//----
IndicatorBuffers(4);
//---- drawing settings
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexStyle(0,0,0,1);
SetIndexLabel(0,"Up");
SetIndexBuffer(1,ExtMapBuffer2);
SetIndexStyle(1,0,0,1);
SetIndexLabel(1,"Down");
SetIndexBuffer(2,Amp);
SetIndexStyle(2,DRAW_NONE);
SetIndexBuffer(3,AmpTemp);
SetIndexStyle(3,DRAW_NONE);
return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//---- TODO: add your code here
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
if (CountBars>Bars) CountBars=Bars;
SetIndexDrawBegin(0,Bars-CountBars);
SetIndexDrawBegin(1,Bars-CountBars);
int i;
int counted_bars=IndicatorCounted();
i=CountBars-1;
int loopbegin = Bars-1;
for(i = loopbegin; i >= 0; i--)
{
if (TimeHour(Time[i])==1 && TimeMinute(Time[i])==00) {
D1=(iHigh(NULL,PERIOD_D1,1)-iLow(NULL,PERIOD_D1,1));
D5=(iHigh(NULL,PERIOD_D1,5)-iLow(NULL,PERIOD_D1,5));
D10=(iHigh(NULL,PERIOD_D1,10)-iLow(NULL,PERIOD_D1,10));
D20=(iHigh(NULL,PERIOD_D1,20)-iLow(NULL,PERIOD_D1,20));
D=(D1+D5+D10+D20)/4;
ExtMapBuffer1[i]=Close[i]+(D/2);
ExtMapBuffer2[i]=Close[i]-(D/2);
}
else
{
if (StdDev_Atr){
Dev=iStdDev(NULL,0,PerDev,MODE_EMA,0,PRICE_CLOSE,i);
Dev1=iStdDev(NULL,0,PerDev,MODE_EMA,0,PRICE_CLOSE,i+1);
} else {
Dev=iATR(NULL,0,PerDev,i);
Dev1=iATR(NULL,0,PerDev,i+1);
}
if (High[i]<High[i+1] && Low[i]<Low[i+1] && Dev>Dev1) {ExtMapBuffer1[i]=ExtMapBuffer1[i+1]-((High[i+1]-High[i]));}
else {ExtMapBuffer1[i]=ExtMapBuffer1[i+1];}
if (Low[i]>Low[i+1] && High[i]>High[i+1] && Dev>Dev1) {ExtMapBuffer2[i]=ExtMapBuffer2[i+1]+((Low[i]-Low[i+1]));}
else {ExtMapBuffer2[i]=ExtMapBuffer2[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
---