//version=5 strategy("VWAP and MA Mean Reversion Strategy with ATR Stop Loss", overlay=true)
// Inputs length = input(14, "MA Length") atrLength = input(14, "MA Length") atrMultiplier = input(1.5, title="ATR Multiplier for Stop Loss")
// Calculate VWAP, Moving Average, and ATR VWAP = ta.vwap(hlc3) ma = ta.sma(close, length) atr = ta.atr(atrLength)
// Buy condition: Price is below VWAP but above MA longCondition = close < VWAP and close > ma if (longCondition) strategy.entry("Buy", strategy.long) stopPrice = close - atrMultiplier * atr strategy.exit("Long Stop Loss", "Buy", stop=stopPrice)
// Sell condition: Price is above VWAP but below MA shortCondition = close > VWAP and close < ma if (longCondition) strategy.entry("Sell", strategy.short) stopPrice = close - atrMultiplier * atr strategy.exit("Short Stop Loss", "Sell", stop=stopPrice)
진정한 TradingView 정신에 따라, 이 스크립트의 저자는 트레이더들이 이해하고 검증할 수 있도록 오픈 소스로 공개했습니다. 저자에게 박수를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 출판물에서 이 코드를 재사용하는 것은 하우스 룰에 의해 관리됩니다. 님은 즐겨찾기로 이 스크립트를 차트에서 쓸 수 있습니다.