Logo

dev-resources.site

for different kinds of informations.

Multi-Moving Average Trend Following Strategy - Long-term Investment Signal System Based on EMA and SMA Indicators

Published at
1/9/2025
Categories
strategy
trading
indicator
cryptocurrency
Author
fmzquant
Author
8 person written this
fmzquant
open
Multi-Moving Average Trend Following Strategy - Long-term Investment Signal System Based on EMA and SMA Indicators

Image description

Overview
This strategy is a trend following system based on multiple moving averages combination, mainly utilizing the crossover and position relationships between Weekly EMA20, Daily SMA100, Daily SMA50, and Daily EMA20 to capture medium to long-term investment opportunities. The strategy identifies potential long entry points by observing the relationship between price and moving averages, combined with duration requirements.

Strategy Principles
The core logic of the strategy is based on the following key conditions:

  1. Uses 20-period Weekly Exponential Moving Average (EMA1W20) as the primary trend indicator
  2. Combines with 100-day Simple Moving Average (SMA1D100) for secondary trend confirmation
  3. Employs 50-day Simple Moving Average (SMA1D50) as medium-term trend reference
  4. Utilizes 20-day Exponential Moving Average (EMA1D20) for short-term trend confirmation

The system generates a long signal when the price maintains above EMA1W20 and SMA1D100 for 14 consecutive days and then falls below SMA1D50. This design combines trend confirmation across multiple timeframes to enhance signal reliability.

Strategy Advantages

  1. Multi-timeframe validation: Combines weekly and daily moving averages for more comprehensive trend assessment
  2. Strict entry conditions: Requires price to maintain above major moving averages for sufficient duration, effectively filtering false signals
  3. Reasonable risk control: Uses multiple moving average crossovers and positions for clear risk boundaries
  4. High adaptability: Strategy parameters can be adjusted for different market environments
  5. Clear execution: Trading signals are well-defined and suitable for programmatic implementation

Strategy Risks

  1. Lag risk: Moving averages inherently have some lag, potentially causing delayed entries
  2. Sideways market risk: May generate frequent false breakout signals in ranging markets
  3. Parameter sensitivity: Optimal parameters may vary in different market environments
  4. Drawdown risk: May experience significant drawdowns during sudden trend reversals
  5. Execution risk: Requires stable system operation to avoid signal loss or execution delays

Strategy Optimization Directions

  1. Incorporate volume indicators: Add volume confirmation mechanism to improve signal reliability
  2. Optimize parameter adaptation: Develop dynamic parameter adjustment mechanisms
  3. Add filtering conditions: Consider adding market environment indicators
  4. Improve stop-loss mechanism: Design more detailed stop-loss and profit-taking rules
  5. Enhance signal confirmation: Consider adding other technical indicators for auxiliary confirmation

Summary
This strategy establishes a relatively comprehensive trend following system through multiple moving average combinations, suitable for medium to long-term investors. While it has certain lag and parameter sensitivity risks, the strategy has practical value through proper risk control and continuous optimization. Investors are advised to make appropriate adjustments based on their risk preferences and market conditions.

Strategy source code

/*backtest
start: 2024-11-12 00:00:00
end: 2024-12-11 08:00:00
period: 1h
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

// This Pine Scriptβ„’ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// Β© petitepupu

//@version=5

ema20wTemp = ta.ema(close, 20)
ema20w = request.security(syminfo.tickerid, "1W", ema20wTemp, barmerge.gaps_on, barmerge.lookahead_off)
sma100d = ta.sma(close, 100)
sma50d = ta.sma(close, 50)
ema20d = ta.ema(close, 20)
daysAbove = input.int(14, title="Days", minval=1)
plot(ema20w, color=color.blue)
plot(sma100d, color=color.yellow)
plot(sma50d, color=color.red)
plot(ema20d, color=color.green)

longCondition = true
clean = true
for i = 0 to daysAbove
    if close[i] < ema20w or close[i] < sma100d or close > sma50d
        longCondition := false
        clean := false
        break

//TODO: 
if clean != true
    longCondition := true
    for i = 0 to daysAbove
        if close[i] > ema20w or close[i] > sma100d or close >= ema20d or -100 * (close - ema20d)/ema20d < 5.9
            longCondition := false
            break


// plotshape(series=longCondition, location=location.belowbar, color=color.green, style=shape.triangleup, title="Buy Signal", size = size.small)

if (longCondition)
    strategy.entry("Long", strategy.long)


strategy(title="LT Strategy", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=800)
Enter fullscreen mode Exit fullscreen mode

Strategy parameters

Image description

The original address: https://www.fmz.com/strategy/474956

trading Article's
30 articles in total
Favicon
EMA-MACD Composite Strategy for Trend Scalping
Favicon
Dynamic Timing and Position Management Strategy Based on Volatility
Favicon
Multi-Market Adaptive Multi-Indicator Trend Following Strategy
Favicon
Multi-EMA Trend Following Strategy with SMMA Confirmation
Favicon
Multi-Indicator Trend Following Strategy with Bollinger Bands and ATR Dynamic Stop Loss
Favicon
Dynamic Pivot Points with Crossup Optimization System
Favicon
Multi-Timeframe Trend Dynamic ATR Tracking Strategy
Favicon
Multi-dimensional Gold Friday Anomaly Strategy Analysis System
Favicon
Mean Reversion Bollinger Band Dollar-Cost Averaging Investment Strategy
Favicon
Dynamic ATR Trend Following Strategy Based on Support Level Breakthrough
Favicon
Price Pattern Based Double Bottom and Top Automated Trading Strategy
Favicon
Multi-Indicator Adaptive Trading Strategy Based on RSI, MACD and Volume
Favicon
Multi-Moving Average Trend Following Strategy - Long-term Investment Signal System Based on EMA and SMA Indicators
Favicon
Dual EMA Crossover Strategy with Smart Risk-Reward Control
Favicon
Multi-Period EMA Crossover with RSI Momentum and ATR Volatility Based Trend Following Strategy
Favicon
Dual EMA Stochastic Trend Following Trading Strategy
Favicon
Multi-Wave Trend Crossing Risk Management Quantitative Strategy
Favicon
Dynamic EMA Trend Crossover Entry Quantitative Strategy
Favicon
Enhanced Mean Reversion Strategy with MACD-ATR Implementation
Favicon
Bollinger Bands Momentum Breakout Adaptive Trend Following Strategy
Favicon
Multi-Indicator Synergistic Trend Following Strategy with Dynamic Stop-Loss System
Favicon
Adaptive Range Trading System Based on Dual RSI Indicators
Favicon
Advanced Five-Day Cross-Analysis Strategy Based on RSI and MACD Integration
Favicon
Advanced Quantitative Trend Capture Strategy with Dynamic Range Filter
Favicon
Multi-Technical Indicator Trend Following Strategy with RSI Momentum Filter
Favicon
Advanced Trend Following Strategy with Adaptive Trailing Stop
Favicon
Multi-Timeframe Trend Following Strategy with ATR-Based Take Profit and Stop Loss
Favicon
Triple Supertrend and Bollinger Bands Multi-Indicator Trend Following Strategy
Favicon
Dual Moving Average Trend Following Strategy with Risk Management
Favicon
Quantitative Long-Short Switching Strategy Based on G-Channel and EMA

Featured ones: