Type/to search

Trend Tracking Moving Average Crossover Strategy

Common strategy
Created: 2024-01-29 16:52:46
Last modified: 3 years ago
1
Follow
1802
Followers

img

Overview

This is a simple moving average based strategy that works well with different coin pairs. It plots the moving average opening price and closing price, and decides to enter a long position or exit it based on whether the two lines have crossed each other. The idea is that it enters a position when the average closing price is increasing, which may indicate upward momentum in prices. It then exits the position when the average closing price decreases, which may indicate downward momentum. This is speculative, but sometimes it can predict price action very well.

Strategy Logic

This strategy first selects the type of moving average, including EMA, SMA, RMA, WMA and VWMA. Then it sets the lookback period for the moving average, usually between 10 and 250 bars. Different combinations of moving average type and lookback period can produce very different results for different coin pairs.

The specific trading logic is:

  1. Calculate the moving average of open price and close price;
  2. Compare the moving average values between close price and open price;
  3. Enter a long position if close price moving average crosses above open price moving average;
  4. Close the long position if close price moving average crosses below open price moving average.

Entering the position considers it a sign of upward price movement, while exiting considers downward price movement.

Advantage Analysis

The main advantages of this strategy are:

  1. Flexible parameter settings that can be optimized for different coin pairs for better specificity;
  2. Simple logic that is easy to understand and implement;
  3. Very high returns achievable for some coin pairs, generally good stability;
  4. High customizability in displaying different indicators.

Risk Analysis

There are also some risks with this strategy:

  1. For some coin pairs and parameters, returns and stability can be low;
  2. Cannot respond well to short-term price fluctuations, poor performance for high volatile coins;
  3. Choice of moving average lookback period not scientific enough, somewhat subjective.

Solutions and optimization:

  1. Use longer timeframes like 12H, 1D to reduce unnecessary trades and improve stability;
  2. Add parameter optimization functions to automatically test different parameter combinations for best parameters;
  3. Add adaptive selection of moving average lookback period to let system automatically decide optimal period.

Conclusion

In summary, this is a simple strategy using moving average indicators to determine price trend and inflection points. It can achieve very good results by adjusting parameters, and is an effective trend tracking strategy worth further improvement and application. But risk management should be noted, choose suitable coin pairs and parameters to maximize its usefulness.

Source
Pine
/*backtest
start: 2023-12-01 00:00:00
end: 2023-12-31 23:59:59
period: 2h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=5
//Author @divonn1994

initial_balance = 100
Strategy parameters
Strategy parameters
Strategy
Moving average length (number of bars)
Moving Average type
Display
Red Background Color On/Off
Green Background Color On/Off
Moving Average Plot On/Off
Beginning of Strategy
Start Month 1-12 (set any start time to 0 for furthest date)
Start Date 1-31 (set any start time to 0 for furthest date)
Start Year 2000-2100 (set any start time to 0 for furthest date)
End of Strategy
End Month 1-12 (set any end time to 0 for today's date)
End Date 1-31 (set any end time to 0 for today's date)
End Year 2000-2100 (set any end time to 0 for today's date)
Comment
All comments (0)
No data
No data
  • 1
Forums
PINE Language
Get the app
iPhone Download
© 2015 - ∞ INVENTOR PTE LTD (SG)