동력 역전 거래 전략

저자:차오장
태그:

img

전반적인 설명

전략 논리

이점 분석

  • RSI의 능력으로 과반 구매/ 과반 판매를 판단하여 반전을 효과적으로 식별합니다.
  • 역전 효과 판단을 위해 마지막 신호 이후의 비율 변화를 표시합니다.
  • 사용자 정의 가능한 RSI 매개 변수는 다른 기간과 자산에 적합합니다.
  • 전략 개선을 위해 단독 또는 다른 지표와 결합하여 사용할 수 있습니다.

위험 분석

  • 실제 반전이 발생하지 않는 가짜 신호의 가능성
  • 허위 신호를 줄이기 위해 임계 구역은 적절하게 조정되어야 합니다.

최적화 방향

  • 단일 거래 손실을 제어하기 위해 스톱 손실을 추가하십시오.
  • 거짓 브레이크오웃을 피하기 위해 이동 평균 등과 결합합니다.
  • 수익성 있는 포지션의 기하급수적 성장을 위해 포지션 관리를 추가

요약


/*backtest
start: 2023-01-19 00:00:00
end: 2024-01-25 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=5
strategy("Improved RSI Strategy", overlay=true)

// Define RSI parameters
rsiLength = input(14, title="RSI Length")
rsiOversold = input(30, title="Oversold Threshold")
rsiOverbought = input(70, title="Overbought Threshold")

// Calculate RSI
rsiValue = ta.rsi(close, rsiLength)

// Define entry conditions
longCondition = ta.crossover(rsiValue, rsiOversold)
shortCondition = ta.crossunder(rsiValue, rsiOverbought)

// Plot RSI and thresholds
plot(rsiValue, title="RSI", color=color.blue)
hline(rsiOversold, title="Oversold Threshold", color=color.red)
hline(rsiOverbought, title="Overbought Threshold", color=color.green)

// Calculate percentage change since last signal
var float percentageChange = na
lastCloseValue = ta.valuewhen(longCondition or shortCondition, close, 1)

if longCondition or shortCondition
    percentageChange := (close - lastCloseValue) / lastCloseValue * 100

plot(percentageChange, color=color.blue, style=plot.style_histogram, linewidth=1, title="% Change since last signal")

// Execute strategy
if longCondition
    strategy.entry("RSI Long", strategy.long)
    
if shortCondition
    strategy.entry("RSI Short", strategy.short)

// Plot shapes and text for buy/sell signals
plotshape(series=longCondition, title="Buy Signal", location=location.belowbar, color=color.green, style=shape.labelup, text="BUY")
plotshape(series=shortCondition, title="Sell Signal", location=location.abovebar, color=color.red, style=shape.labeldown, text="SELL")


더 많은