Indicators Used
Miscellaneous
3
Views
0
Downloads
0
Favorites
CMx
//+------------------------------------------------------------------+
//| CMx.mq4 |
//| Copyright © 2004, MetaQuotes Software Corp. |
//| http://www.metaquotes.net/ |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2004, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net/"
//---- indicator settings
#property indicator_separate_window
#property indicator_minimum -500
#property indicator_maximum 500
#property indicator_buffers 1
#property indicator_color1 Blue
//---- input parameters
extern int F=12;
extern double k=1.682;
extern double L_adx=18;
//---- indicator buffers
double MaBuffer[];
double XBuffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
IndicatorBuffers(2);
SetIndexStyle(0,DRAW_LINE,EMPTY,2);
SetIndexDrawBegin(0,F);
IndicatorDigits(Digits+1);
SetIndexBuffer(0,XBuffer);
SetIndexBuffer(1,MaBuffer);
IndicatorShortName("CMx("+(string)F+","+(string)k+","+(string)L_adx+")");
SetIndexLabel(0,"X");
SetLevelValue(0,61.8);
SetLevelValue(1,-61.8);
SetLevelValue(2,161.8);
SetLevelValue(3,-161.8);
SetLevelValue(4,261.8);
SetLevelValue(5,-261.8);
SetLevelValue(6,423.6);
SetLevelValue(7,-423.6);
SetLevelStyle(STYLE_DOT,1,White);
return(0);
}
//+------------------------------------------------------------------+
//| CMx |
//+------------------------------------------------------------------+
int start()
{
int limit;
int counted_bars=IndicatorCounted();
if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;
for(int i=0; i<limit; i++)
MaBuffer[i]=iMA(NULL,0,F,0,MODE_EMA,PRICE_CLOSE,i)-iMA(NULL,0,(int)MathRound(F*k),0,MODE_EMA,PRICE_CLOSE,i);
for(i=0; i<limit; i++)
XBuffer[i]=(iCCIOnArray(MaBuffer,0,(int)MathRound(F*k),i)*iADX(NULL,0,F,PRICE_CLOSE,MODE_MAIN,i))/(L_adx*k);
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
---