OPEN-SOURCE SCRIPT

Scalp Lite + CHoCH

155
SCALP LITE + CHoCH

WHAT THIS IS

Two independent trade engines running on one chart, sharing a single dashboard.
One trades moving-average crosses with volatility-scaled risk. The other trades
breaks of market structure with structure-scaled risk. They are not blended into
a combined signal - they run side by side and are allowed to disagree, because
the disagreement is the most useful thing the script produces.


ENGINE 1 - SCALP LITE (EMA 9 / EMA 50)

The trigger is EMA9 crossing EMA50, filtered by any combination of VWAP side,
above-average volume, a trading session window, and a cooldown between signals.

The part worth explaining is the deferred cross, because it fixes a failure mode
that is easy to miss. A crossover is a single-bar event, and ta.crossover() never
fires again while the two averages stay on the same side of each other. A naive
implementation requires every filter to pass on that exact bar - so a cross that
happens premarket, on thin volume, or outside your session window is discarded
permanently, and the script shows nothing while price trends all day.

Here, a cross ARMS a direction instead of consuming it. The signal fires on the
first later bar where every enabled filter passes AND the averages still agree
with the armed direction. Nothing is bypassed; the filters simply no longer have
to pass simultaneously on one specific bar. An opposite cross overwrites the
pending direction, so a stale arm cannot survive a reversal. The dashboard shows
which filter is currently blocking an armed signal.

Levels are ATR multiples from the entry close: stop at 0.75 x ATR, TP1 at 1 x
ATR, TP2 at 2 x ATR, all adjustable. A separate warning fires when EMA9 crosses
the 20-period SMA against an open position, which flattens the signal state.


ENGINE 2 - CHoCH (CHANGE OF CHARACTER)

Swing highs and lows are located with pivots. The left-bar setting is a
significance filter and costs nothing; the right-bar setting is confirmation lag
and is the only real cost, since a swing is not confirmed until that many bars
have printed after it.

A structure break requires a CLOSE beyond the swing by a minimum ATR distance,
not merely a wick through it. That break arms the engine. With pullback mode on
(default), entry then waits for price to trade back to within a small ATR buffer
of the broken level and close back on the correct side of it - a retest, not a
chase. If that does not happen within a set number of bars, the arm expires
unused. Filters for EMA agreement, VWAP side, volume and session apply on top.

Risk is structural, not volatility-based. The stop goes just beyond the swing
that defined the structure, because that is where the trade thesis is actually
wrong. R is the distance from entry to that stop, and both targets are multiples
of R. Optional breakeven move after TP1.

Structure direction is held in a latch that survives until something changes it.
Two guards keep that latch honest: it resets to neutral the moment price closes
back through the level it broke - a break price has closed back inside is a
failed break, not structure - and the dashboard shows how many bars old the
surviving break is, greying out the agreement mark once it passes a staleness
threshold. Without those, a latch reads as confidently bullish an hour after the
break that set it has stopped mattering.


WHY THESE TWO TOGETHER

They fail in opposite conditions, and each one's failure is the other's normal
operating range.

A moving-average cross system is structurally late at turns and comfortable in
trends. A structure-break system is early at turns and gets cut up in range-bound
conditions. Running one of them tells you what it thinks. Running both tells you
whether the answer is worth much: when a late-but-reliable method and an
early-but-noisy method point the same way, that is a different situation from
either one agreeing with itself.

The second reason is risk framing. The two engines size stops on incompatible
principles - one steps back a fixed volatility multiple, the other steps behind
the structure. When those two stops land near each other, volatility and
structure agree and the setup is clean. When they are far apart, the structure
was built during a fast move and the trade genuinely needs a wider stop than a
scalp framework would suggest. You cannot see that from either engine alone, and
it is not something a combined signal could express - which is why they are kept
separate rather than merged.

The BIAS row is the product of that design. It is not a third signal; it is an
agreement meter with an age stamp on the structural half.


RUNNER MODE

By default, price tagging TP2 does not end the trade. The whole level set rolls
forward one leg: the stop ratchets up to the target just cleared, old TP2 becomes
the new TP1, and a fresh TP2 is set one full leg further out. This repeats for as
long as the move runs, so the levels stay near live price instead of sitting
behind it. A leg counter on the dashboard shows how many rolls have occurred.
The ratchet can follow the prior target, the fast EMA, an ATR trail, or be
disabled.


CONTEXT LAYERS

Fair value gaps (three-bar imbalances, drawn as zones, removed when filled),
opening range with breakout state, previous day high/low, daily pivots, confirmed
and pending trendlines, higher-timeframe trend on two timeframes, RSI on the
chart timeframe and a higher one, VWAP, and a 200 EMA.

Every forward-drawn line is redrawn each bar starting at the current candle and
projected a fixed distance right, rather than painted back across history. Scalp
Lite's levels are dashed and CHoCH's are solid so the two sets are never
confused when both engines are in a trade at once.


DASHBOARD

Twelve rows: agreement bias with structure age, each engine's state, entry, stop,
targets with leg counter, RSI on two timeframes, volume and ATR, higher-timeframe
trend, nearest unfilled gaps, opening range state, and warnings. Position is
adjustable to any of nine anchors, with text size and a compact single-column
mode for smaller panes.


HOW TO USE IT

Intraday timeframes; the defaults are tuned for 1 to 5 minute charts.

Read the BIAS row first. Both engines agreeing with a fresh structure break is
the highest-quality condition the script identifies. Disagreement is a reason to
size down or stand aside, not a signal to fade. Check the opening range row - an
INSIDE reading is the chop regime where structure breaks fail most often.

If CHoCH's targets look impractically far away, that is the structural stop
telling you the nearest confirmed swing is a long way from price. Reducing the
pivot left-bars finds nearer structure and shrinks R honestly. There is also an
optional cap on stop distance, off by default, which shrinks R by moving the stop
somewhere structure does not justify - it makes the chart tidier and the logic
worse, which is why it ships disabled.


BEHAVIOUR AND LIMITATIONS

Swings require confirmation bars before they are recognised, so structure appears
after the fact by design. This is inherent lag, not repainting: a confirmed swing
never moves afterwards.

Scalp Lite signals evaluate on bar close. CHoCH conditions evaluate on the
current bar and can therefore change state intrabar until that bar closes; treat
an intrabar CHoCH signal as provisional.

Alerts are provided for both engines' entries, the exit warning, opening range
breaks, and structure breaks.

This is a decision-support tool. It reports what price, structure, volatility and
participation are doing - it does not forecast, and neither the signals nor the
targets are predictions. Defaults are starting points, not recommendations, and
will need adjusting per instrument and timeframe. Position sizing and the
decision to take or skip any setup remain entirely with the user. Nothing here is
financial advice.

Wyłączenie odpowiedzialności

Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.