Indicators Used
Miscellaneous
0
Views
0
Downloads
0
Favorites
Accumulation2MA_v03
//+------------------------------------------------------------------+
//| 2MA from A/D Accumulation2MA.mq4 |
//| Copyright © 2006, lukas1 |
//| http://www.alpari-idc.ru/ |
//| v.03
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, lukas1"
#property link "http://www.alpari-idc.ru/"
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 LightSeaGreen
#property indicator_color2 Red
//---- buffers
extern int FMA=3;
extern int SMA=10;
double ExtMapBuffer1[];
double SignalBuffer1[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
IndicatorShortName("Difference 2MA fast="+FMA+", slow="+SMA+" from A/D");
//---- indicators
SetIndexStyle(0,DRAW_NONE);
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexStyle(1,DRAW_LINE,0,2);
SetIndexBuffer(1,SignalBuffer1);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Accumulation/Distribution |
//+------------------------------------------------------------------+
int start()
{
int i,limit,counted_bars=IndicatorCounted();
limit=(Bars-counted_bars);
//----
i=Bars-counted_bars-1;
while(i>=0)
{
double high =High[i];
double low =Low[i];
double open =Open[i];
double close=Close[i];
ExtMapBuffer1[i]=(close-low)-(high-close); //2close+high-low
if(ExtMapBuffer1[i]!=0)
{
double diff=high-low;
if(0==diff)
ExtMapBuffer1[i]=0;
else
{
ExtMapBuffer1[i]/=diff;
ExtMapBuffer1[i]*=Volume[i];
}
}
if(i<Bars-1) ExtMapBuffer1[i]+=ExtMapBuffer1[i+1];
i--;
}
for(i=0; i<limit; i++)
SignalBuffer1[i]=iMAOnArray(ExtMapBuffer1,Bars,FMA,0,MODE_SMA,i)*20
-iMAOnArray(ExtMapBuffer1,Bars,SMA,0,MODE_SMA,i)*20;
//----
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
---