Supertrend Public v2
May 1, 2024

The Supertrend Public v2 indicator is a trend-following tool that enhances the standard Supertrend calculation with integrated pullback signals and advanced trailing stop-loss mechanisms to improve trade execution and risk management.
Usage
The tool is primarily used to identify market direction and provide entry/exit points through the following features:
- Trend Reversal Signals: Large labels marked "Long" or "Short" appear when the price crosses the Supertrend line, indicating a potential shift in market bias.
- Pullback Entries: Smaller "PB Long" and "PB Short" triangles identify opportunities to add to a position or enter late into an existing trend. These occur when the price retraces toward the Supertrend line without breaking it.
- Trailing Stop Loss & Take Profit: The purple line represents a dynamic exit level. It utilizes a dual-trailing logic that can track price based on percentage movements and trigger-based trailing profit targets to secure gains as the market moves in your favor.
Details
The script is built upon the classic Supertrend logic, which uses the Average True Range (ATR) to create a volatility-adjusted band around the price. When the price closes above the upper band, it flips to an uptrend; when it closes below the lower band, it flips to a downtrend.
This version introduces logic to detect intraday pullbacks where the price dips below (in an uptrend) or rises above (in a downtrend) the Supertrend level mid-bar but remains within the trend on the close. Additionally, the risk management layer calculates two types of trailing stops: a standard trailing stop loss and a trailing take-profit that activates once a specific percentage gain is reached, choosing the most optimal (tightest) level to protect capital.
Settings
Base Settings
- ATR Period: Sets the lookback period for the Average True Range calculation.
- ATR Multiplier: Determines the distance between the price and the Supertrend line.
- Source: Specifies the price data used for the calculation (default is HL2).
Stop Loss / Take Profit
- Trailing Stop Loss %: The percentage distance for the basic trailing stop. Set to 0 to disable.
- Trail TP %: The percentage distance used for the trailing take-profit once the trigger is met.
- Trailing TP Trigger %: The percentage price increase/decrease required to activate the more aggressive trailing take-profit logic.
FAQ
How do I use the pullback signals?
Pullback signals (PB Long/Short) are designed for trend continuation. If you missed the initial reversal signal, these markers highlight areas where the price has retraced toward support/resistance levels within the current trend.
What does the purple line represent?
The purple line is the active Trailing Stop/Take Profit level. If the price touches or crosses this line, an "Exit" signal is generated, suggesting it may be time to close the position.
How can I access Supertrend Public v2?
You can get access on the LuxAlgo Library for charting platforms like TradingView, MetaTrader (MT4/MT5), and NinjaTrader for free.
Free indicator
Get free access to this indicator on the platforms below.
Unlock the entire LuxAlgo Library
Every indicator, every strategy, full charts, and complete access to Quant — our AI agent.