
이 글은 주로 상대적으로 약한 지수 ((RSI) 와 피보나치 회귀점을 결합하여 거래하는 전략을 설명한다. 이 전략은 먼저 특정 주기 동안의 역사적 가격 동력에 따라 중요한 피보나치 회귀점을 계산하고, RSI 지표와 결합하여 시장이 과매매를 초과했는지 판단하고, 회귀점 근처에서 거래 신호를 발송한다.
이 전략은 다음과 같은 원칙에 기초하고 있습니다.
특정 주기 (예를 들어, 200 K 선) 의 가격 데이터를 사용하여, 그 주기 (예를 들어, 0.764) 의 가격의 평균값, 표준 차, 그리고 중요한 피보나치 리버치 지점을 계산한다.
가격이 상위 또는 하위 회귀 지점에 가까워지면 RSI를 사용하여 회귀 지점에 과매매 현상이 있는지 여부를 판단합니다.
RSI 지표가 과매매 또는 과매매 신호를 표시하는 경우, 회전 지점 근처에서 더 많은 또는 더 적은 신호를 발산합니다.
그리고 정지 및 중지 수준을 설정하고, 설정된 가격을 초과하거나 중지 조건을 유발할 때 포지션을 청산한다.
이 전략은 거래의 시기를 결정하는 기본 과정입니다.
RSI 또는 피보나치율을 단독으로 사용하는 거래에 비해, 이 조합 전략은 다음과 같은 장점을 가지고 있다:
이중 지표 필터링은 가짜 신호를 줄이고 신호 품질을 향상시킵니다.
반전 지점 근처에서 반전 거래를 하는 것은 비교적 고전적인 기술 분석 방법이다.
단편 거래의 최대 손실을 효과적으로 제어할 수 있는 스톱로스 스톱을 설정합니다.
매개 변수 최적화, 지표 매개 변수 및 회전 위치 설정을 조정하여 다른 주기 및 품종에 적응할 수 있다.
이 전략에는 위험도 있습니다.
핵심 회귀 지점 근처에서 다시 튀어나올 확률은 100%가 아닙니다. 가격 실체 판단과 결합해야 합니다.
단일 주기 RSI는 사멸 반발의 가짜 신호를 생성할 수 있으며, 다중 주기 검증을 고려할 수 있다.
스톱포인트가 너무 느슨하게 설정되어 손실을 증가시킬 수 있습니다.
지표의 가격이 급격하게 변동할 때, 스톱로즈는 뚫릴 수 있으며, 스톱로즈 포인트를 완화시키는 것을 고려할 필요가 있다.
위 위험은 매개 변수 조정, 최적화 지표 결합 등의 방법으로 제어할 수 있다.
이 전략이 더 개선될 수 있는 부분은 다음과 같습니다.
거래량 지표에 대한 검증을 늘리고, 낮은 양의 가짜 돌파구를 피하십시오.
브린 벨트 지표를 고려하여, 벨트 모양의 돌파가 있을 때 신호를 발산한다.
기계 학습 또는 신경망 모델을 구축하여 고품질 거래 기회를 자동으로 식별합니다.
유전 알고리즘과 같은 방법을 사용하여 자동으로 매개 변수를 최적화하고, 스톱 스톱 포인트를 조정한다.
이 글은 RSI와 피보나치 리버치의 전환을 판단하는 양적 거래 전략을 자세히 설명한다. 이 전략은 쌍방향 지표 분석과 고전 기술 전략을 통합하여 위험을 제어하는 전제 하에서 거래 신호의 품질을 향상시킵니다. 매개 변수 조정과 모델 최적화가 진행됨에 따라 전략 효과는 더욱 향상될 수 있습니다.
/*backtest
start: 2023-11-26 00:00:00
end: 2023-12-26 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=4
strategy(title="Gab Fib + RSI", overlay=true, default_qty_type=strategy.cash, default_qty_value=100000, initial_capital=1000, currency=currency.USD, commission_type=strategy.commission.cash_per_order, commission_value=4)
// Inputs
timeFilter = year >= 2000
// Stop Loss
stop_loss = input(title="SL in % of Instrum. i.e 1.5%=150pips", minval=0, step=0.1, defval=1.5) /100
// RSI Inputs
len = input(title="[RSI] Length", minval=0, step=1, defval=14)
overSold = input(title="[RSI] Over Sold %", defval=30)
overBought = input(title="[RSI] Over Bought %", defval=70)
// Fibonacci Levels
length = input(title="[Fibonacci] Length", defval=200, minval=1)
src = input(hlc3, title="[Fibonacci] Source")
mult = input(title="[Fibonacci] Multiplier", defval=3.0, minval=0.001, maxval=50)
level = input(title="[Fibonacci] Level", defval=764)
// Calculate Fibonacci
basis = vwma(src, length)
dev = mult * stdev(src, length)
fu764= basis + (0.001*level*dev)
fu1= basis + (1*dev)
fd764= basis - (0.001*level*dev)
fd1= basis - (1*dev)
// Calculate RSI
vrsi = rsi(close, len)
// Calculate the Targets
targetUp = fd764
targetDown = fu764
// Actual Targets
bought = strategy.position_size[0] > strategy.position_size[1]
exit_long = valuewhen(bought, targetUp, 0)
sold = strategy.position_size[0] < strategy.position_size[1]
exit_short = valuewhen(sold, targetDown, 0)
// Calculate Stop Losses
sl_long = close * (1-stop_loss)
sl_short = close * (1+stop_loss)
// Conditions to Open Trades
openLong = low < fd1 and crossover(vrsi[1], overSold)
openShort = high > fu1 and crossunder(vrsi[1], overBought)
// Conditions to Close Trades
closeLong = high > exit_long or sl_long
closeShort = low < exit_short or sl_short
//Rounding to MinTick value
roundtargetUp = round_to_mintick(targetUp)
roundtargetDown = round_to_mintick(targetDown)
roundsllong = round_to_mintick(sl_long)
roundslshort = round_to_mintick(sl_short)
// Plots
plot(basis, color=color.blue, linewidth=2, title="[Fibonacci Level] Basis")
plot(fu764, color=color.white, linewidth=1, title="[Fibonacci Level] Short Target")
plot(fu1, color=color.red, linewidth=2, title="[Fibonacci Level] Top")
plot(fd764, color=color.white, linewidth=1, title="[Fibonacci Level] Long Target")
plot(fd1, color=color.green, linewidth=2, title="[Fibonacci Level] Bottom")
// Strategy Orders
if timeFilter
// Entry Orders
strategy.entry(id="buy", long=true, when=openLong and high < targetUp, limit=close, alert_message="buy,"+tostring(syminfo.ticker)+",tp="+tostring(roundtargetUp)+",sl="+tostring(roundsllong))
strategy.entry(id="sell", long=false, when=openShort and low > targetDown, limit=close, alert_message="sell,"+tostring(syminfo.ticker)+",tp="+tostring(roundtargetDown)+",sl="+tostring(roundslshort))
// Exit Orders
strategy.exit(id="closelong", when=closeLong and strategy.position_size > 0, limit=exit_long, stop=sl_long, alert_message="closelong,"+tostring(syminfo.ticker))
strategy.exit(id="closeshort", when=closeShort and strategy.position_size < 0, limit=exit_short, stop=sl_short, alert_message="closeshort,"+tostring(syminfo.ticker))