//+---------------------------------------------------------+ //| MACD график.mq4 | //| Copyright © 2007, amds | //| Задача всякого разумного человека заключается в том, | //| чтобы смотреть в лицо фактам, а не в рожу галлюцинациям | //+---------------------------------------------------------+ #property copyright "amds" #property link "" //---- #property indicator_chart_window #property indicator_buffers 5 //---- style #property indicator_color1 Blue #property indicator_color2 LightGray #property indicator_color3 RoyalBlue #property indicator_color4 FireBrick #property indicator_color5 Red #property indicator_style5 2 #property indicator_width2 1 #property indicator_width3 1 #property indicator_width4 1 //---- parameters extern bool showMACD = true; extern bool showCandle = true; extern int fastMA = 12; extern int slowMA = 26; extern int signal = 9; extern int method_MA = 1; extern int price_MA = 0; extern int TF = 0; //---- buffers double Fast[],Slow[],Signal[],Up[],Dn[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { IndicatorBuffers(5); IndicatorDigits(Digits); IndicatorShortName("MACD график"); if(showMACD==true) { SetIndexBuffer(0,Fast); SetIndexStyle(0,DRAW_LINE); SetIndexLabel(0,"EMA1"); SetIndexBuffer(1,Slow); SetIndexStyle(1,DRAW_LINE); SetIndexLabel(1,"EMA2"); SetIndexBuffer(4,Signal); SetIndexStyle(4,DRAW_LINE); SetIndexLabel(4,"Signal"); SetIndexDrawBegin(4,slowMA); } else { SetIndexBuffer(0,Fast); SetIndexStyle(0,DRAW_NONE); SetIndexLabel(0,NULL); SetIndexBuffer(1,Slow); SetIndexStyle(1,DRAW_NONE); SetIndexLabel(1,NULL); SetIndexBuffer(4,Signal); SetIndexStyle(4,DRAW_NONE); SetIndexLabel(4,NULL); SetIndexDrawBegin(4,slowMA); } if(showCandle==true) { SetIndexBuffer(2,Up); SetIndexStyle(2,DRAW_HISTOGRAM); SetIndexLabel(2,NULL); SetIndexDrawBegin(2,slowMA); SetIndexBuffer(3,Dn); SetIndexStyle(3,DRAW_HISTOGRAM); SetIndexLabel(3,NULL); SetIndexDrawBegin(3,slowMA); } else { SetIndexBuffer(2,Up); SetIndexStyle(2,DRAW_NONE); SetIndexLabel(2,NULL); SetIndexDrawBegin(2,slowMA); SetIndexBuffer(3,Dn); SetIndexStyle(3,DRAW_NONE); SetIndexLabel(3,NULL); SetIndexDrawBegin(3,slowMA); } return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { return(0); } //+------------------------------------------------------------------+ //| MACD график | //+------------------------------------------------------------------+ int start() { int counted_bars=IndicatorCounted(),limit,N; if(counted_bars>0) counted_bars--; limit=Bars-counted_bars; if(counted_bars==0) limit-=2; if(TF<=Period()) TF=Period(); N=TF/Period(); //====== первый цикл for определение средних ======|| for(int i=0; iSignal[i+1] && Signal[i]>Signal[i+2] && Signal[i+1]>Signal[i+2]) { Dn[i] = Low [i]; Up[i] = High[i]; } else {Up[i]=EMPTY_VALUE; Dn[i]=EMPTY_VALUE;} //---- return(0); } //+------------------------------------------------------------------+