Type/to search

Trend Tracking Strategy Based on Moving Average

Cryptocurrency
Created: 2023-10-07 15:04:00
Last modified: 3 years ago
1
Follow
1781
Followers

Overview

This strategy identifies the current trend direction by calculating moving averages of different periods and generates trading signals combined with the RSI indicator. When the short period moving average crosses above the long period moving average, the trend is considered up and a buy signal is generated. When the short period moving average crosses below the long period moving average, the trend is considered reversed and a sell signal is generated. The RSI indicator is used to avoid false signals caused by minor price fluctuations.

Strategy Logic

  1. Calculate 10-day, 20-day, 50-day, 100-day and 200-day simple moving averages.

  2. Calculate 14-day RSI value.

  3. When 10-day SMA crosses above 50-day SMA, and RSI is greater than 30, and 20-day SMA is greater than or equal to 100-day SMA or 50-day SMA is greater than or equal to 100-day SMA, buy.

  4. Set stop loss price to entry price multiplied by (1 - stop loss percentage).

  5. Sell when:

    • 10-day SMA crosses below 50-day SMA, and close is below 20-day SMA: trend reversal sell signal
    • Close is below 95% of entry price: stop loss sell
    • Close is below stop loss price: trailing stop loss sell

This strategy judges market trend using moving averages and sets stop loss to control risks. RSI filters out false breakouts. It buys when short period SMA crosses above long period SMA, indicating an uptrend, and sets a stop loss line to control risks during holding period. It sells when a trend reversal signal occurs or stop loss price is triggered.

Advantage Analysis

  • Using moving averages to determine trend direction, buying during uptrend avoids trading in range-bound markets
  • Using multiple period moving averages avoids being misled by short-term price fluctuations
  • Combining with RSI filters out false signals
  • Setting stop loss controls downside risk for each trade
  • Using trailing stop loss to lock in profits

Risk Analysis

  • Moving averages have lag and may miss the best timing for price reversal
  • Stop loss set too loose may lead to large losses for single trades
  • Stop loss set too tight may cause too frequent stop loss triggers
  • Trailing stop loss may exit too early missing larger profits

Optimization can be done via adjusting moving average periods, stop loss levels etc. Also consider combining with other indicators to improve accuracy.

Optimization Directions

  • Adjust moving average periods to fit different market conditions
  • Optimize RSI parameters to better identify overbought/oversold conditions
  • Set reasonable static stop loss and trail stop levels based on instrument characteristics
  • Add other indicators to avoid false signals
  • Dynamically adjust stop loss based on volatility etc
  • Auto optimize parameters via machine learning

Summary

The strategy has clear logic overall, using moving averages for trend determination and setting stop loss to control risks. It is a typical trend tracking strategy. Further improvements can be achieved via parameter tuning and adding other indicators. But no strategy is perfect, continuous adjustments and optimizations are needed to cope with market uncertainties, together with proper risk management.

Source
Pine
/*backtest
start: 2022-09-30 00:00:00
end: 2023-10-06 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=4
strategy("MA_Script", overlay=true)

// STEP 1:
Strategy parameters
Strategy parameters
Trail Long Loss (%)
Start Date
Start Month
Start Year
Comment
All comments (0)
No data
No data
  • 1
iPhone Download
Forums
PINE Language
© 2015 - ∞ INVENTOR PTE LTD (SG)