PROTECTED SOURCE SCRIPT
Dual ATR Trailing Stop with Buy/Sell Signals

This indicator applies two ATR-based trailing stops (Fast and Slow) together with a four-state market classifier to visualize trend strength and place crossover Buy/Sell markers. It is a trend-following tool and does not predict future prices. Use it alongside independent analysis and risk management.
How it works
The Fast trail uses ATR with period 5 and multiplier 0.5 by default. The Slow trail uses ATR with period 10 and multiplier 3.0 by default. When price remains above the prior trail, the new trail equals the maximum of the previous trail and close minus the stop-loss distance derived from ATR. When price remains below the prior trail, the new trail equals the minimum of the previous trail and close plus that distance. On a side switch the trail is re-anchored from the current bar. The Fast trail reacts more quickly, while the Slow trail aims to confirm direction and filter noise.
Signals
Buy is when the Fast trail crosses above the Slow trail. Sell is when the Fast trail crosses below the Slow trail. These crossovers are continuation cues rather than standalone trade advice.
Four-state coloring
Strong Bull occurs when Fast is above Slow, the close is above Slow, and the low is above Slow. Bull with Pullback occurs when Fast is above Slow and the close is above Slow, but the low dips below Slow. Strong Bear occurs when Slow is above Fast, the close is below Slow, and the high is below Slow. Bear with Bounce occurs when Slow is above Fast and the close is below Slow, but the high pierces above Slow.
Directional bias
Bias is inferred by comparing which of Strong Bull or Strong Bear occurred more recently using a barsSince comparison. The most recent state defines the current bias and can help filter frequent flips in ranges.
Inputs
You can adjust Fast ATR period from 1 to 50 and its multiplier from 0.1 to 5.0. You can adjust Slow ATR period from 1 to 50 and its multiplier from 0.1 to 10.0. Optional toggles control candle coloring, trail visibility, fill between trails, alerts, and the information panel.
On-chart outputs
The indicator plots the Fast trail and the Slow trail, with optional fill between them. It can show Buy and Sell markers at crossovers. The optional information panel can display last signal side, entry price, current price, P&L since last signal, current market state, Fast and Slow ATR values, and inferred bias.
Alerts
Available alerts are Fast crossing above Slow, Fast crossing below Slow, entering Strong Bull, and entering Strong Bear.
Usage guidelines
For trend following, many users wait for a Buy crossover together with Strong Bull coloring and then manage risk against the Slow trail. For scalping, consider lower timeframes and a smaller Fast ATR such as period 3 and multiplier 0.3, while avoiding over-optimization. When publishing screenshots, use a clean chart with the symbol, timeframe, and the indicator’s name visible.
Limitations and realism
The tool works best in directional markets; ranging conditions may cause frequent side switches. It is designed for standard OHLC charts only and is not intended for Heikin Ashi, Renko, Kagi, Point & Figure, or Range charts. No claims are made about accuracy, profits, or future performance. Always use position sizing, stop-losses, and additional confirmation.
Compatibility and version
Pine Script v6. Default inputs in the publication match the values described above. Version 1.0 initial public release.
Notes
For questions and feedback, please use the comments section on the script page.
How it works
The Fast trail uses ATR with period 5 and multiplier 0.5 by default. The Slow trail uses ATR with period 10 and multiplier 3.0 by default. When price remains above the prior trail, the new trail equals the maximum of the previous trail and close minus the stop-loss distance derived from ATR. When price remains below the prior trail, the new trail equals the minimum of the previous trail and close plus that distance. On a side switch the trail is re-anchored from the current bar. The Fast trail reacts more quickly, while the Slow trail aims to confirm direction and filter noise.
Signals
Buy is when the Fast trail crosses above the Slow trail. Sell is when the Fast trail crosses below the Slow trail. These crossovers are continuation cues rather than standalone trade advice.
Four-state coloring
Strong Bull occurs when Fast is above Slow, the close is above Slow, and the low is above Slow. Bull with Pullback occurs when Fast is above Slow and the close is above Slow, but the low dips below Slow. Strong Bear occurs when Slow is above Fast, the close is below Slow, and the high is below Slow. Bear with Bounce occurs when Slow is above Fast and the close is below Slow, but the high pierces above Slow.
Directional bias
Bias is inferred by comparing which of Strong Bull or Strong Bear occurred more recently using a barsSince comparison. The most recent state defines the current bias and can help filter frequent flips in ranges.
Inputs
You can adjust Fast ATR period from 1 to 50 and its multiplier from 0.1 to 5.0. You can adjust Slow ATR period from 1 to 50 and its multiplier from 0.1 to 10.0. Optional toggles control candle coloring, trail visibility, fill between trails, alerts, and the information panel.
On-chart outputs
The indicator plots the Fast trail and the Slow trail, with optional fill between them. It can show Buy and Sell markers at crossovers. The optional information panel can display last signal side, entry price, current price, P&L since last signal, current market state, Fast and Slow ATR values, and inferred bias.
Alerts
Available alerts are Fast crossing above Slow, Fast crossing below Slow, entering Strong Bull, and entering Strong Bear.
Usage guidelines
For trend following, many users wait for a Buy crossover together with Strong Bull coloring and then manage risk against the Slow trail. For scalping, consider lower timeframes and a smaller Fast ATR such as period 3 and multiplier 0.3, while avoiding over-optimization. When publishing screenshots, use a clean chart with the symbol, timeframe, and the indicator’s name visible.
Limitations and realism
The tool works best in directional markets; ranging conditions may cause frequent side switches. It is designed for standard OHLC charts only and is not intended for Heikin Ashi, Renko, Kagi, Point & Figure, or Range charts. No claims are made about accuracy, profits, or future performance. Always use position sizing, stop-losses, and additional confirmation.
Compatibility and version
Pine Script v6. Default inputs in the publication match the values described above. Version 1.0 initial public release.
Notes
For questions and feedback, please use the comments section on the script page.
Script protegido
Esse script é publicada como código fechado. No entanto, você pode usar ele livremente e sem nenhuma limitação – saiba mais aqui.
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.
Script protegido
Esse script é publicada como código fechado. No entanto, você pode usar ele livremente e sem nenhuma limitação – saiba mais aqui.
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.