전략 요약: 이 전략은 RSI 지표와 가격 사이의 관계를 기반으로, 동적으로 중지 중지 지점을 조정하여 거래 성과를 최적화합니다. 전략의 주요 아이디어는 RSI 지표의 과매매 과매매 특성을 활용하여 가격과 거래량 변화를 결합하여 RSI가 이탈하는 경우 적시에 중지하고 동적으로 중지 중지하여 위험을 제어하는 것입니다.
전략적 원칙:
전략적 장점:
전략적 위험:
최적화 방향:
결론: RSI 다이내믹 스톱포드 전략은 RSI 지표와 가격의 이탈 관계를 통해 거래량 변화를 합성하여 트렌드 초기에 신속한 스톱포드를 설정하고 동시에 트렌드 반전의 초기 수익을 잠금 할 수 있으며 전략의 회귀를 줄일 수 있으며 약간의 적응력을 가지고 있습니다. 그러나 불안정한 시장에서이 전략은 더 많은 거짓 신호가 발생할 수 있으므로 다른 기술 지표와 최적화된 스톱포드 값을 도입하여 전략의 성능을 향상시킬 필요가 있습니다. 또한 포지션 관리 및 변수 최적화는 전략의 안정성과 수익을 향상시키는 중요한 방향입니다.
/*backtest
start: 2024-03-11 00:00:00
end: 2024-03-15 09:00:00
period: 3m
basePeriod: 1m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=4
strategy("RMM_byMR", overlay=true)
// RSI uzunluğu girişi
rsiLength = input(14, title="RSI Uzunluğu")
// Tepe ve dip seviyeleri için girişler
overboughtLevel = input(70, title="Aşırı Alım Seviyesi")
oversoldLevel = input(30, title="Aşırı Satım Seviyesi")
// RSI hesaplama
rsiValue = rsi(close, rsiLength)
// Son tepe noktalarını tespit etme // Son dip noktalarını tespit etme
isPeak = rsiValue[2] > overboughtLevel and rsiValue[2] > rsiValue[1] and rsiValue[2] > rsiValue[3] and (rsiValue[1] > rsiValue or rsiValue[3] > rsiValue[4])
isBottom = rsiValue[2] < oversoldLevel and rsiValue[2] < rsiValue[1] and rsiValue[2] < rsiValue[3] and (rsiValue[1] < rsiValue or rsiValue[3] < rsiValue[4])
// Önceki tepe noktalarını tespit etme
prevPeak = valuewhen(isPeak, rsiValue[2], 1)
prevPeakHighPrice = valuewhen(isPeak, high[2], 1)
volumePeak = valuewhen(isPeak, volume[1]+volume[2]+volume[3], 1)
prevPeakBarIndex = valuewhen(isPeak, bar_index, 1)
// Önceki dip noktalarını tespit etme
prevBottom = valuewhen(isBottom, rsiValue[2], 1)
prevBottomLowPrice = valuewhen(isBottom, low[2], 1)
volumeBottom = valuewhen(isBottom, volume[1]+volume[2]+volume[3], 1)
prevBottomBarIndex = valuewhen(isBottom, bar_index, 1)
// Tepe noktasında satış sinyali
isSellSignal = prevPeakBarIndex > prevBottomBarIndex and isPeak and rsiValue[2] < prevPeak and high[2] > prevPeakHighPrice and (volume[1]+volume[2]+volume[3]) < volumePeak
isBuyTakeProfit = isPeak and ((rsiValue[2] < prevPeak and high[2] > prevPeakHighPrice) or (rsiValue[2] < prevPeak and (volume[1]+volume[2]+volume[3]) < volumePeak))
// Dip noktasında alış sinyali
isBuySignal = prevBottomBarIndex > prevPeakBarIndex and isBottom and rsiValue[2] > prevBottom and low[2] < prevBottomLowPrice and (volume[1]+volume[2]+volume[3]) < volumeBottom
isSellTakeProfit = isBottom and ((rsiValue[2] > prevBottom and low[2] < prevBottomLowPrice) or (rsiValue[2] > prevBottom and (volume[1]+volume[2]+volume[3]) < volumeBottom))
sellTakeProfit = valuewhen(isSellTakeProfit, low, 1)
buyTakeProfit = valuewhen(isBuyTakeProfit, high, 1)
// isSellTakeProfit koşulu için işaretlemeyi yap
plotshape(isSellTakeProfit, style=shape.triangleup, location=location.abovebar, color=color.green, size=size.small, title="Sell Take Profit", offset=-2)
// isBuyTakeProfit koşulu için işaretlemeyi yap
plotshape(isBuyTakeProfit, style=shape.triangledown, location=location.belowbar, color=color.red, size=size.small, title="Buy Take Profit", offset=-2)
buyComment = "Buy \n Rsi:" + tostring(round(rsiValue[2], 2)) + " \n Low:" + tostring(round(low[2],2)) + " \n Hacim:" + tostring(round(volume[1]+volume[2]+volume[3],2))
sellComment = "Sell \n Rsi:" + tostring(round(rsiValue[2], 2)) + " \n High:" + tostring(round(high[2],2)) + " \n Hacim:" + tostring(round(volume[1]+volume[2]+volume[3],2))
// Alış sinyali durumunda uzun pozisyon aç
if (isBuySignal)
strategy.entry("Buy", strategy.long, comment = buyComment )
strategy.exit("SL", "Buy", stop=close * 0.98)
// Satış sinyali durumunda kısa pozisyon aç
if (isSellSignal)
strategy.entry("Sell", strategy.short, comment = sellComment )
strategy.exit("SL","Sell", stop=close * 1.02)
// Limit değerini sonradan belirleme
// Alış sinyali durumunda uzun pozisyon kapat
if (isBuyTakeProfit)
strategy.close("Buy", comment="TP")
// Satış sinyali durumunda kısa pozisyon kapat
if (isSellTakeProfit)
strategy.close("Sell", comment="TP")