OPEN-SOURCE SCRIPT

Master Filter - Trend and Smart Money Zones

799
Overview
Master Filter combines a proprietary trend engine with the smart-money tools traders actually act on - EMA structure, Fair Value Gaps, Order Blocks and market-structure labels - in a single, clean overlay. Instead of stacking five separate indicators, you get one consistent read of where the trend is and where price is likely to react.

Everything is computed on the current chart timeframe and updates live as new bars form.

What's inside

1. The Master Filter © - trend & signals
A triple-smoothed price baseline (TEMA) is tracked against an adaptive average that follows the highs in an uptrend and the lows in a downtrend. An ATR-based channel (length 365 x multiplier, smoothed) acts as a confirmation filter that aims to suppress false flips during chop. When direction confirms, the script prints a LONG / SHORT marker on the bar. You can optionally plot the high / middle / low channel lines.

2. EMA suite + smoothed mirrors
EMA 100 / 200 / 300 / 365 for trend context, with a shaded zone between the 300 and 365 EMAs. Two optional "mirror" EMAs (a smoothed reflection of the 200 and 365) project the opposite side of price to frame mean-reversion zones.

3. Fair Value Gaps (current timeframe)
Three-bar imbalances are drawn as boxes with a dashed mid-line and tagged with the chart timeframe. Live gaps extend to the current bar and are removed automatically once price trades back through them (mitigation). A "max visible" cap keeps only the most recent gaps.

4. Order Blocks (current timeframe)
SMC-style order blocks are detected on structure breaks (price closing through the last swing high/low). The OB candle is selected within a bounded search window, with a volatility filter so an oversized, high-range bar isn't mistaken for the block. Each OB is drawn as a box plus dashed mid-line, kept per direction up to a configurable limit, and dropped on a strict break. A "max pivot age" setting skips stale blocks far from current price during strong trends.

5. Market structure - HH / HL / LH / LL
Swing pivots are labelled as Higher High / Higher Low / Lower High / Lower Low (teal for higher, orange for lower) so structure shifts are visible at a glance.

How to use
  • Read the trend from the LONG/SHORT markers and EMA stack; trade with it.
  • Use FVG and Order Block zones as areas to look for entries, partial exits or invalidation - not as automatic buy/sell signals.
  • Confirm with HH/HL/LH/LL: continuation favours trend-aligned zones; a structure break warns of a possible shift.


Settings
Grouped by section - Main trend (length, multiplier, channel filter, plot channel), Moving Average (EMA lengths, mirrors, smoothing), Fair Value Gaps (show, max visible, colours), Order Blocks (show, max per side, search/structure length, max pivot age, colours), and HH/HL/LH/LL (show, swing length, lookback).

Alerts
  • Change of the trend - fires when the Master Filter direction flips.


Notes
This indicator is a decision-support tool, not a signal-for-hire system. It does not place orders and past behaviour does not guarantee future results. Always combine it with your own risk management.

Feragatname

Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, alım satım veya diğer türden tavsiye veya öneriler anlamına gelmez ve teşkil etmez. Kullanım Koşulları bölümünde daha fazlasını okuyun.