이 전략은 두 개의 다른 주기의 VWAP 라인을 교차하고 RSI 지표와 결합하여 거래 신호를 확인합니다. 가격이 VWAP 라인을 상향으로 돌파하고 RSI가 초과 수준을 초과하면 여러 신호가 발생하며 가격이 VWAP 라인을 상향으로 돌파하고 RSI가 초과 수준을 초과하면 공백 신호가 발생합니다. 이 전략은 VWAP에 대한 가격의 돌파구를 포착하는 동시에 RSI 지표를 사용하여 가짜 돌파구 신호를 필터링합니다.
거래량 가중 평균 가격과 상대적으로 강한 지수 교차 전략은 가격 상대적으로 VWAP의 돌파구를 포착하여 잠재적인 이익을 얻기 위해 사용하는 간단한 거래 방법이다. 그러나 이 전략에는 파라미터 최적화, 진동 시장의 열악한 성능, 위험 관리의 부족 등의 문제가 있습니다. 다중 시간 주기 분석을 도입하고, 다른 기술 지표와 결합하여, 출입 규칙을 최적화하고, 위험 제어와 같은 방법을 추가함으로써 이 전략의 안정성과 실용성을 더욱 향상시킬 수 있습니다.
/*backtest
start: 2023-05-05 00:00:00
end: 2024-05-10 00:00:00
period: 2d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=4
strategy("VWAP and RSI Strategy with Alerts", overlay=true)
// Inputs
cumulativePeriod = input(20, "Rolling Period for VWAP", minval=1)
rsiPeriod = input(20, "RSI Period", minval=1)
rsiOverbought = input(70, "RSI Overbought Level")
rsiOversold = input(30, "RSI Oversold Level")
tradeQty = input(1, "Trade Quantity", minval=0.01) // Cantidad de la operación
// VWAP Calculation
typicalPrice = (high + low + close) / 3
typicalPriceVolume = typicalPrice * volume
cumulativeTypicalPriceVolume = sum(typicalPriceVolume, cumulativePeriod)
cumulativeVolume = sum(volume, cumulativePeriod)
vwapValue = cumulativeTypicalPriceVolume / cumulativeVolume
plot(vwapValue, color=color.blue, title="VWAP")
// RSI Calculation
rsiValue = rsi(close, rsiPeriod)
hline(rsiOverbought, "Overbought", color=color.red)
hline(rsiOversold, "Oversold", color=color.green)
// Entry Conditions
longCondition = crossover(close, vwapValue) and rsiValue > rsiOversold
shortCondition = crossunder(close, vwapValue) and rsiValue < rsiOverbought
// Strategy Execution for Entries
if (longCondition)
strategy.entry("Long", strategy.long, qty=tradeQty)
if (shortCondition)
strategy.entry("Short", strategy.short, qty=tradeQty)
// Conditions for Exiting
exitLongCondition = crossunder(close, vwapValue) or rsiValue > rsiOverbought // Salir de long cuando el precio cruce debajo del VWAP o el RSI sea alto
exitShortCondition = crossover(close, vwapValue) or rsiValue < rsiOversold // Salir de short cuando el precio cruce por encima del VWAP o el RSI sea bajo
// Strategy Execution for Exits
strategy.exit("Exit Long", "Long", when=exitLongCondition)
strategy.exit("Exit Short", "Short", when=exitShortCondition)
// Alert Conditions
alertcondition(longCondition, title="Enter Long", message="ENTER-LONG_BINANCE-FUTURES_BTCUSDT_WunderTrading-1_1M_1354a524d74bc295")
alertcondition(exitLongCondition, title="Exit Long", message="EXIT-LONG_BINANCE-FUTURES_BTCUSDT_WunderTrading-1_1M_1354a524d74bc295")
alertcondition(shortCondition, title="Enter Short", message="ENTER-SHORT_BINANCE-FUTURES_BTCUSDT_WunderTrading-1_1M_1354a524d74bc295")
alertcondition(exitShortCondition, title="Exit Short", message="EXIT-SHORT_BINANCE-FUTURES_BTCUSDT_WunderTrading-1_1M_1354a524d74bc295")