//+------------------------------------------------------------------+ //| Guppy MACD Bars.mq4 | //| Copyright © 2008, cjatradingtools.com | //| http://cjatradingtools.com/ | //+------------------------------------------------------------------+ #property copyright "Copyright © 2008, cja." #property link "http://cjatradingtools.com/" #property indicator_separate_window #property indicator_buffers 7 #property indicator_color6 Red #property indicator_color7 Blue #property indicator_width6 3 #property indicator_width7 3 #property indicator_maximum 1 #property indicator_minimum 0 //---- input parameters extern int FastEMA=8; extern int FFastEMA=7; extern int FFFastEMA=6; extern int SlowEMA=17; extern int SSlowEMA=16; extern int SSSlowEMA=15; extern int SignalSMA=9; extern int SSignalSMA=8; extern int SSSignalSMA=7; //---- buffers double ExtMapBuffer1[]; double ExtMapBuffer2[]; double ExtMapBuffer3[]; double ExtMapBuffer4[]; double ExtMapBuffer5[]; double ExtMapBuffer6[]; double ExtMapBuffer7[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators SetIndexStyle(0,DRAW_NONE); SetIndexBuffer(0,ExtMapBuffer1); SetIndexStyle(1,DRAW_NONE); SetIndexBuffer(1,ExtMapBuffer2); SetIndexStyle(2,DRAW_NONE); SetIndexBuffer(2,ExtMapBuffer3); SetIndexStyle(3,DRAW_NONE); SetIndexBuffer(3,ExtMapBuffer4); SetIndexStyle(4,DRAW_NONE); SetIndexBuffer(4,ExtMapBuffer5); SetIndexStyle(5,DRAW_HISTOGRAM); SetIndexBuffer(5,ExtMapBuffer6); SetIndexStyle(6,DRAW_HISTOGRAM); SetIndexBuffer(6,ExtMapBuffer7); SetIndexLabel(1,""); SetIndexLabel(2,""); SetIndexLabel(6,""); SetIndexLabel(5,""); IndicatorShortName("GMACD Bars"); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int counted_bars=IndicatorCounted(); //---- for(int i=Bars;i>=0;i--){ ExtMapBuffer2[i]=iMACD(NULL,0,FastEMA,SlowEMA,SignalSMA,PRICE_CLOSE,MODE_MAIN,i); ExtMapBuffer3[i]=iMACD(NULL,0,FastEMA,SlowEMA,SignalSMA,PRICE_CLOSE,MODE_SIGNAL,i); ExtMapBuffer4[i]=iMACD(NULL,0,FFastEMA,SSlowEMA,SSignalSMA,PRICE_CLOSE,MODE_MAIN,i); ExtMapBuffer5[i]=iMACD(NULL,0,FFastEMA,SSlowEMA,SSignalSMA,PRICE_CLOSE,MODE_SIGNAL,i); ExtMapBuffer6[i]=iMACD(NULL,0,FFFastEMA,SSSlowEMA,SSSignalSMA,PRICE_CLOSE,MODE_MAIN,i); ExtMapBuffer7[i]=iMACD(NULL,0,FFFastEMA,SSSlowEMA,SSSignalSMA,PRICE_CLOSE,MODE_SIGNAL,i); ExtMapBuffer7[i]=ExtMapBuffer2[i] > ExtMapBuffer3[i]; ExtMapBuffer6[i]=ExtMapBuffer2[i] < ExtMapBuffer3[i]; } } //---- return(0); //+------------------------------------------------------------------+
Sample
Analysis
Market Information Used:
Indicator Curves created:
Implements a curve of type DRAW_NONE
Implements a curve of type DRAW_HISTOGRAM
Indicators Used:
MACD Histogram
Custom Indicators Used:
Order Management characteristics:
Other Features: