OPEN-SOURCE SCRIPT

Supertrend Scalping

887
This Pine Script indicator called “Supertrend Scalping” is designed for scalping strategies and is built around the Supertrend indicator, enhanced with a complete trade management system including multiple Take Profit (TP) levels and a dynamic Stop Loss (SL).

The script begins by calculating the ATR (Average True Range), which measures market volatility. The user can choose between the standard ATR (RMA) or a simple moving average version (SMA). This ATR is then used to construct the Supertrend bands by adding and subtracting a multiple of the ATR from a price source (by default, hl2). These bands adjust dynamically and define the trend: when price breaks above the upper band, the trend turns bullish; when it breaks below the lower band, the trend becomes bearish.

Trading signals are generated when the trend changes direction. A BUY (LONG) signal appears when the trend shifts from bearish to bullish, while a SELL (SHORT) signal appears when it shifts from bullish to bearish. At each new signal, the script initializes a virtual trade using the current closing price as the entry point.

The core strength of this script lies in its trade management system. It automatically calculates three Take Profit levels (TP1, TP2, TP3) and an initial Stop Loss, all based on configurable ATR multiples. These levels are displayed on the chart using colored lines and labels. The script then continuously monitors price action to detect when these levels are reached.

When a Take Profit level is hit, it is visually removed. If TP1 is reached, the Stop Loss can be moved to the entry price (break-even). If TP2 is reached, the Stop Loss is moved up to the TP1 level. This creates a smart trailing stop mechanism that progressively locks in profits. If either TP3 or the Stop Loss is hit, the trade is fully closed and all visual elements are cleared.

Additionally, the script updates label positions in real time so they follow the current bar, and it highlights the active trend with a colored background (green for bullish, red for bearish). It also includes alert conditions for entry signals as well as TP and SL hits.

In summary, this indicator goes beyond simple signal generation by offering a complete scalping framework, combining entry signals, structured profit targets, risk management, and volatility-based adaptability.

免責聲明

這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。