//+------------------------------------------------------------------+ //| 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