Type/to search

Double Moving Average Crossover Trading Strategy

Cryptocurrency
Created: 2023-10-13 15:40:49
Last modified: 3 years ago
1
Follow
1781
Followers

Overview

The double moving average crossover trading strategy generates trading signals by calculating two moving averages with different parameter settings and trading when the moving averages cross over. This simple and straightforward strategy is suitable for medium-term trading.

Strategy Logic

The core logic of this strategy is:

  1. Input parameters: faster MA period maLen1, slower MA period maLen2, MA type maTypeChoice

  2. Calculate faster MA maValue1 and slower MA maValue2 based on input parameters

  3. Define buy and sell conditions by comparing the two MAs:

    • Buy when maValue1 crosses above maValue2

    • Sell when maValue1 crosses below maValue2

  4. Execute trades at buy and sell signals

  5. Visualize MAs in different colors based on their relationship

  6. Send buy and sell alert signals

Advantages

  • Utilizes dual MA crossover system, avoids false signals from single MA

  • Customizable MA periods suit different trading horizons

  • Simple and straightforward logic, easy to understand and implement

  • Customizable signal alerts for timely execution

  • Visualized MA trends form intuitive trading indicator

  • Optimizable parameters to find best combination

  • Applicable for backtesting and live trading

Risks

  • MA crosses may generate false signals, need extra trend and pattern confirmation

  • Whipsaws around MA crossover incur unnecessary trading costs

  • Improper parameters lead to over-trading or sparse trading

  • Extreme events cause huge price swings, unable to limit losses

  • Long-term trend breaks invalidate short-term indicators

  • Requires frequent monitoring, not fully automatable

Risk Management:

  • Add trend filter to avoid trading against trend

  • Add pattern filter to confirm signal validity

  • Optimize parameters for reasonable trading frequency

  • Set stop loss/take profit to limit losses

  • Robustness test across long time frames

  • Price and time filters to avoid false breakouts

Optimization Directions

  • Test different MA parameters to find optimum

  • Test different MA types for most accurate signals

  • Add trend filter to avoid counter-trend trades

  • Add volatility filter to identify proper exit points

  • Add price/time filter to reduce false signals

  • Implement slippage control for real trading

  • Robustness test across instruments and timeframes

  • Integrate auto stop loss/take profit

  • Explore machine learning to improve strategy

Conclusion

The dual moving average crossover is a classic technical indicator strategy. It generates signals from MA crosses and can produce good backtest results through optimization. However, risks like false signals remain, requiring additional filters. Real trading also needs execution details like slippage control. Overall, the strategy suits medium-term trading as a simple and intuitive choice. With continuous improvements and robustness validation, this strategy can achieve stable returns in live trading.

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

//@version=4
// © sehweijun
//study( title="Arch1tect's New Toy", shorttitle="Arch1tect's New Toy", overlay=true, resolution="")
// strategy( title="Arch1tect's New Toy (Strategy Tester Version)", shorttitle="Arch1tect's New Toy (Strategy Tester Version)", overlay=true, initial_capital = 100000, commission_value=0.07, commission_type=strategy.commission.cash_per_contract)
Strategy parameters
Strategy parameters
MA Type
MA Source
MA Length
MA Length
Strategy Tester
Strategy Tester [ON/OFF]
Daily trading time session (in Exchange GMT)
Start Time
Max daily loss
Max daily loss
Contract size
First trade on session start [ON/OFF]
Fixed TP/SL PIPS [ON/OFF]
TP
SL
Date Range
From Day
From Month
From Year
Thru Day
Thru Month
Thru Year
Comment
All comments (0)
No data
No data
  • 1
iPhone Download
Forums
PINE Language
© 2015 - ∞ INVENTOR PTE LTD (SG)