스토카스틱 RSI 거래 전략

저자:차오장, 날짜: 2023-09-11 11:57:39
태그:

스토카스틱 RSI 거래 전략

이 전략은 스토카스틱 RSI 지표의 크로스오버 신호를 기반으로 거래됩니다.

특정 입국 규칙은 다음과 같습니다.

  • 스토카스틱 RSI가 30을 넘을 때 장면을 입력합니다.

  • 스토카스틱 RSI가 70 이하로 넘어가면 단축

추가 입력 필터:

  • 롱은 21주기 SMA보다 9주기 SMA를 필요로 합니다.

  • 단편 상품은 9주기 SMA가 21주기 SMA보다 낮아야 합니다.

  • VWAP 이하의 롱, VWAP 이하의 쇼트

이 전략은 위험 관리를 위해 스톱 로스를 사용하고 수익을 취합니다.

  • 로그와 쇼트 모두에 20 틱으로 설정된 스톱 로스

  • 이윤을 25개의 틱으로 설정합니다.

주요 장점은 잘못된 신호를 줄이기 위해 SMA 및 VWAP 필터와 결합한 과잉 구매 / 과잉 판매 지역을 식별하기 위해 스토카스틱 RSI를 사용하는 것입니다. 그러나이 전략은 범위 제한 시장보다 트렌딩에서 더 잘 작동합니다.


/*backtest
start: 2023-09-03 00:00:00
end: 2023-09-10 00:00:00
period: 1m
basePeriod: 1m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © thedoggwalker

//@version=4
strategy("Stochastic RSI Strategy", overlay=true)

// Stochastic RSI
length = input(14, title="Length")
src = input(close, title="Source")
smoothK = input(3, title="K")
smoothD = input(3, title="D")

rsiValue = rsi(src, length)
highestRSI = highest(rsiValue, length)
lowestRSI = lowest(rsiValue, length)
k = (rsiValue - lowestRSI) / (highestRSI - lowestRSI) * 100
d = sma(k, smoothD)

// Moving averages
maShort = sma(close, 9)
maLong = sma(close, 21)

// Spread between moving averages
spread = maShort - maLong

// VWAP
vwapValue = vwap(hlc3)

// Entry conditions
longCondition = crossover(k, 30) and spread > 0 and close < vwapValue
shortCondition = crossunder(k, 70) and spread < 0 and close > vwapValue

// Entry orders
if (longCondition)
    strategy.entry("Long", strategy.long)

if (shortCondition)
    strategy.entry("Short", strategy.short)

// Exit orders
// longStopLoss = close - 20 * syminfo.mintick
// longTakeProfit = close + 25 * syminfo.mintick
// strategy.exit("Exit Long", "Long", stop=longStopLoss, limit=longTakeProfit)

// shortStopLoss = close + 20 * syminfo.mintick
// shortTakeProfit = close - 25 * syminfo.mintick
// strategy.exit("Exit Short", "Short", stop=shortStopLoss, limit=shortTakeProfit)

더 많은