Type/to search

Dual Moving Average Crossover Algorithmic Trading Strategy

Cryptocurrency
Created: 2023-10-30 15:27:34
Last modified: 3 years ago
1
Follow
1781
Followers

img

Overview

This strategy mainly utilizes the moving average crossover principle, combined with the RSI indicator reversal signals and a custom dual moving average crossover algorithm to implement trend trading. The strategy tracks two moving averages of different periods, with a faster MA tracking short-term trends and a slower MA tracking long-term trends. When the faster MA crosses over the slower MA upwards, it signals an upward trend and a chance to buy. When the faster MA crosses below the slower MA, it signals the end of the short-term trend and a chance to close positions.

Strategy Logic

  1. Calculate two groups of VWAP moving averages with different parameters, representing long-term and short-term trends respectively.

    • Slow Tenkansen and Kijunsen calculate long-term trend
    • Fast Tenkansen and Kijunsen calculate short-term trend
  2. Take the averages of Tenkansen and Kijunsen as slow and fast moving averages.

  3. Calculate Bollinger Bands to identify consolidations and breakouts.

    • Middle line is the average of fast and slow MAs
    • Upper and lower bands are used to detect breakouts
  4. Calculate TSV to determine volume energy

    • TSV greater than 0 indicates bullish volume
    • TSV greater than its EMA indicates strengthening momentum
  5. Calculate RSI to identify overbought and oversold conditions

    • RSI below 30 is oversold zone for buying
    • RSI above 70 is overbought zone for selling
  6. Entry conditions:

    • Fast MA crosses over slow MA
    • Close crosses above Upper Bollinger Band
    • TSV greater than 0 and EMA
    • RSI below 30
  7. Exit conditions:

    • Fast MA crosses below slow MA
    • RSI greater than 70

Advantage Analysis

  1. Dual moving average system captures both long and short term trends

  2. RSI avoids buying overbought zones and selling oversold zones

  3. TSV ensures sufficient volume supporting the trend

  4. Bollinger Bands identify key breakout points

  5. Combination of indicators helps filter false breakouts

Risk Analysis

  1. MA systems prone to false signals, needs filtering with other indicators

  2. RSI parameters need optimization, may otherwise miss buy/sell points

  3. TSV also very sensitive to parameters, requires careful testing

  4. Breaking BB upper band may be false breakout, needs verification

  5. Difficult to optimize many indicators, risks overfitting

  6. Insufficient train/test data may cause curve fitting

Optimization Directions

  1. Test more periods to find best parameter combinations

  2. Try other indicators like MACD, KD to replace or combine with RSI

  3. Utilize walk forward analysis for parameter optimization

  4. Add stop loss to control single trade loss

  5. Consider machine learning models to aid signal prediction

  6. Adjust parameters for different markets, don't overfit to single parameter set

Conclusion

This strategy captures long and short term trends using dual moving averages, and filters signals with RSI, TSV, Bollinger Bands and more. The advantage is trading in line with long-term upward momentum. But it also carries false signal risks, requiring further parameter tuning and stop losses to reduce risks. Overall, combining trend following and mean reversion yields good results in long-term uptrends, but parameters need adjustment for different markets.

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

// @version=4

// Credits
Strategy parameters
Strategy parameters
Mean Reversion Strategy Inputs
Source
Small VWAP
Big VWAP
Mean VWAP
Percent below to buy %
Rsi Period
Rsi Ema Period
Maximum Rsi Level for Buy
Trend Hunter Strategy Inputs
Slow Tenkan Sen VWAP Line Length
Slow Kijun Sen VWAP Line Length
Fast Tenkan Sen VWAP Line Length
Fast Kijun Sen VWAP Line Length
Bollinger Band Length
Bollinger Band StdDev
TSV Length
TSV Ema Length
Vidya Length
Vidya Source
Strategy Date Range
Start Date
Start Month
Start Year
End Date
End Month
End Year
Comment
All comments (0)
No data
No data
  • 1
iPhone Download
Forums
PINE Language
© 2015 - ∞ INVENTOR PTE LTD (SG)