OPEN-SOURCE SCRIPT
Aggiornato ATR Stop Loss Non-Decreasing & Line

The script calculates a custom stop-loss level based on the Average True Range (ATR) indicator, ensuring that this stop-loss level never decreases from one bar to the next unless a reset condition is met. It also visually displays the ATR value and the calculated stop-loss level as a line on the chart.
Note di rilascio
This indicator implements an adaptive ATR-based stop loss and take profit system designed for flexible trade management directly on the chart. It calculates trailing stop levels using the Average True Range (ATR), a volatility measure which helps dynamically adjust stop distances to current market conditions.Key features:
ATR Calculation: Uses user-configurable ATR period and multiplier inputs to scale stop levels.
Flexible Trailing Modes: Offers two modes for managing the stop levels:
Non-Decreasing mode for the low level, which ensures the trailing stop only moves upward or stays flat to lock in gains.
Non-Increasing mode for the high level, ensuring the stop only moves downward or stays flat.
Dynamic Reset: Resets trailing stops if price closes beyond the current trail, allowing adaptation to new price action.
Visual Clarity: Plots trailing stop levels on the price chart with clear color coding (red for low stops, yellow for high stops) and draws corresponding stop lines for visual monitoring.
Overlay and Status Visualization: The ATR value is shown in the status line for quick reference.
How it works:
The script calculates candidate stop levels by adding/subtracting a multiple of ATR from current highs and lows. Depending on the selected mode, the trailing stops either lock in favorable price movement or reset when surpassed by price, making it suitable for trend-following or range-bound trading styles. This method leverages market volatility to automatically adjust stops, helping traders protect profits and manage risk more effectively than static stops.
Use cases:
Traders seeking automated volatility-based stop loss and take profit zones.
Those who want a stop system that adapts to changing market conditions.
Users preferring configurable trailing modes for custom behavior.
Intraday and swing traders looking for clear visual stop references on charts.
This script does not execute orders but serves as a visual and analytical tool to complement trading decisions by representing ATR-based stop zones dynamically.
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.