
이 전략은 쌍평균선과 무작위 RSI 지표를 결합한 트렌드 추적 거래 시스템이다. 21주기 및 55주기 간단한 이동 평균을 통해 시장의 흐름을 판단하고, 무작위 RSI의 오버 바이 오버 소매 영역을 이용한 최적의 입점과 출구 지점을 찾고, 트렌드 거래에 대한 최적화를 달성한다. 전략은 상승 추세를 확인하는 것을 기반으로, 오버 소매 영역에서 구매 기회를 찾고, 오버 소매 영역에서 판매 기회를 찾는다.
이 전략은 다음과 같은 핵심 논리를 가지고 있습니다.
이 전략은 고전적인 기술 지표와 결합하여 전체적인 트렌드 추적 거래 시스템을 구축한다. 전략은 단순하고 직관적이면서도 여러 신호를 확인함으로써 신뢰성을 높인다. 합리적인 매개 변수 최적화 및 위험 관리로 이 전략은 좋은 실용적 가치를 가지고 있다. 거래자는 실전 사용 전에 충분한 피드백을 수행하고 특정 시장 특성에 따라 매개 변수를 조정하는 것이 좋습니다.
/*backtest
start: 2022-02-11 00:00:00
end: 2025-02-08 08:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=6
strategy("SMA & Stoch RSI Buy Strategy with K > 80 Exit", overlay=true)
// Input parameters for the SMAs
sma21Length = input(21, title="21 SMA Length")
sma55Length = input(55, title="55 SMA Length")
// Input parameters for the Stochastic RSI
stochRsiLength = input(14, title="Stoch RSI Length")
stochRsiK = input(3, title="Stoch RSI %K Smoothing")
stochRsiD = input(3, title="Stoch RSI %D Smoothing")
// Calculate the SMAs
sma21 = ta.sma(close, sma21Length)
sma55 = ta.sma(close, sma55Length)
// Calculate the Stochastic RSI
rsiValue = ta.rsi(close, stochRsiLength)
stochRsi = ta.stoch(rsiValue, rsiValue, rsiValue, stochRsiLength)
stochRsiKLine = ta.sma(stochRsi, stochRsiK)
stochRsiDLine = ta.sma(stochRsiKLine, stochRsiD)
// Buy signal conditions
smaCondition = sma21 > sma55
stochRsiCondition = ta.crossover(stochRsiKLine, stochRsiDLine) and stochRsiKLine < 20
// Entry condition
buySignal = smaCondition and stochRsiCondition
// Exit condition: Stochastic RSI K > 80 and K crosses below D
exitCondition = ta.crossunder(stochRsiKLine, stochRsiDLine) and stochRsiKLine > 80
// Execute buy order on signal
if (buySignal)
strategy.entry("Buy", strategy.long)
// Exit the trade on the modified exit condition
if (exitCondition)
strategy.close("Buy")
// Plot the SMAs
plot(sma21, color=color.blue, title="21 SMA")
plot(sma55, color=color.red, title="55 SMA")
// Plot Stochastic RSI for reference (not overlayed)
hline(20, "Stoch RSI 20", color=color.gray, linestyle=hline.style_dotted)
hline(80, "Stoch RSI 80", color=color.gray, linestyle=hline.style_dotted)
plot(stochRsiKLine, title="%K Line", color=color.green)
plot(stochRsiDLine, title="%D Line", color=color.red)