OPEN-SOURCE SCRIPT
Diupdate SuperTrend STRATEGY

SuperTrend Strategy (Long Only)
A streamlined, long-only implementation of the classic SuperTrend indicator designed for trend-following entries and exits.
How It Works
This strategy identifies uptrend reversals using the SuperTrend algorithm and enters long positions accordingly. When the trend flips bearish, the position is closed — no short entries are taken. This makes it ideal for spot trading or accounts that do not permit shorting.
Core Logic
Default Settings
Backtest Window
A customizable date range filter is included, allowing you to evaluate performance over specific periods.
Notes
A streamlined, long-only implementation of the classic SuperTrend indicator designed for trend-following entries and exits.
How It Works
This strategy identifies uptrend reversals using the SuperTrend algorithm and enters long positions accordingly. When the trend flips bearish, the position is closed — no short entries are taken. This makes it ideal for spot trading or accounts that do not permit shorting.
Core Logic
- ATR is calculated using a Simple Moving Average (SMA) of True Range for more responsive volatility tracking.
- A long entry is triggered when the SuperTrend flips from bearish to bullish.
- The position is closed when the SuperTrend flips back to bearish.
- "Buy" and "Close" labels are plotted on the chart for clear visual reference.
Default Settings
- ATR Period: 10
- ATR Multiplier: 3.0
- Source: hl2
- Initial Capital: $10,000
- Position Size: 100% of equity
- Commission: 0.015%
Backtest Window
A customizable date range filter is included, allowing you to evaluate performance over specific periods.
Notes
- This strategy is intended for educational and backtesting purposes only. Past performance does not guarantee future results.
- Works across all asset classes and timeframes. Adjust ATR Period and Multiplier to suit your preferred market and trading style.
Catatan Rilis
SuperTrend Strategy (Long Only)A streamlined, long-only implementation of the classic SuperTrend indicator designed for trend-following entries and exits.
How It Works
This strategy identifies uptrend reversals using the SuperTrend algorithm and enters long positions accordingly. When the trend flips bearish, the position is closed — no short entries are taken. This makes it ideal for spot trading or accounts that do not permit shorting.
Core Logic
- ATR is calculated using a Simple Moving Average (SMA) of True Range for more responsive volatility tracking.
- A long entry is triggered when the SuperTrend flips from bearish to bullish.
- The position is closed when the SuperTrend flips back to bearish.
- "Buy" and "Close" labels are plotted on the chart for clear visual reference.
Default Settings
- ATR Period: 10
- ATR Multiplier: 3.0
- Source: hl2
- Initial Capital: $10,000
- Position Size: 100% of equity
- Commission: 0.01%
Backtest Window
A customizable date range filter is included, allowing you to evaluate performance over specific periods.
Notes
- This strategy is intended for educational and backtesting purposes only. Past performance does not guarantee future results.
- Works across all asset classes and timeframes. Adjust ATR Period and Multiplier to suit your preferred market and trading style.
Catatan Rilis
SuperTrend Strategy (Long Only)A streamlined, long-only implementation of the classic SuperTrend indicator designed for trend-following entries and exits.
How It Works
This strategy identifies uptrend reversals using the SuperTrend algorithm and enters long positions accordingly. When the trend flips bearish, the position is closed — no short entries are taken. This makes it ideal for spot trading or accounts that do not permit shorting.
Core Logic
- ATR is calculated using a Simple Moving Average (SMA) of True Range for more responsive volatility tracking.
- A long entry is triggered when the SuperTrend flips from bearish to bullish.
- The position is closed when the SuperTrend flips back to bearish.
- "Buy" and "Close" labels are plotted on the chart for clear visual reference.
Default Settings
- ATR Period: 10
- ATR Multiplier: 8.5
- Source: hl2
- Initial Capital: $10,000
- Position Size: 100% of equity
- Commission: 0.01%
Backtest Window
A customizable date range filter is included, allowing you to evaluate performance over specific periods.
Notes
- This strategy is intended for educational and backtesting purposes only. Past performance does not guarantee future results.
- Works across all asset classes and timeframes. Adjust ATR Period and Multiplier to suit your preferred market and trading style.
Catatan Rilis
Changelog:Added process_orders_on_close=true to the strategy() declaration. Without this parameter, orders are executed at the next bar's open by default, which can cause trade entries/exits to appear at unexpected positions or be delayed. With this fix, orders are now processed at the current bar's close, ensuring that Buy/Close signals and actual strategy executions are properly synchronized.
Skrip open-source
Dengan semangat TradingView yang sesungguhnya, pembuat skrip ini telah menjadikannya sebagai sumber terbuka, sehingga para trader dapat meninjau dan memverifikasi fungsinya. Salut untuk penulisnya! Meskipun Anda dapat menggunakannya secara gratis, perlu diingat bahwa penerbitan ulang kode ini tunduk pada Tata Tertib kami.
Pernyataan Penyangkalan
Informasi dan publikasi ini tidak dimaksudkan, dan bukan merupakan, saran atau rekomendasi keuangan, investasi, trading, atau jenis lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Ketentuan Penggunaan.
Skrip open-source
Dengan semangat TradingView yang sesungguhnya, pembuat skrip ini telah menjadikannya sebagai sumber terbuka, sehingga para trader dapat meninjau dan memverifikasi fungsinya. Salut untuk penulisnya! Meskipun Anda dapat menggunakannya secara gratis, perlu diingat bahwa penerbitan ulang kode ini tunduk pada Tata Tertib kami.
Pernyataan Penyangkalan
Informasi dan publikasi ini tidak dimaksudkan, dan bukan merupakan, saran atau rekomendasi keuangan, investasi, trading, atau jenis lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Ketentuan Penggunaan.