OPEN-SOURCE SCRIPT

Master Line Lite: 5-MA Consensus

2 419
Master Line Lite condenses five different moving-average families into a single, easy-to-read consensus trend line, then filters its direction with a volatility-aware band so the trend only changes when price commits. It's a clean, open-source alternative to stacking several moving averages on one chart.

How it works

Each moving-average type reacts to price differently. An EMA and a WMA weight recent bars heavily and turn quickly; an SMA weights every bar equally and turns slowly; an RMA (Wilder's) is the smoothest; and an HMA cuts lag while staying responsive. Any single one is a compromise — fast types whipsaw in chop, slow types lag at turns.

Master Line Lite computes all five over the same length and averages them into one line:

consensus = ( EMA + SMA + WMA + HMA + RMA ) / 5

Blending the five balances their individual biases: the fast members keep the line responsive while the slow members damp noise. That's the purpose of the combination — not to stack indicators, but to average out the weakness of each MA type into one steadier reference than a single fast MA, yet more responsive than a single slow one.

Direction is then decided with an ATR band instead of a raw cross. The trend turns bullish only when price closes above the line by more than Flip band × ATR, and bearish only when it closes the same distance below; between those thresholds the previous trend is held. This deadband is what suppresses the constant flip-flopping of a plain price/MA cross during sideways markets.

The line is colored by the current trend, an optional band shows the flip thresholds, and triangles mark the exact bar where the trend flips.

How to use it

Use the line as a trend reference and bias filter — favor longs while it's teal, shorts while it's red.
The triangles flag where the consensus trend changes — a "context has shifted" cue, not a standalone entry.
Widen the Flip band on noisy/ranging instruments to cut false flips; narrow it on clean trends for earlier turns.
Increase Length for a slower higher-timeframe bias; decrease it for a faster intraday read.
Two built-in alerts fire on bullish and bearish flips.

Settings

Source — price series the averages are built from (default: close).
Length — lookback used for all five moving averages.
Flip band (× ATR) — how far price must clear the line to change the trend; the core noise filter.
Show band — draw the upper/lower flip thresholds.
Color bars by trend — tint candles with the trend color.
Show status box — small top-right label with the current Bull / Bear / Flat state.

Notes and limitations

Like all moving-average methods, this lags at turning points and can flip late after sharp reversals — the ATR band trades some timing for fewer false signals. Values can update on the still-forming real-time bar until it closes. It does not predict price and makes no performance claims; use it as one input alongside your own analysis and risk management.

For research and education only. This is not financial advice.

คำจำกัดสิทธิ์ความรับผิดชอบ

ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน