
이 전략은 수정된 헐 이동 평균 ((HMA) 와 일목적 균형 ((Ichimoku Kinko Hyo) 의 두 가지 기술 지표를 결합하여 시장의 중·장기 경향을 포착하기 위한 것이다. 전략의 주요 아이디어는 HMA와 일목적 균형의 기준선 ((Kijun Sen) 의 교차 신호를 이용하는 것이며, 동시에 일목적 균형의 구름 ((Kumo) 을 필터링 조건으로 결합하여 시장의 경향 방향을 판단하고 거래를 하는 것이다.
이 전략은 수정된 헐 이동 평균과 일회성 균형을 결합하여 비교적 안정적인 트렌드 추적 거래 시스템을 구축한다. 전략의 논리는 명확하고 구현하기 쉽지만 또한 장점이 있다. 그러나 전략의 성능은 여전히 시장 조건과 파라미터 설정에 영향을 받으며 추가적인 최적화와 개선이 필요합니다. 실제 응용에서는 특정 시장 특성과 위험 선호도에 따라 전략이 적절하게 조정되고 관리되어 더 나은 거래 결과를 얻을 수 있습니다.
/*backtest
start: 2024-04-20 00:00:00
end: 2024-04-27 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=4
strategy("Hull MA_X + Ichimoku Kinko Hyo Strategy", shorttitle="HMX+IKHS", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=100, pyramiding=0)
// Hull Moving Average Parameters
keh = input(12, title="Double HullMA")
n2ma = 2 * wma(close, round(keh/2)) - wma(close, keh)
sqn = round(sqrt(keh))
hullMA = wma(n2ma, sqn)
// Ichimoku Kinko Hyo Parameters
tenkanSenPeriods = input(9, title="Tenkan Sen Periods")
kijunSenPeriods = input(26, title="Kijun Sen Periods")
senkouSpanBPeriods = input(52, title="Senkou Span B Periods")
displacement = input(26, title="Displacement")
// Ichimoku Calculations
highestHigh = highest(high, max(tenkanSenPeriods, kijunSenPeriods))
lowestLow = lowest(low, max(tenkanSenPeriods, kijunSenPeriods))
tenkanSen = (highest(high, tenkanSenPeriods) + lowest(low, tenkanSenPeriods)) / 2
kijunSen = (highestHigh + lowestLow) / 2
senkouSpanA = ((tenkanSen + kijunSen) / 2)
senkouSpanB = (highest(high, senkouSpanBPeriods) + lowest(low, senkouSpanBPeriods)) / 2
// Plot Ichimoku
p1 = plot(tenkanSen, color=color.blue, title="Tenkan Sen")
p2 = plot(kijunSen, color=color.red, title="Kijun Sen")
p3 = plot(senkouSpanA, color=color.green, title="Senkou Span A", offset=displacement)
p4 = plot(senkouSpanB, color=color.orange, title="Senkou Span B", offset=displacement)
fill(p3, p4, color=color.gray, title="Kumo Shadow")
// Trading Logic
longCondition = crossover(hullMA, kijunSen) and close > senkouSpanA[displacement] and close > senkouSpanB[displacement]
shortCondition = crossunder(hullMA, kijunSen) and close < senkouSpanA[displacement] and close < senkouSpanB[displacement]
// Strategy Execution
if (longCondition)
strategy.entry("Long", strategy.long)
if (shortCondition)
strategy.entry("Short", strategy.short)
// Exit Logic - Exit if HullMA crosses KijunSen in the opposite direction
exitLongCondition = crossunder(hullMA, kijunSen)
exitShortCondition = crossover(hullMA, kijunSen)
if (exitLongCondition)
strategy.close("Long")
if (exitShortCondition)
strategy.close("Short")