OPEN-SOURCE SCRIPT

MTF Structure Vote [forexobroker]

247
MTF Structure Vote [forexobroker] polls three independent higher timeframes and lets each one cast a directional vote based on where price sits relative to its own structural trend EMA. When enough timeframes agree, a confluence regime is declared, and a precise local EMA reclaim then times the entry. The unique angle is treating multi-timeframe alignment as a discrete vote count rather than a single blended bias, which makes chop filtering explicit and tunable.

🔶 ALGORITHM

1. Three higher timeframes (default 60, 240, D) are read via request.security with barmerge.lookahead_off.
2. Each timeframe computes a trend EMA (default length 50) on its own closes. Close above the HTF EMA returns +1, below returns -1.
3. The three votes are summed into a net vote ranging from -3 to +3.
4. A local reclaim EMA (default 9) is computed on the chart timeframe to time entries.
5. Bull confluence is declared when net vote is greater than or equal to the threshold; bear confluence when it is less than or equal to the negative threshold.
6. ATR (default 14) is tracked for context in the dashboard.
7. Each signal flips a persistent position state and stamps the bar so the cooldown can enforce spacing.

🔶 SIGNAL LOGIC

- Buy: net vote reaches the bull confluence threshold AND local close crosses over the reclaim EMA AND session filter passes AND position is not already long AND cooldown bars elapsed since last signal AND barstate.isconfirmed.
- Sell: net vote reaches the bear confluence threshold AND local close crosses under the reclaim EMA AND session filter passes AND position is not already short AND cooldown bars elapsed since last signal AND barstate.isconfirmed.

Only fires when the multi-timeframe net vote has reached the configured confluence threshold.

🔶 INPUTS

- MTF group: three higher-timeframe selectors; HTF 1 default 60.
- HTF Trend EMA: length of the structural EMA computed on each higher timeframe; default 50.
- Local Reclaim EMA: chart-timeframe EMA used to time entries; default 9.
- Signal Logic group: minimum absolute net vote required; default 2 (at least 2 of 3 agree).
- ATR Length: volatility reference shown in the dashboard; default 14.
- Cooldown Bars: minimum bars between signals; default 5.
- Filters group: optional session restriction; session window default 0000-2400.
- Visual group: dashboard, 3-layer glow, local EMA plot, buy/sell colors, dashboard background; glow on by default.

🔶 ALERTS

MSV Buy, MSV Sell, MSV Any Signal, MSV Bull Conf, MSV Bear Conf, MSV Unanimous Bull, MSV Unanimous Bear, MSV Vote Change, MSV Local Up, MSV Local Down, MSV Any Conf, MSV Webhook JSON.

🔶 LIMITATIONS

- The higher-timeframe EMAs need warm-up history; on fresh symbols early bars carry no reliable vote.
- request.security on higher timeframes is read with lookahead_off on the confirmed bar, so values are non-repainting but update only when the HTF bar closes, introducing natural lag.
- Defaults are tuned for liquid instruments; thin symbols may need wider thresholds or different timeframes.
- Confluence gating intentionally suppresses signals during mixed regimes, so trending-only behavior is expected.
- The local reclaim is a fast EMA cross and can whipsaw inside a valid confluence regime during low volatility.

إخلاء المسؤولية

لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.