Burger MACD
Download scriptThe Burger MACD is a specialized technical analysis tool designed to provide traders with a clearer view of market momentum by analyzing multiple timeframes simultaneously. Rather than looking at the current chart in isolation, this script interprets price action across different intervals—ranging from 1-minute fluctuations up to monthly trends—to help identify stronger underlying movements.
Core Logic and Functionality
Multi-Timeframe Analysis The primary innovation of this script is its ability to "bridge" different timeframes. It calculates the MACD (Moving Average Convergence Divergence) values based on a specific higher timeframe (such as Daily, Weekly, or 4-Hour) while displaying them on your current active chart. This allows you to see how the larger market trends are influencing the immediate price action you are watching.
Momentum Calculation The script utilizes three main components to determine market strength:
- Fast EMA: Tracks short-term price changes quickly.
- Slow EMA: Tracks longer-term price movements.
- Signal SMA: Acts as a smoothing line to filter out "noise" and identify the general direction of the trend.
The script compares these averages to determine if the market is gaining momentum (bullish) or losing it (bearish). To ensure the data remains visible and significant on your screen, the results are scaled by a factor of 10,000, making the fluctuations easier to interpret visually.
Visual Representation The tool translates these complex mathematical calculations into a clear visual histogram:
- Positive Momentum: When the current momentum is higher than the previous period, it identifies a positive trend (displayed in Blue).
- Negative Momentum: When the momentum drops below the previous period, it identifies a downward trend (displayed in Red).
How it Benefits the Trader
By synthesizing data from different timeframes into one visual indicator, the Burger MACD helps traders avoid "false signals" that often occur when looking at a single timeframe. It provides a broader context, helping you understand whether a price move is just a minor flicker or part of a larger, more significant trend governed by higher-level market cycles.
//+------------------------------------------------------------------+
//| 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);
}
Comments