
다중 시간 프레임 MACD 전략 (Multi Timeframe MACD Strategy) 은 MACD 지표를 사용하여 여러 시간 프레임에 걸쳐 트렌드 추적을 수행하는 양적 거래 전략이다. 이 전략은 MACD 지표를 다른 시간 주기 (분기 3분, 5분, 15분, 30분) 에 계산하여 서로 다른 주기 사이의 가격 움직임이 일치하는지 판단하여 거래 신호를 발산합니다.
이 전략의 핵심 논리는 MACD 지표가 여러 시간 프레임에 대한 교차 상황을 계산하는 것입니다. 3분, 5분, 15분, 30분). 먼저 MACD 지표를 각 시간 프레임에 계산하여 MACD 지표에 따라 해당 시간 프레임의 가격 움직임을 판단합니다.
시간 프레임을 통해 트렌드를 판단하는 방식으로, 단기 시장 소음을 효과적으로 제거하여 거래 신호를 더 신뢰할 수 있습니다.
이 전략은 다음과 같은 장점을 가지고 있습니다.
이 전략에는 다음과 같은 위험도 있습니다.
대응방법:
이 전략은 다음의 몇 가지 측면에서 계속 개선될 수 있습니다.
다중 시간 프레임 MACD 전략은 MACD 지표의 트렌드 판단 기능을 활용하여 시간 프레임 간 가격 움직임 검사를 구현하고, 효과적으로 소음을 필터링하고, 신호 품질을 향상시킵니다. 이 전략은 매개 변수 조정 및 규칙 최적화를 통해 다양한 품종 및 실무 환경에 유연하게 적응할 수 있으며, 강력한 실용성을 가지고 있습니다.
/*backtest
start: 2023-10-28 00:00:00
end: 2023-11-27 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=2
strategy("[RichG] Easy MTF Strategy", overlay=false)
TF_1_time = input("3", "Timeframe 1")
TF_2_time = input("5", "Timeframe 2")
TF_3_time = input("15", "Timeframe 3")
TF_4_time = input("30", "Timeframe 4")
fastLen = input(title="Fast Length", defval=12)
slowLen = input(title="Slow Length", defval=26)
sigLen = input(title="Signal Length", defval=9)
[macdLine, signalLine, _] = macd(close, fastLen, slowLen, sigLen)
width = 5
upcolor = green
downcolor = red
neutralcolor = blue
linestyle = line
TF_1 = request.security(syminfo.tickerid, TF_1_time, open) < request.security(syminfo.tickerid, TF_1_time, close) ? true:false
TF_1_color = TF_1 ? upcolor:downcolor
TF_2 = request.security(syminfo.tickerid, TF_2_time, open) < request.security(syminfo.tickerid, TF_2_time, close) ? true:false
TF_2_color = TF_2 ? upcolor:downcolor
TF_3 = request.security(syminfo.tickerid, TF_3_time, open) < request.security(syminfo.tickerid, TF_3_time, close) ? true:false
TF_3_color = TF_3 ? upcolor:downcolor
TF_4 = request.security(syminfo.tickerid, TF_4_time, open) < request.security(syminfo.tickerid, TF_4_time, close) ? true:false
TF_4_color = TF_4 ? upcolor:downcolor
TF_global = TF_1 and TF_2 and TF_3 and TF_4
TF_global_bear = TF_1 == false and TF_2 == false and TF_3 == false and TF_4 == false
TF_global_color = TF_global ? green : TF_global_bear ? red : white
TF_trigger_width = TF_global ? 6 : width
plot(1, style=linestyle, linewidth=width, color=TF_1_color)
plot(5, style=linestyle, linewidth=width, color=TF_2_color)
plot(10, style=linestyle, linewidth=width, color=TF_3_color)
plot(15, style=linestyle, linewidth=width, color=TF_4_color)
plot(25, style=linestyle, linewidth=4, color=TF_global_color)
exitCondition_Long = TF_global_bear
exitCondition_Short = TF_global
longCondition = TF_global
if (longCondition)
strategy.entry("MTF_Long", strategy.long)
shortCondition = TF_global_bear
if (shortCondition)
strategy.entry("MTF_Short", strategy.short)
strategy.close("MTF_Long", when=exitCondition_Long)
strategy.close("MTF_Short", when=exitCondition_Short)