All indicators

SuperTrend Backtester

Oct 30, 2019

Static chart image
SignalsTrailing-StopVolatility

The SuperTrend Backtester tool provides a robust framework for evaluating the performance of the popular SuperTrend indicator across historical data with customizable entry and exit parameters.

Usage

The strategy is designed to enter long positions when the price crosses above the SuperTrend line and short positions when it crosses below. Users can evaluate the efficacy of the SuperTrend across specific market cycles by utilizing the date range filters.

Furthermore, the script includes a toggleable exit system that allows for testing fixed Take Profit and Stop Loss targets in ticks, providing a clear view of how different risk-reward ratios impact the overall strategy performance.

Details

The script calculates the SuperTrend using the standard Average True Range (ATR) multiplied by a user-defined factor. This value is then subtracted from (for uptrends) or added to (for downtrends) the Median Price (HL2). To ensure the trend line only moves in the direction of the trend, the script tracks the previous trend direction and calculates a Trailing Stop Loss (TSL) level.

The strategy logic executes trades only within the user-defined time window, making it highly effective for backtesting against specific high-volatility events or historical periods.

Settings

SuperTrend Configuration

  • Factor: The multiplier applied to the ATR to determine the distance of the SuperTrend line from the price.
  • Period: The lookback period used for the ATR calculation.

Date Range

  • From Month/Day/Year: Sets the start date for the backtest period.
  • To Month/Day/Year: Sets the end date for the backtest period.

Strategy Settings

  • Exits Enabled: Toggle to enable or disable fixed Take Profit and Stop Loss exits.
  • Take Profit (Ticks): The target profit level measured in price ticks.
  • Stop Loss (Ticks): The maximum loss level measured in price ticks.

FAQ

How do I use the SuperTrend Backtester?

You can apply the script to your chart and adjust the Factor and Period settings to see how the entries and exits perform on your selected asset. Ensure the date range covers the period you wish to analyze.

Can I use this for live trading?

While this script is primarily a backtesting strategy, it includes alert functionality for entries. You should always thoroughly test any strategy on historical data before considering live application.

How can I access SuperTrend Backtester?

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.

TradingView
NinjaTrader
MetaTrader 4/5

Unlock the entire LuxAlgo Library

Every indicator, every strategy, full charts, and complete access to Quant — our AI agent.