OPEN-SOURCE SCRIPT

Trim Rails Prox - ATR from SMA50

79
xATR from SMA50 – Trim Rails Pro V1

What it does
This tool plots “xATR rails” above (and optionally below) the Daily SMA50 using Daily ATR as the unit of distance. The classic use: identify “stretched” moves (e.g., +7×, +8× … +12× ATR above SMA50) where you systematically trim into strength. You also get optional intraday helpers (EMA10, SMA20) plus alerts when price crosses each xATR step.

Credit / lineage

Trim plan concept: inspired by the structured scaling/trim approach popularized by Steve Jacobs.

Signal engineering + automation: implemented by Master + Gemini with a share-based, stepwise trim engine and auto-reset logic.

How the rails work

The script computes xATR = (Close − Daily SMA50) / Daily ATR (all on daily data).

It then projects price rails at: SMA50 + (x × ATR) for x = 7, 8, 9, … 15 (you can restrict which ones render).

Optional short-side rails render at SMA50 − (x × ATR).

The Trim Plan (share-based & automatic)

Turn it on in Trim Plan (Steve Jacobs Style):

Original Position (shares) – how many shares you started with (e.g., 1000).

Trim % of Original at each step – percent of the original size to sell each time a level triggers (e.g., 20%).

Trim Levels (xATR above SMA50) – comma list of the rail steps to trim at (default: 7,8,9,10,11,12,15).

Auto-Reset when Daily Close < Daily SMA – when enabled, once daily close drops below the Daily SMA50, all trim flags reset so a new campaign can begin. (You can also toggle Manual Reset.)

Example (20% trims)

Original Position = 1000, Trim % = 20.

Each triggered level sells 200 shares (20% of 1000) regardless of remaining size.

After trims at 7×, 8×, 9× you will have sold 600 shares total; the Trim Panel will show Steps Done and Remain (sh) live.

On each trigger the script drops a label like:
TRIM 2/7 – Sell 200 sh @ $123.45

Tip: Change the list (e.g., 7,8,10,12,15) to widen or compress trims.

Key inputs

Start/End Trim Rail At – render only a window (e.g., 7→12) to reduce clutter.

Show 1–6× Minor Rails – quick visual context for smaller extensions.

Show Short-Side Rails (−N×) – for fading downside extensions.

Show Daily SMA50 / EMA10 / SMA20 – helper references (off by default for a cleaner view).

Alerts (prewired)

Cross 7x … Cross 12x – fires when xATR crosses each threshold upward.

Close < EMA10 / Close < SMA20 – caution exits on momentum cooling.

What’s on screen

Purple rails: major +xATR trim levels (and optional red −xATR rails).

Right-side label: next target rail, price, and distance (%).

Bottom-right Trim Panel: plan on/off, steps completed, and remaining shares.

Notes

Rails & trim logic use daily SMA/ATR for stability; they display on any timeframe.

If you change Original Position or Trim %, your future trims follow the new settings (past labels stay as history).

The plan is share-based (not cash). For option traders, treat “shares” as units and size your trims accordingly.

Happy scaling. Trim with discipline, let trends do the heavy lifting.

Wyłączenie odpowiedzialności

Informacje i publikacje przygotowane przez TradingView lub jego użytkowników, prezentowane na tej stronie, nie stanowią rekomendacji ani porad handlowych, inwestycyjnych i finansowych i nie powinny być w ten sposób traktowane ani wykorzystywane. Więcej informacji na ten temat znajdziesz w naszym Regulaminie.