OPEN-SOURCE SCRIPT

Swing Ladder Trend Engine [Jayadev Rana]

405
OVERVIEW

Swing Ladder Trend Engine is a pure price-action trend-following tool. It builds its entire read of the market from confirmed swing highs and swing lows — no moving averages, no ATR, no oscillators. From that swing structure it derives three things: the current trend state, entry and exit signals, and a structure-anchored trailing stop (the "ladder") that only steps in the direction of the trade.

HOW IT WORKS

1. Swing structure. Confirmed pivot highs and lows (Swing Detection Length bars on each side) are classified as HH, HL, LH or LL and tagged on the chart.

2. Trend engine. When a bar closes beyond the most recent confirmed swing high, the trend state flips bullish; a close below the last confirmed swing low flips it bearish. Each swing level can only be broken once, so continuation breaks are tracked cleanly and bars are tinted by the active trend.

3. Ladder stop. Instead of a volatility trail, the stop is anchored to structure itself: in an uptrend it sits below the last confirmed swing low, offset by a configurable percentage of the current swing range, and it can only ratchet upward as new higher lows confirm. The result is a stepped "ladder" that gives the trade room where structure says it needs room, and tightens where structure tightens.

4. Pullback-quality entries. In the default Pullback mode a structure break only arms a setup. The entry itself requires the market to retrace into the breakout leg (between the Min and Max Retracement %), and then print a resumption candle: a close beyond the previous bar's extreme with a directional body of at least the Trigger Body Dominance fraction of its range. Retracements deeper than the maximum void the setup. A Breakout mode is included for traders who prefer to enter on the structure break itself.

SIGNALS: ENTRY, EXIT AND STOP

LONG / SHORT labels mark entries; the label tooltip stores the entry price and the ladder stop at that moment. A trade is closed either when price closes through the ladder stop or when the structure flips against it — the ✕ exit label's tooltip reports the reason and the approximate result in R (risk multiples, measured from entry to the initial ladder stop). All signals are evaluated on confirmed bars only.

DASHBOARD AND ALERTS

A compact dashboard shows the live trend state, the latest swing structure tags, the active signal, the current ladder stop level and the open trade's running R. Six alerts are available: long entry, short entry, exit long, exit short, and bullish/bearish trend flips.

SETTINGS

Swing Detection Length controls the size of the structure being tracked (larger = bigger swings, later confirmation). Entry Mode switches between Pullback and Breakout logic. Min/Max Retracement % and Trigger Body Dominance define what counts as a quality pullback entry. Stop Buffer sets how far beyond the protected swing the ladder sits, as a % of the current swing range. Dashboard position/size, structure labels, bar coloring and colors are all configurable.

LIMITATIONS

Swing points confirm only after the chosen number of right-side bars, so structure tags appear with a delay by design — this is what keeps the logic non-repainting on confirmed bars. Signals fire on bar close, not intrabar. Like any trend-following method, it gives back ground in choppy, range-bound conditions; the pullback filters reduce but do not remove that. R values shown in tooltips and the dashboard are approximations based on closing prices and do not account for gaps, fees or slippage. This is an analysis tool, not financial advice — always test settings on your own market and timeframe before relying on them.

WHY IT IS ORIGINAL

The combination of a swing-anchored ratcheting stop whose buffer adapts to the current swing range, plus an entry gate built from retracement depth and candle body dominance — all derived exclusively from raw price structure — is what this script contributes. It is not a mashup of built-in indicators; every state in the engine comes from the swing ladder itself.

כתב ויתור

המידע והפרסומים אינם מיועדים להיות, ואינם מהווים, ייעוץ או המלצה פיננסית, השקעתית, מסחרית או מכל סוג אחר המסופקת או מאושרת על ידי TradingView. קרא עוד ב־תנאי השימוש.