Type/to search

Moving Average Crossover Multi Timeframe Strategy

Cryptocurrency
Created: 2023-10-09 16:41:04
Last modified: 3 years ago
1
Follow
1781
Followers

Overview

This strategy is based on moving average crossover system, using golden cross and death cross of moving averages in different timeframes to determine entry and exit points. It also combines features like trailing stop loss, take profit and stop loss to lock in profits and mitigate risks.

Strategy Logic

The strategy utilizes two sets of moving averages, fast MA and slow MA. The fast MA has a shorter period to capture short-term trend, while the slow MA has a longer period for long-term trend. When the fast MA crosses above the slow MA, a golden cross occurs, signaling an uptrend. When the fast MA crosses below the slow MA, a death cross occurs, signaling a downtrend.

In the code, the fast MA is ma1, slow MA is ma2. Both ma1 and ma2 can be different types like SMA, EMA, with customizable periods. ma1 represents short-term trend with shorter period, ma2 represents long-term trend with longer period.

When ma1 golden crosses ma2, a long signal is generated. When ma1 death crosses ma2, a short signal is generated. In actual trading, features like trailing stop loss, take profit and stop loss can be added to lock in profits and control risks.

Advantage Analysis

The strategy has the following advantages:

  1. Simple and easy-to-understand logic.

  2. Flexible in choosing different types and parameters of MAs for different market conditions.

  3. Multi-timeframe design to capture both short and long term trends.

  4. Customizable entry rules to strictly control trading frequency.

  5. Configurable stop loss and take profit to effectively manage risks.

  6. Trend trailing stop loss allows profit to run.

  7. Optimizable parameters for more robustness.

Risk Analysis

The strategy also has the following risks:

  1. Lagging issue of dual MA crossovers may miss best reversal timing.

  2. Improper MA periods may generate more false signals.

  3. Sudden reversals may hit stop loss.

  4. Price may stay on one side of MA for extended periods in trending markets.

  5. Over-optimization over fitted parameters.

Risk management measures:

  1. Add filters to avoid false breakout signals.

  2. Test and optimize MA periods based on trading principles.

  3. Careful risk control and reasonable stop loss placement.

  4. Accept necessary cost of patience.

  5. Robustness test under different market conditions.

Optimization Directions

The strategy can be improved from the following aspects:

  1. Test more types of MA, like weighted moving average.

  2. Add dynamic periods based on volatility.

  3. Add filters like time and fundamentals to entry rules.

  4. Use adaptive stops that adjust to market volatility.

  5. Build parameter optimization system for backtesting.

  6. Incorporate machine learning to optimize parameters and filter signals.

Conclusion

In conclusion, this moving average crossover multi timeframe strategy has simple and clear logic to follow trends using fast and slow MA crossovers. With proper parameter selection, optimized entry/exit rules and risk control, it can achieve steady profits. However, users need to tolerate lagging risks and waiting time costs. Overall it is a simple, practical strategy worth optimizing and risk control for adapting to more market conditions.

Source
Pine
/*backtest
start: 2023-09-08 00:00:00
end: 2023-10-08 00:00:00
period: 4h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=3
// The majority of this script I took from the Autoview website. There are some typos in the original that I've fixed, some things I've added, things I will add, and I'm tired pulling my strategy code out and uploading this to pastebin for people.
// DISCLAIMER: I am not a financial advisor, this is not financial advice, do not use this code without first doing your own research, etc, etc, it's not my fault when you lose your house.
Strategy parameters
Strategy parameters
Backtest Start Year
Backtest Start Month
Backtest Start Day
Backtest Stop Year
Backtest Stop Month
Backtest Stop Day
--------Moving Average 1----------
Use Different Resolution?
Set Resolution Minutes
MA
Source
Period
Least Squares (LSMA) Only - Offset Value
Arnaud Legoux (ALMA) Only - Offset Value
Arnaud Legoux (ALMA) Only - Sigma Value
--------Moving Average 2----------
Use Different Resolution?
Set Resolution Minutes
MA
Source
Period
Least Squares (LSMA) Only - Offset Value
Arnaud Legoux (ALMA) Only - Offset Value
Arnaud Legoux (ALMA) Only - Sigma Value
Longs Only
Shorts Only
Flip the Opens
Pyramiding less than
Pyramiding equal to
Pyramiding greater than
Trailing Stop
Activate Trailing Stop Price (%). Divided by 100 (1 = 0.01%)
Trailing Stop (%). Divided by 100 (1 = 0.01%)
Take Profit
Take Profit (%). Divided by 100 (1 = 0.01%)
Stop Loss
Stop Loss (%). Divided by 100 (1 = 0.01%)
Comment
All comments (0)
No data
No data
  • 1
iPhone Download
Forums
PINE Language
© 2015 - ∞ INVENTOR PTE LTD (SG)