Overview
This strategy is a trading system that combines multi-period moving average crossovers with the MACD momentum indicator, designed for a specific time window. The strategy utilizes the crossover relationship between a short-term Simple Moving Average (SMA3) and a medium-term Exponential Moving Average (EMA10) as the primary entry signal, while incorporating MACD for momentum confirmation and adding candle pattern and time filtering conditions to improve signal quality. The strategy sets fixed stop-loss and take-profit values, and through this multi-confirmation mechanism, aims to capture turning points in short-term price trends.
Strategy Principles
The core logic of this strategy is based on several key components:
Moving Average Crossover System: Uses the crossover of a 3-period Simple Moving Average (SMA3) with a 10-period Exponential Moving Average (EMA10) as the main signal. A buy signal is generated when SMA3 crosses above EMA10; a sell signal is generated when SMA3 crosses below EMA10.
MACD Momentum Confirmation: The strategy uses the MACD(12,26,9) indicator as a momentum confirmation tool. Long positions require the MACD line to be above the signal line, indicating upward momentum; short positions require the MACD line to be below the signal line, indicating downward momentum.
Candle Pattern Filtering: Further adds candle pattern conditions, requiring long signals to appear on green candles where the closing price is higher than the opening price; short signals must appear on red candles where the closing price is lower than the opening price.
Time Filter: The strategy only executes trades between 9 PM and 10 PM Colombian time (UTC-5), which may be based on considerations of market volatility characteristics during this period.
Risk Management: The strategy uses fixed stop-loss and take-profit settings, defaulting to 15 pips for stop-loss and 30 pips for take-profit, although the code comments mention that actual trading might be based on the most recent low or high marked by a 6-period ZigZag indicator.
Strategy Advantages
Multiple Confirmation Mechanism: Combines moving average crossovers, MACD indicator, candle patterns, and time filtering to form a trading system that requires multiple conditions to be met simultaneously, effectively reducing false signals.
Flexible Time Filtering: By limiting specific trading time periods, the strategy can focus on the behavioral characteristics of the market during specific time slots, avoiding inefficient trading periods.
Clear Risk Management: Preset stop-loss and take-profit parameters provide a clear risk control framework, with a risk-reward ratio of 1:2 for each trade, conducive to long-term stable performance.
Complementary Technical Indicators: The short-term SMA captures immediate price movements, the medium-term EMA provides trend direction reference, and MACD verifies momentum. These three form a complementary relationship, improving signal quality.
Parameter Adjustability: The strategy allows for adjustment of multiple key parameters, including MACD parameters, stop-loss and take-profit points, and pip size, making it adaptable to different markets and trading instruments.
Strategy Risks
Overtrading Risk: Despite multiple filtering conditions, the 3-period SMA is very sensitive and may generate frequent crossover signals in sideways markets, leading to overtrading and unnecessary fee expenses.
Time Window Limitation: Trading only during specific time periods may miss favorable opportunities in other periods, and if the market characteristics of the selected time period change, strategy performance may significantly decline.
Limitations of Fixed Stop-Loss and Take-Profit: Using fixed pip values for stop-loss and take-profit may not adapt to changes in market volatility; stop-losses might be too small during high volatility periods and take-profits too large during low volatility periods.
Defects of Trend Following: This strategy is essentially trend-following in nature and may suffer consecutive losses during severe market oscillations or reversals.
Dual Nature of Multiple Conditions: While multiple conditions can reduce false signals, they may also cause missed effective signals, especially in fast markets where the optimal entry point may have passed by the time all conditions are met.
Strategy Optimization Directions
Dynamic Stop-Loss and Take-Profit Mechanism: Consider adjusting stop-loss and take-profit levels based on ATR indicator or market volatility, rather than using fixed pip values, to better adapt to changing market conditions.
Optimize Time Filter: It is recommended to analyze historical data to determine which time periods the strategy performs best in, possibly needing to adjust trading time windows according to different markets or seasons.
Add Volatility Filtering: Introduce volatility indicators such as ATR or Bollinger Bandwidth to reduce trading or adjust parameters in low volatility environments, avoiding false signals in range-bound markets.
Improve Exit Strategy: Consider implementing partial profit-locking mechanisms, such as moving the stop-loss to the break-even point or closing positions in batches when the price reaches a certain profit level, to protect already gained profits.
Extend Backtesting Period: Test the strategy under different market conditions and over longer time periods to ensure its stability in various market environments, avoiding over-adaptation to specific market conditions.
MACD Parameter Optimization: Consider optimizing the MACD parameters to better adapt to the cyclical characteristics of the target market, with a possible direction being shortening the fast line period to improve response speed.
Summary
The Multi-Period Moving Average Crossover with MACD Momentum Confirmation Trading Strategy is a well-designed short-term trading system that forms a multi-level signal confirmation mechanism by combining moving average crossovers, momentum confirmation, time filtering, and candle pattern recognition. The main advantages of the strategy lie in its multiple confirmation mechanisms and clear risk management framework, but it also faces challenges in overtrading and market adaptability. By introducing dynamic risk management, optimizing time filtering, and adding volatility considerations, the strategy has the potential to achieve more stable performance in different market environments. Ultimately, this strategy is suitable for traders who prefer short-term trading within specific time windows and are willing to accept a certain degree of trading frequency with clear risk control.
Strategy source code
/*backtest
start: 2024-06-30 00:00:00
end: 2025-06-28 08:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"ETH_USDT","balance":50000000}]
*/
//@version=5
strategy("SMA3 / EMA10 + MACD (9-10pm COL) | SL 10 pips, TP 10 pips", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=10)
// === INPUTS ===
pipSize = input.float(0.01, "Pip Size (0.01 for USDJPY)")
slPips = input.int(15, "Stop Loss (pips)")
tpPips = input.int(30, "Take Profit (pips)")
macdFast = input.int(12, "MACD Fast")
macdSlow = input.int(26, "MACD Slow")
macdSignal = input.int(9, "MACD Signal")
// === INDICATORS ===
sma3 = ta.sma(close, 3)
ema10 = ta.ema(close, 10)
[macdLine, signalLine, _] = ta.macd(close, macdFast, macdSlow, macdSignal)
macdCond = macdLine > signalLine
macdCondShort = macdLine < signalLine
// === TIME (UTC-5 / Colombia) ===
horaCol = hour(time, "America/Bogota")
enHorarioPermitido = (horaCol >= 21 and horaCol < 23) // De 9:00 PM a 10:00 PM COL
// === SAILING CONDITIONS ===
esVelaVerde = close > open
esVelaRoja = close < open
// === ENTRY CONDITIONS ===
longCondition = ta.crossover(sma3, ema10) and macdCond and enHorarioPermitido and esVelaVerde
shortCondition = ta.crossunder(sma3, ema10) and macdCondShort and enHorarioPermitido and esVelaRoja
// === ENTRANCES ===
if longCondition
strategy.entry("Long", strategy.long)
if shortCondition
strategy.entry("Short", strategy.short)
// === EXITS with SL and TP of 10 pips ===
sl = slPips * pipSize
tp = tpPips * pipSize
if strategy.position_size > 0
strategy.exit("TP/SL Long", from_entry="Long", stop=strategy.position_avg_price - sl, limit=strategy.position_avg_price + tp)
if strategy.position_size < 0
strategy.exit("TP/SL Short", from_entry="Short", stop=strategy.position_avg_price + sl, limit=strategy.position_avg_price - tp)
// === VISUAL ===
plot(sma3, color=color.blue, title="SMA 3")
plot(ema10, color=color.orange, title="EMA 10")
Strategy parameters
The original address: Multi-Period Moving Average Crossover with MACD Momentum Confirmation Trading Strategy
Layering multiple MAs with MACD confirmation? That’s like calling in backup before making a move—smart and cautious! 😄 Looks like a solid way to avoid fakeouts. Appreciate the detailed breakdown!