
이 전략은 피보나치 회수 및 연장 수준을 기반으로 한 복합형 정량 거래 시스템이며, EMA 평준 트렌드 판단과 결합되어 있습니다. 전략은 시장의 중요한 지지 저항 지점을 식별하여 트렌드 신호와 결합하여 거래합니다. 시스템은 20주기 및 50주기 EMA 평준을 사용하여 시장의 추세를 판단하고, 피보나치 회수 수준을 기반으로 최적의 거래 기회를 찾습니다.
전략의 핵심 논리는 세 가지 주요 부분으로 구성됩니다. 첫째, 가격 변동 범위를 결정하기 위해 10 주기의 최고 가격과 최저 가격을 계산합니다. 두 번째는 가격 변동 범위를 결정하기 위해 10 주기의 최고 가격과 최저 가격을 계산합니다. 두 번째는 가격 변동 범위를 결정하기 위해 가격 변동 범위를 결정하기 위해 가격 변동 범위를 결정합니다. 그 다음은 가격 변동 범위를 결정하기 위해 가격 변동 범위를 결정하기 위해 가격 변동 범위를 결정합니다.
이 전략은 고전적인 기술 분석 도구를 결합하여 비교적 완전한 거래 시스템을 구축한다. 최적화가 필요한 부분이 있지만 전체적인 프레임워크는 시장에 잘 적응한다. 지속적인 최적화와 개선으로 이 전략은 실제 거래에서 더 나은 성능을 기대한다. 실물 거래 전에 충분한 역사 데이터 재검토와 변수 최적화가 권장된다.
/*backtest
start: 2019-12-23 08:00:00
end: 2024-11-11 00:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Fibonacci Retracement and Extension Strategy", overlay=true)
// Define the Fibonacci levels for retracement and extension
fibRetracementLevels = array.new_float(5)
array.set(fibRetracementLevels, 0, 0.236)
array.set(fibRetracementLevels, 1, 0.382)
array.set(fibRetracementLevels, 2, 0.5)
array.set(fibRetracementLevels, 3, 0.618)
array.set(fibRetracementLevels, 4, 0.786)
fibExtensionLevels = array.new_float(5)
array.set(fibExtensionLevels, 0, 1.618)
array.set(fibExtensionLevels, 1, 2.618)
array.set(fibExtensionLevels, 2, 3.618)
array.set(fibExtensionLevels, 3, 4.236)
array.set(fibExtensionLevels, 4, 5.618)
// Calculate the high and low prices for the last 10 bars
highPrice = ta.highest(high, 10)
lowPrice = ta.lowest(low, 10)
// Calculate the Fibonacci retracement levels
fibRetracement = array.new_float(5)
for i = 0 to 4
array.set(fibRetracement, i, highPrice - (highPrice - lowPrice) * array.get(fibRetracementLevels, i))
// Calculate the trend using the Exponential Moving Average (EMA)
shortEMA = ta.ema(close, 20)
longEMA = ta.ema(close, 50)
// Define the trend conditions
isUptrend = shortEMA > longEMA
isDowntrend = shortEMA < longEMA
// Generate buy and sell signals
var float lastFibRetracementLevel = na
var float lastFibExtensionLevel = na
// Buy condition: price crosses above the highest retracement level
if (isUptrend)
for i = 0 to 4
if (close > array.get(fibRetracement, i))
lastFibRetracementLevel := array.get(fibRetracement, i)
strategy.entry("Buy", strategy.long)
// Sell condition: price crosses below the lowest retracement level
if (isDowntrend)
for i = 0 to 4
if (close < array.get(fibRetracement, i))
lastFibRetracementLevel := array.get(fibRetracement, i)
strategy.entry("Sell", strategy.short)
// Plotting the Fibonacci levels on the chart
// for i = 0 to 4
// line.new(bar_index[10], array.get(fibRetracement, i), bar_index, array.get(fibRetracement, i), color=color.new(color.blue, 70), width=1)
// Plot the EMAs
plot(shortEMA, color=color.red, title="Short EMA")
plot(longEMA, color=color.blue, title="Long EMA")