The single biggest problem with short-timeframe trading signals is false entries. RSI dips to 35 on a 5-minute chart, MACD histogram starts rising, EMA 20 is above EMA 50 — everything looks like a BUY setup. But on the 4-hour chart, the asset is in a clear downtrend: lower highs, lower lows, price well below EMA 50.
You enter long. The macro sellers overwhelm your short-term buyer signal. The price drops another 2%.
Multi-Timeframe (MTF) confluence is the solution to this problem.
The architecture
The analysis engine accepts two datasets: liveCandles (the selected short-term timeframe) and macroCandles (a 4H candle dataset fetched separately). For each analysis run, we calculate the 4H EMA 50 and compare the last 4H close against it:
const macroCloses = macroCandles.map(c => c.close); const macroEMA50Arr = calculateEMAArray(macroCloses, 50); const lastMacroClose = macroCloses[macroCloses.length - 1]; const lastMacroEMA50 = macroEMA50Arr[macroEMA50Arr.length - 1]; macroTrend = lastMacroClose > lastMacroEMA50 ? "BULLISH" : "BEARISH";
The confluence rules
Four outcomes are possible:
- Macro BULLISH + short-term BUY signal: Confidence +5%. Reasoning includes "MTF Confluence: Macro 4H trend is bullish, aligning with BUY signal."
- Macro BULLISH + short-term SELL signal: Signal overridden to NO TRADE. Confidence set to 45%. Reasoning shows "MTF Confluence: Counter-trend SELL signal blocked by macro 4H trend."
- Macro BEARISH + short-term SELL signal: Confidence +5%. Aligned with macro direction.
- Macro BEARISH + short-term BUY signal: Signal overridden to NO TRADE.
Why EMA 50 on 4H specifically?
The 4H EMA 50 represents approximately 200 hours of price history — roughly 8 days of continuous trading. On this timeframe, the EMA 50 smooths out daily noise while remaining responsive enough to capture genuine trend shifts. It's one of the most widely watched levels by institutional traders using swing-trading frameworks, making it a high-confluence level for the macro filter.
The result in practice: significantly fewer false entries, and higher-quality signals on the trades that do pass the filter.
---
