This strategy uses double moving averages configured on the daily and hourly charts to determine the major trend direction on the daily chart and enter and exit trades on the hourly chart. It goes long when the daily chart indicates an upward trend and the hourly chart sees a golden cross, and closes the position when the daily chart shows an upward trend but the hourly chart sees a death cross. This configuration allows us to capture short-to-medium-term opportunities while avoiding the impacts of short-term market fluctuations.
The main advantages of this dual timeframe configuration are:
Main risks of this strategy are:
These risks can be mitigated by widening stop loss levels, optimizing parameters, or adding filters.
This strategy can be further optimized by:
This strategy leverages a dual timeframe analysis to capture short-to-medium-term opportunities within major trends. The double EMA configuration filters out noise. This provides solid profitability while effectively managing risk. Further optimizations can make the strategy more robust and efficient for wider application.
/*backtest start: 2022-12-08 00:00:00 end: 2023-12-14 00:00:00 period: 1d basePeriod: 1h exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}] */ //@version=5 strategy("Dual Time Frame Strategy", overlay=true) // Define Daily Time Frame Inputs lenShort = input.int(20, title="Short EMA Length (Daily)", minval=1) lenLong = input.int(50, title="Long EMA Length (Daily)", minval=1) // Calculate EMAs on Daily Time Frame emaShort_D = ta.ema(close, lenShort) emaLong_D = ta.ema(close, lenLong) // Define Hourly Time Frame Inputs lenShort_H = input.int(10, title="Short EMA Length (Hourly)", minval=1) lenLong_H = input.int(30, title="Long EMA Length (Hourly)", minval=1) // Calculate EMAs on Hourly Time Frame emaShort_H = ta.ema(close, lenShort_H) emaLong_H = ta.ema(close, lenLong_H) // Daily Time Frame Condition dailyUpTrend = emaShort_D > emaLong_D // Hourly Time Frame Condition hourlyBuy = ta.crossover(emaShort_H, emaLong_H) hourlySell = ta.crossunder(emaShort_H, emaLong_H) // Strategy Entry and Exit Conditions if (dailyUpTrend and hourlyBuy) strategy.entry("Buy", strategy.long) if (dailyUpTrend and hourlySell) strategy.close("Buy") // Plot EMAs for Daily and Hourly Time Frames plot(emaShort_D, color=color.blue, title="Short EMA (Daily)") plot(emaLong_D, color=color.red, title="Long EMA (Daily)") plot(emaShort_H, color=color.green, title="Short EMA (Hourly)") plot(emaLong_H, color=color.orange, title="Long EMA (Hourly)")