
이 전략은 피보나치 수정 수준을 기반으로 한 고급 추세 추종 및 반전 거래 시스템입니다. 이는 가격 최고가와 최저가를 동적으로 식별하고, 7개의 주요 피보나치 수정 수준(0%, 23.6%, 38.2%, 50%, 61.8%, 78.6%, 100%)을 자동으로 계산하고 플로팅하여 이를 수행합니다. 잠재적인 지지 및 저항 수준을 식별합니다. 이 시스템은 양방향 거래 메커니즘을 채택하여 상승 추세에서는 매수 기회를 포착하고, 하락 추세에서는 공매도 기회를 포착할 수 있습니다.
전략의 핵심 논리는 다음과 같은 핵심 요소에 기초합니다.
이 전략은 고전적인 피보나치 수정 이론과 현대적인 양적 거래 기법을 결합하여 포괄적인 거래 시스템을 구축합니다. 이 방법의 장점은 주요 가격 수준을 자동으로 식별하고 명확한 거래 신호를 제공할 수 있다는 점입니다. 그러나 시장 환경이 전략 성과에 미치는 영향에도 주의를 기울여야 합니다. 제안된 최적화 방향을 통해 전략의 안정성과 수익성이 더욱 향상될 것으로 기대됩니다.
/*backtest
start: 2024-01-06 00:00:00
end: 2025-01-05 00:00:00
period: 3h
basePeriod: 3h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Fibonacci Retracement Strategy for Crypto", overlay=true)
// Input parameters
lookback = input.int(50, title="Lookback Period", minval=1)
plotLevels = input.bool(true, title="Plot Fibonacci Levels?")
compactLines = input.bool(true, title="Compact Fibonacci Lines?")
// Calculate highest high and lowest low for the lookback period
highestHigh = ta.highest(high, lookback)
lowestLow = ta.lowest(low, lookback)
// Fibonacci retracement levels
diff = highestHigh - lowestLow
level0 = highestHigh
level23_6 = highestHigh - diff * 0.236
level38_2 = highestHigh - diff * 0.382
level50 = highestHigh - diff * 0.5
level61_8 = highestHigh - diff * 0.618
level78_6 = highestHigh - diff * 0.786
level100 = lowestLow
// Plot Fibonacci levels (compact mode to make lines shorter)
// if plotLevels
// lineStyle = compactLines ? line.style_dashed : line.style_solid
// line.new(bar_index[lookback], level0, bar_index, level0, color=color.green, width=1, style=lineStyle)
// line.new(bar_index[lookback], level23_6, bar_index, level23_6, color=color.blue, width=1, style=lineStyle)
// line.new(bar_index[lookback], level38_2, bar_index, level38_2, color=color.blue, width=1, style=lineStyle)
// line.new(bar_index[lookback], level50, bar_index, level50, color=color.orange, width=1, style=lineStyle)
// line.new(bar_index[lookback], level61_8, bar_index, level61_8, color=color.red, width=1, style=lineStyle)
// line.new(bar_index[lookback], level78_6, bar_index, level78_6, color=color.red, width=1, style=lineStyle)
// line.new(bar_index[lookback], level100, bar_index, level100, color=color.green, width=1, style=lineStyle)
// Long trade: Buy when price crosses above 61.8% retracement
longCondition = ta.crossover(close, level61_8)
if longCondition
strategy.entry("Long", strategy.long, alert_message="Price bounced off Fibonacci level - Enter Long")
// Short trade: Sell when price crosses below 38.2% retracement
shortCondition = ta.crossunder(close, level38_2)
if shortCondition
strategy.entry("Short", strategy.short, alert_message="Price crossed below Fibonacci level - Enter Short")
// Exit conditions
exitLong = close >= level23_6
if exitLong
strategy.close("Long", alert_message="Price reached 23.6% Fibonacci level - Exit Long")
exitShort = close <= level78_6
if exitShort
strategy.close("Short", alert_message="Price reached 78.6% Fibonacci level - Exit Short")