Indicators Used
Miscellaneous
0
Views
0
Downloads
0
Favorites
macdik
//+------------------------------------------------------------------+
//| macdik.mq4 |
//| Copyright (C) 2010 Vikon |
//| |
//+------------------------------------------------------------------+
#property copyright "macdik"
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Yellow
#property indicator_color2 Red
//---- input parameters
//---- buffers
double b[],s[];
string d;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexBuffer(0,b);
SetIndexStyle(0,DRAW_HISTOGRAM,0,4);
SetIndexBuffer(1,s);
SetIndexStyle(1,DRAW_LINE,0,1);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
ObjectDelete("ADX");
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
//int i=Bars;
double b0,b1,b2,i1,i2,s0,s1,s2;
int counted_bars=IndicatorCounted();
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
int limit=Bars-counted_bars;
if(counted_bars==0) limit-=1+2;
int i=limit;
while(i>=0)
{
i1=i+1;
i2=i+2;
b0=iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_MAIN,i);
b1=iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_MAIN,i1);
b2=iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_MAIN,i2);
s0=iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_SIGNAL,i);
s[i]=(b0-s0)*10000;
b[i]=((b1-b2)-(b1-b0))*10000;
//(((b1-s1)-(b2-s2))-((b1-s1)-(b0-s0)))*10000;
i--;
}
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
---