VWAP-RSI 크로스오더 BTC 쇼트 전략 과잉 판매

저자:차오장, 날짜: 2023-12-29 14:12:54
태그:

img

전반적인 설명

이것은 VWAP의 RSI 지표에 기반한 시간 프레임에 걸쳐 BTC 단기 전략이다. VWAP 곡선을 얻기 위해 각 촛불의 볼륨 가중 평균 가격 (VWAP) 을 계산하고, RSI 지표를 곡선에 적용합니다. RSI 지표가 과잉 구매 구역에서 아래로 넘어가면 BTC에 단가가됩니다.

전략 논리

  1. VWAP 곡선을 얻기 위해 각 촛불의 VWAP를 계산
  2. RSI 지표를 VWAP 곡선에 적용합니다. 길이 20 일, 85에서 과잉 구매 수준, 30에서 과잉 판매 수준
  3. RSI가 과잉 매수 지역 (85) 에서 과잉 판매 지역 (30) 으로 넘어갈 때, 단기 포지션을 열어야 합니다.
  4. 28개의 촛불을 보유한 후 포지션을 닫거나 RSI가 다시 과판 라인을 (30) 넘으면

이점 분석

  1. 실제 거래 가격을 반영하기 위해 단순한 폐쇄 가격 대신 VWAP를 사용하십시오.
  2. 높은 가격에 구매하고 낮은 가격에 판매하는 것을 피하기 위해 RSI를 사용하여 과반 구매/ 과반 판매 상태를 식별합니다.
  3. 덫에 걸리지 않기 위해 시간 틀을 넘나들며 거래
  4. 28개의 촛불 스톱 로스로 제어 가능한 위험

위험 과 해결책

  1. 블랙 스완 사건으로 인해 가격이 급격히 상승하고 손실을 막을 수 없습니다.
    • 덫에 걸리는 위험을 줄이기 위해 시간 프레임 상거래를 채택
  2. 부적절한 매개 변수 설정, 쉽게 기회를 놓치기
    • RSI 매개 변수 및 과잉 구매/ 과잉 판매 수준을 테스트하고 최적화합니다.
  3. RSI가 과판 구역으로 넘을 수 없습니다.
    • 다른 지표와 결합하여 추세를 결정하고 매개 변수를 유연하게 조정합니다.

최적화 방향

  1. 최적을 찾기 위해 더 많은 매개 변수 조합을 테스트
  2. MACD, KD 등과 결합하여 과반 구매/ 과반 판매 상태를 판단합니다
  3. 다른 자산에 대한 테스트 매개 변수 설정
  4. 스톱 손실 메커니즘을 최적화하고 변동성에 따라 스톱 손실 범위를 설정합니다.

요약

이 전략은 VWAP와 RSI의 조합으로 BTC 과잉 구매/ 과잉 판매 상태를 식별합니다. 시간 프레임에 걸쳐 거래함으로써 위험을 효과적으로 제어 할 수 있습니다. 전략 논리는 명확하고 이해하기 쉽습니다. 라이브 거래에 대한 추가 테스트와 최적화를 가치가 있습니다.


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


//@version=4

strategy("Soran Strategy 2 - SHORT SIGNALS", pyramiding=1, initial_capital=1000, default_qty_type=strategy.percent_of_equity, default_qty_value=50, overlay=false)


// ----------------- Inputs ----------------- //

reso = input(title="Resolution", type=input.resolution, defval="")
length = input(20, title="RSI Length", type=input.integer)
ovrsld = input(30, "RSI Oversold level", type=input.float)
ovrbgt = input(85, "RSI Overbought level", type=input.float)
lateleave = input(28, "Number of candles", type=input.integer)
// lateleave : numbers of bars in overbought/oversold zones where the position is closed. The position is closed when this number is reached or when the zone is left (the first condition).

// best parameters BTCUSDTPERP M15 : 20 / 30 / 85 / 28


stratbull = input(title="Enter longs ?", type = input.bool, defval=true)
stratbear = input(title="Enter shorts ?", type = input.bool, defval=true)

stratyear = input(2020, title = "Strategy Start Year")
stratmonth = input(1, title = "Strategy Start Month")
stratday = input(1, title = "Strategy Start Day")
stratstart = timestamp(stratyear,stratmonth,stratday,0,0)


// --------------- Laguerre ----------------- //

laguerre = input(title="Use Laguerre on RSI ?", type=input.bool, defval=false)
gamma = input(0.06, title="Laguerre Gamma")

laguerre_cal(s,g) =>
    l0 = 0.0
    l1 = 0.0
    l2 = 0.0
    l3 = 0.0
    l0 := (1 - g)*s+g*nz(l0[1])
    l1 := -g*l0+nz(l0[1])+g*nz(l1[1])
    l2 := -g*l1+nz(l1[1])+g*nz(l2[1])
    l3 := -g*l2+nz(l2[1])+g*nz(l3[1])
    (l0 + 2*l1 + 2*l2 + l3)/6


// ---------------- Rsi VWAP ---------------- //

rsiV = security(syminfo.tickerid, reso, rsi(vwap(close), length))

rsiVWAP = laguerre ? laguerre_cal(rsiV,gamma) : rsiV


// ------------------ Plots ----------------- //

prsi = plot(rsiVWAP, color = rsiVWAP>ovrbgt ? color.red : rsiVWAP<ovrsld ? color.green : color.white, title="RSI on VWAP", linewidth=1, style=plot.style_line)
hline = plot(ovrbgt, color = color.gray, style=plot.style_line)
lline = plot(ovrsld, color = color.gray, style=plot.style_line)
fill(prsi,hline, color = rsiVWAP > ovrbgt ? color.red : na, transp = 30)
fill(prsi,lline, color = rsiVWAP < ovrsld ? color.green : na, transp = 30)


// ---------------- Positions: only shows the Short and close shoret positions --------------- //

timebull = stratbull and time > stratstart
timebear = stratbear and time > stratstart


strategy.entry("Short", false, when = timebear and crossunder(rsiVWAP, ovrbgt), comment="")
strategy.close("Short", when = timebear and crossunder(rsiVWAP, ovrsld)[lateleave] or crossover(rsiVWAP, ovrsld), comment="")

더 많은