Type/to search

Moving Average Crossover Strategy for Two-way Trading

Cryptocurrency
Created: 2023-12-12 11:26:54
Last modified: 3 years ago
1
Follow
1779
Followers

img

Overview

This strategy calculates moving averages of different periods and issues trading signals when the shorter period moving average crosses over or crosses below the longer period moving average. It belongs to the typical moving average crossover system. The strategy supports both long and short positions to achieve two-way trading.

Principles

The strategy judges market trends and generates trading signals based on the crossover between moving averages of different periods. It uses three moving average lines of 8-period, 13-period and 21-period, where the 8-period line is the shorter period line and the 21-period line is the longer period line. A long signal is triggered when the 8-period line crosses over the 21-period line. A short signal is triggered when the 8-period line crosses below the 21-period line.

In actual trading execution, the strategy also includes a filtering condition to avoid being trapped in choppy markets. It only places orders when the closing price is higher (long signal) or lower (short signal) than the crossover point. This can effectively filter out some false signals.

Advantages

  1. Applies moving average crossover rules to effectively track market trends
  2. Adds trade filters to avoid some false signals and being trapped
  3. Supports two-way trading to profit in both bull and bear markets
  4. Captures turns between major levels using inter-period moving averages
  5. Simple and clear logic, easy to understand and optimize

Risks

  1. May fail or generate excessive false signals in highly volatile markets
  2. Unable to judge when prices move sideways, missing opportunities
  3. Inter-period crossover has a lag, may not timely capture short-term trend changes
  4. Does not consider price volatility, parameters need adjustments for different volatility levels
  5. No stop loss or take profit, risks unlimited losses

Solutions for Risks

  1. Combine other indicators to judge markets, avoid volatility impact
  2. Lower moving average periods for higher sensitivity
  3. Add stop loss and take profit to control risks and drawdowns

Optimization Directions

  1. Combine other indicators like MACD and KDJ to improve efficacy
  2. Test impacts of different parameter settings on overall strategy performance
  3. Set adaptive parameters based on market type and volatility levels
  4. Optimize moving average calculation methods using DEMA, ZLEMA etc.
  5. Add stop loss and take profit logic
  6. Optimize quant backtesting metrics to determine best parameters

Conclusion

The strategy has a clear logic of using simple moving average crossover to determine relationships between short-term and long-term trends and capture rotation opportunities. It supports two-way trading and is easy to understand and optimize. But some risks exist like ineffective handling of specific market conditions and lack of risk control. Subsequent technical indicator combos and parameter optimization can further improve strategy stability and profitability.

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

//@version=3
//Converted to strategy by shawnteoh

strategy(title = "MA Emperor insiliconot Strategy" , overlay=true, pyramiding=1, precision=8)
Strategy parameters
Strategy parameters
Strategy Direction
Backtest Start Year
Backtest Start Month
Backtest Start Day
Backtest Stop Year
Backtest Stop Month
Backtest Stop Day
Order quantity
Plot indicators?
Type
MA 1
MA 2
MA 3
MA 4
MA 5
IB
2B
21b
22b
Enable 1
Enable 2
Enable 3
Enable 4
Enable 5
Enable 6
Enable 7
Enable x
Enable x
*** Gaussian poles ***
Comment
All comments (0)
No data
No data
  • 1
iPhone Download
Forums
PINE Language
© 2015 - ∞ INVENTOR PTE LTD (SG)