
이 전략은 부린 띠 지표에 기반한 4시간 레벨의 정량 거래 시스템으로, 트렌드 브레이크와 평균값 회귀를 결합한 거래 철학이다. 이 전략은 부린 띠의 하향 돌파를 통해 시장 동력을 포착하며, 가격 회귀 평균값의 특성을 활용하여 수익을 창출하고, 스톱 로즈로 위험을 제어한다. 이 전략은 3배의 레버리지를 사용하며, 수익을 보장하면서도 충분히 위험을 통제한다.
전략의 핵심 논리는 다음과 같은 핵심 요소에 기초합니다.
이것은 부린띠 지표의 트렌드 따라와 평균 회귀 특성을 결합한 전략으로, 엄격한 포지션 개시 조건과 위험 제어 조치를 통해, 트렌드 시장과 흔들림 시장에서 안정적인 수익을 얻을 수 있는 목표를 달성한다. 전략의 핵심 장점은 명확한 거래 논리와 완벽한 위험 제어 시스템이지만, 전략의 안정성과 수익 능력을 더욱 향상시키기 위해 레버리지 사용과 시장 환경 판단 등의 측면에서 최적화에 주의를 기울여야 한다.
/*backtest
start: 2019-12-23 08:00:00
end: 2024-12-10 08:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Bollinger 4H Follow", overlay=true, initial_capital=300, commission_type=strategy.commission.percent, commission_value=0.04)
// StartYear = input(2022,"Backtest Start Year")
// StartMonth = input(1,"Backtest Start Month")
// StartDay = input(1,"Backtest Start Day")
// testStart = timestamp(StartYear,StartMonth,StartDay,0,0)
// EndYear = input(2023,"Backtest End Year")
// EndMonth = input(12,"Backtest End Month")
// EndDay = input(31,"Backtest End Day")
// testEnd = timestamp(EndYear,EndMonth,EndDay,0,0)
lev = 3
// Input parameters
length = input.int(20, title="Bollinger Band Length")
mult = input.float(2.0, title="Bollinger Band Multiplier")
// Bollinger Bands calculation
basis = ta.sma(close, length)
upperBand = basis + mult * ta.stdev(close, length)
lowerBand = basis - mult * ta.stdev(close, length)
// Conditions for Open Long
openLongCondition = strategy.position_size == 0 and close > open and (close + open) / 2 > upperBand
// Conditions for Open Short
openShortCondition = strategy.position_size == 0 and close < open and (close + open) / 2 < lowerBand
// Conditions for Close Long
closeLongCondition = strategy.position_size > 0 and strategy.position_size > 0 and (close < upperBand and open < upperBand and close < open)
// Conditions for Close Short
closeShortCondition = strategy.position_size < 0 and strategy.position_size < 0 and (close > lowerBand and open > lowerBand and close > open)
// Long entry
if openLongCondition
strategy.entry("Long", strategy.long, qty=strategy.equity * lev / close)
strategy.exit("Long SL", from_entry="Long", stop=low) // Set Stop-Loss
// Short entry
if openShortCondition
strategy.entry("Short", strategy.short, qty=strategy.equity * lev / close)
strategy.exit("Short SL", from_entry="Short", stop=high) // Set Stop-Loss
// Long exit
if closeLongCondition
strategy.close("Long", comment = "TP")
// Short exit
if closeShortCondition
strategy.close("Short", comment = "TP")
// Plot Bollinger Bands
plot(upperBand, color=color.yellow, title="Upper Band")
plot(lowerBand, color=color.yellow, title="Lower Band")