//+------------------------------------------------------------------+ //| Burger MACD.mq4 | //| BurgerKing | //+------------------------------------------------------------------+ //---- indicator settings #property indicator_separate_window #property indicator_buffers 2 #property indicator_color1 Blue #property indicator_color2 Red #property indicator_width1 1 #property indicator_width2 1 //#property indicator_level1 +45 //#property indicator_level2 +30 //#property indicator_level3 +15 //#property indicator_level4 0 //#property indicator_level5 -15 //#property indicator_level6 -30 //#property indicator_level7 -45 //---- indicator parameters extern int FastEMA = 12; extern int SlowEMA = 26; extern int SignalSMA = 9; extern string comment = "Period: MN,W1,D1,H4,H1,M30,M15,M5,M1"; extern string PERIOD = "D1"; //---- indicator buffers double MACDPos[],MACDNeg[]; int ThisPeriod; int Ratio; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { string name; SetIndexStyle(0,DRAW_HISTOGRAM); SetIndexBuffer(0,MACDPos); SetIndexLabel(0,"MACDPos"); SetIndexStyle(1,DRAW_HISTOGRAM); SetIndexBuffer(1,MACDNeg); SetIndexLabel(1,"MACDNeg"); ThisPeriod = Period(); if (PERIOD == "MN") { ThisPeriod = PERIOD_MN1; name = "Burger MN1"; } if (PERIOD == "W1") { ThisPeriod = PERIOD_W1; name = "Burger W1"; } if (PERIOD == "D1") { ThisPeriod = PERIOD_D1; name = "Burger D1"; } if (PERIOD == "H4") { ThisPeriod = PERIOD_H4; name = "Burger H4"; } if (PERIOD == "H1") { ThisPeriod = PERIOD_H1; name = "Burger H1"; } if (PERIOD == "M30") { ThisPeriod = PERIOD_M30; name = "Burger M30"; } if (PERIOD == "M15") { ThisPeriod = PERIOD_M15; name = "Burger M15"; } if (PERIOD == "M5") { ThisPeriod = PERIOD_M5; name = "Burger M5"; } if (PERIOD == "M1") { ThisPeriod = PERIOD_M1; name = "Burger M1"; } if (Period() > ThisPeriod) { ThisPeriod = Period(); name = "Burger "; } Ratio = ThisPeriod / Period(); IndicatorDigits(0); IndicatorShortName(name + " MACD ("+FastEMA+","+SlowEMA+","+SignalSMA+")"); return(0); } int deinit() { ObjectsDeleteAll(0); Comment(""); return(0); } //+------------------------------------------------------------------+ //| Moving Averages Convergence/Divergence | //+------------------------------------------------------------------+ double MACD_0,MACD_1,MACD_2; int MACDtime, x, counted_bars; int start() { counted_bars=IndicatorCounted(); if(counted_bars>0) counted_bars--; for (int i=Bars-counted_bars; i>=0; i--) { MACDtime = iTime(Symbol(),0,i); x = iBarShift(Symbol(),ThisPeriod,MACDtime,false); MACD_0 = 10000 * iMACD(Symbol(),ThisPeriod,FastEMA,SlowEMA,SignalSMA,PRICE_CLOSE,MODE_MAIN,x); MACD_1 = 10000 * iMACD(Symbol(),ThisPeriod,FastEMA,SlowEMA,SignalSMA,PRICE_CLOSE,MODE_MAIN,x+1); MACD_2 = 10000 * iMACD(Symbol(),ThisPeriod,FastEMA,SlowEMA,SignalSMA,PRICE_CLOSE,MODE_MAIN,x+2); MACDtime = iTime(Symbol(),ThisPeriod,x+1); if (ObjectFind("BurgerMACD"+MACDtime) != 0) { if (MACD_1 > MACD_2) { //BULL } else if (MACD_2 < MACD_1) { //BEAR } } if (MACD_0 > MACD_1) { MACDPos[i] = MACD_0; MACDNeg[i] = 0; } else { MACDPos[i] = 0; MACDNeg[i] = MACD_0; } } return(0); } //+------------------------------------------------------------------+ void DrawArrow (string text, int time, double y, color Color) { string name = "BurgerMACD"+time; ObjectDelete(name); ObjectCreate(name, OBJ_TEXT, 0, time, y); ObjectSetText(name, text, 20, "Wingdings", EMPTY); ObjectSet(name, OBJPROP_COLOR, Color); }
Sample
image not available
Analysis
Market Information Used:
Indicator Curves created:
Implements a curve of type DRAW_HISTOGRAM
Indicators Used:
MACD Histogram
Custom Indicators Used:
Order Management characteristics:
Other Features: