Type/to search

Trend Following Strategy with Moving Averages and SuperTrend

Cryptocurrency
Created: 2023-10-20 16:50:01
Last modified: 3 years ago
1
Follow
1781
Followers

img

Overview

This strategy combines Moving Average indicators and SuperTrend indicator to implement a trend following strategy with trailing stop loss. It takes full advantage of Moving Averages’ trend judging capability and SuperTrend’s stop loss function to effectively track trends and control risks.

Strategy Logic

The strategy uses two FRAMA moving averages for trading signals and SuperTrend indicator for filtering.

Specifically, when the fast line crosses above the slow line, a buy signal is generated. When the fast line crosses below the slow line, a sell signal is generated. To avoid false breaks, the strategy adds a filter requiring SuperTrend indicator to align. Trades are only taken when SuperTrend agrees with signal direction.

For position management, the strategy uses SuperTrend direction change as a stop loss signal. When SuperTrend reverses direction, the position will be stopped out.

In addition, trailing stop loss can be enabled as an option. After certain profit target is reached, trailing stop can be used to lock in profits.

Advantage Analysis

  • Utilizes Moving Averages to determine trend direction, able to filter out market noise and precisely judge trends
  • Combining with SuperTrend filter avoids wrong trades from false breakouts
  • SuperTrend direction change acts as stop loss point, allowing quick stop loss and effective risk control
  • Optional trailing stop loss can maximize profits

Risk Analysis

  • As a trend following strategy, it’s vulnerable to whipsaws in ranging markets. Position sizing needs to be controlled.
  • Moving Averages have lagging effect, may cause premature or late entry
  • Improper SuperTrend parameters may lead to too aggressive or too conservative stop loss
  • When enabling trailing stop, trailing width needs to be set properly to avoid overactive stop loss

These risks can be reduced by adjusting Moving Average parameters, optimizing SuperTrend settings, and using trailing stop loss appropriately.

Optimization Directions

The strategy can be optimized in the following aspects:

  1. Optimize Moving Average parameters to find best parameter combination

Different period combinations can be tested to find the optimal balance of smoothness and sensitivity.

  1. Customize SuperTrend parameters

Different ATR periods and multipliers can be tested to optimize stop loss effect.

  1. Add other indicator filters

Additional filters like Donchian Channel, Volatility indicator can be tested.

  1. Optimize trailing stop parameters

Different trailing widths can be tested to maximize profit and control risk.

  1. Combine with other stop loss strategies

Combinations with fixed stop, volatility stop, adaptive stop can be tested.

Conclusion

The strategy integrates Moving Averages’ trend analysis and SuperTrend’s stop management into a complete trend following strategy with trailing stop loss. Further enhancements on risk management and parameter optimization can improve its stability and profitability. It is suitable for quantitative traders with some experience.

Source
Pine
/*backtest
start: 2023-10-01 00:00:00
end: 2023-10-13 00:00:00
period: 30m
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © 03.freeman

//@version=4
Strategy parameters
Strategy parameters
MA FRAMA Source
MA FRAMA Length
Resolution
* Fractal Adjusted (FRAMA) Only - FC
* Fractal Adjusted (FRAMA) Only - SC
Use supertrend for enter
Use supertrend for exit
Factor
Pd
Take Profit Points
Stop Loss Points
Trailing Stop Loss Points
Trailing Stop Loss Offset Points
Custom Backtesting Dates
Backtest Start Year
Backtest Start Month
Backtest Start Day
Backtest Start Hour
Backtest Stop Year
Backtest Stop Month
Backtest Stop Day
Backtest Stop Hour
Comment
All comments (0)
No data
No data
  • 1
iPhone Download
Forums
PINE Language
© 2015 - ∞ INVENTOR PTE LTD (SG)