//+------------------------------------------------------------------+ //| macdHelp.mq4 | //| | //| | //+------------------------------------------------------------------+ #property copyright "" #property link "" #property indicator_separate_window #property indicator_buffers 5 #property indicator_color1 Red #property indicator_color2 Red #property indicator_color3 Red #property indicator_color4 Red #property indicator_color5 Red //---- buffers double ExtMapBuffer0[]; double ExtMapBuffer1[]; double ExtMapBuffer2[]; double ExtMapBuffer3[]; double ExtMapBuffer4[]; extern int FastEMA=12; extern int SlowEMA=26; extern int SignalSMA=9; extern int BollingerPeriod=21; extern int BollingerDeviation=2; extern int BollingerShift=0; int i; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators SetIndexStyle(0,DRAW_LINE); SetIndexBuffer(0,ExtMapBuffer0); SetIndexStyle(1,DRAW_LINE); SetIndexBuffer(1,ExtMapBuffer1); SetIndexStyle(2,DRAW_LINE); SetIndexBuffer(2,ExtMapBuffer2); SetIndexStyle(3,DRAW_LINE); SetIndexBuffer(3,ExtMapBuffer3); SetIndexStyle(4,DRAW_LINE); SetIndexBuffer(4,ExtMapBuffer4); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int limit, counted_bars=IndicatorCounted(); if(counted_bars>0) counted_bars--; limit=Bars-counted_bars; for(i=0;i<limit;i++) { ExtMapBuffer0[i]=iOsMA(NULL,0,FastEMA,SlowEMA,SignalSMA,PRICE_CLOSE,i); ExtMapBuffer3[i]=iMA(NULL,0,FastEMA,0,MODE_EMA,PRICE_CLOSE,i)-iMA(NULL,0,SlowEMA,0,MODE_EMA,PRICE_CLOSE,i); } for(i=0;i<limit;i++) { ExtMapBuffer1[i]=iBandsOnArray(ExtMapBuffer0,Bars,BollingerPeriod,BollingerDeviation,BollingerShift,MODE_UPPER,i); ExtMapBuffer2[i]=iBandsOnArray(ExtMapBuffer0,Bars,BollingerPeriod,BollingerDeviation,BollingerShift,MODE_LOWER,i); ExtMapBuffer4[i]=iMAOnArray(ExtMapBuffer3,Bars,SignalSMA,0,MODE_SMA,i); } //---- return(0); } //+------------------------------------------------------------------+
Sample
Analysis
Market Information Used:
Indicator Curves created:
Implements a curve of type DRAW_LINE
Indicators Used:
Moving average indicator
Moving Average of Oscillator
Custom Indicators Used:
Order Management characteristics:
Other Features: