PROTECTED SOURCE SCRIPT

ATR-EMA Trend: EarlyTurn + Adaptive

44
v.9
Purpose:
Trend-following tool that times long entries on EMA crosses, filters them by trend quality, scales out on weakness, and exits with a volatility-aware trailing stop. It also tags PVRSA “M” pivot highs and shows a compact info panel.
How it works
Entries
Signals: “Low Confidence Buy” (EMA10 > EMA20 cross) and “Big Buy” (EMA10 > EMA50 cross).
Trend filter: Entries are gated by the EMA50 angle (in degrees). You can:
Require a minimum angle (up-slope),
Optionally smooth the angle with linear regression,
Add HTF confirmation (EMA50 rising on a higher timeframe).
Early-Turn Override: Lets one early “probe” long through before the EMA50 angle turns positive—only if the angle is improving and a chosen price rule is true (options: EMA20>EMA50, Close>EMA50, Close>EMA20&EMA20>EMA50, or Close>EMA20).
Profit-taking
Tracks the highest confirmed pivot high since entry (classic pivothigh) as a TP level.
Take profit:
Immediately on pivot confirmation (optional), or
On a close cross above that level (default), or
On wick touch (optional).
Option to fire once per pivot.
Stops & Trailing
Dynamic ATR stop (Chandelier High): highest high since entry – ATR×mult.
Adaptive multiplier (ADX-based): when trend is strong (ADX ≥ threshold), use a larger ATR multiple; in chop, use a smaller one. (ADX is calculated internally; no ta.adx() dependency.)
Fixed ATR stop (optional): entry – ATR×mult.
EMA30 trail exit (optional, “soft” exit).
Scale-outs
30% scale-out: Close below EMA10 with high volume.
50% scale-out: Close below EMA50, bearish candle, high volume.
PVRSA “M” Pivot High
Flags a confirmed M pivot high when: new local high, high volume, and a bearish candle.
Visuals & Panel
Dotted EMA10/20/30/50, ATR bands around EMA20, optional Volume MA, optional classic pivot-high shape.
Info table shows EMAs, ATR, base multiplier, ATR×mult, bands, EMA50 angle, ADX, active dynamic ATR multiplier, and Early-Turn status.
Alerts
Buy signals, both scale-outs, take profit, PVRSA pivot, fixed stop, dynamic stop, and EMA30 trail exit.
Tips & presets
To reduce noise on small timeframes: increase Min EMA50 Angle to ~0.5–1.0°, set Angle Lookback to 8–13, enable Regression Angle if still choppy.
To catch early turns: keep Early-Turn ON with Max Negative Angle 1.5–3.0°, Improving Lookback 3–5, and a permissive price rule like Close>EMA20.
For trend runs: leave Adaptive Dyn Mult ON with defaults (Strong=2.6, Weak=1.8, ADX Len=14, Thresh=22).

Aviso legal

As informações e publicações não devem ser e não constituem conselhos ou recomendações financeiras, de investimento, de negociação ou de qualquer outro tipo, fornecidas ou endossadas pela TradingView. Leia mais em Termos de uso.