
이는 돈키안 채널을 기반으로 한 모멘텀 돌파 거래 전략으로, 가격 돌파와 거래량 확인이라는 두 가지 핵심 조건을 결합한 것입니다. 이 전략은 가격이 사전 정의된 가격 범위를 벗어나 거래량 지원이 필요한지 여부를 관찰하여 시장의 상승 추세를 포착합니다. 이 전략은 히스테리시스 매개변수를 사용하여 채널의 안정성을 향상시키고 유연한 종료 조건 선택을 제공합니다.
전략의 핵심 논리는 다음과 같은 핵심 부분으로 구성됩니다.
이는 잘 설계되고 논리적으로 명확한 추세 추종 전략입니다. 가격 돌파구와 거래량 확인을 결합함으로써 이 전략은 유연성을 유지하는 동시에 신뢰성도 보장합니다. 전략의 매개변수적 설계는 매우 적응성이 뛰어나지만, 투자자가 특정 시장 상황에 맞춰 전략을 최적화하고 조정해야 합니다. 전반적으로 이는 추가적인 최적화와 연습이 필요한 전략적 프레임워크입니다.
/*backtest
start: 2019-12-23 08:00:00
end: 2025-01-15 08:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT","balance":49999}]
*/
//@version=6
strategy("Breakout Strategy", overlay=true, calc_on_every_tick=false, initial_capital=10000, default_qty_type=strategy.percent_of_equity, default_qty_value=100, commission_type=strategy.commission.percent, commission_value=0.1, pyramiding=1, fill_orders_on_standard_ohlc=true)
// Input Parameters
start_date = input(timestamp("2018-01-01 00:00"), "Start Date")
end_date = input(timestamp("2060-01-01 00:00"), "End Date")
in_time_range = true
length = input.int(27, title="Donchian Channel Length", minval=1, tooltip="Number of bars used to calculate the Donchian channel.")
lag = input.int(10, title="Donchian Channel Offset", minval=1, tooltip = "Offset to delay the Donchian channel, enhancing stability.")
volume_mult = input.float(1.4, title="Volume Multiplier", minval=0.1, step=0.1, tooltip="Multiplier for the average volume to filter breakout conditions.")
closing_condition = input.string("Mid", title="Trade Closing Band", options= ["Upper","Lower","Mid"], tooltip = "Donchian Channel Band to use for exiting trades: Upper, Lower, or Middle.") //
// Donchian Channel (Lagged for Stability)
upper_band = ta.highest(high[lag], length)
lower_band = ta.lowest(low[lag], length)
middle_band = (upper_band + lower_band) / 2
plot(upper_band, color=color.blue, title="Upper Band (Lagged)")
plot(middle_band, color=color.orange, title="Middle Band")
plot(lower_band, color=color.blue, title="Lower Band (Lagged)")
// Volume Filter
avg_volume = ta.sma(volume, length)
volume_condition = volume > avg_volume * volume_mult
// Long Breakout Condition
long_condition = close > upper_band and volume_condition
bool reverse_exit_condition = false
// Exit Condition (Close below the middle line)
if closing_condition == "Lower"
reverse_exit_condition := close < lower_band
else if closing_condition == "Upper"
reverse_exit_condition := close < upper_band
else
reverse_exit_condition := close < middle_band
// Long Strategy: Entry and Exit
if in_time_range and long_condition
strategy.entry("Breakout Long", strategy.long)
// Exit on Reverse Signal
if in_time_range and reverse_exit_condition
strategy.close("Breakout Long", comment="Reverse Exit")