0% found this document useful (0 votes)
89 views

SpringPad_TradingView Strategy Pinescript Code PDF

The document provides a PineScript code for a trading strategy that utilizes VWAP, Moving Average, and ATR for mean reversion with stop loss. It outlines the conditions for entering long and short positions based on price relationships with VWAP and MA, along with instructions for implementing the script in TradingView. Additionally, it includes steps for accessing and saving the script in the TradingView platform.

Uploaded by

vijayprasannavs
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
89 views

SpringPad_TradingView Strategy Pinescript Code PDF

The document provides a PineScript code for a trading strategy that utilizes VWAP, Moving Average, and ATR for mean reversion with stop loss. It outlines the conditions for entering long and short positions based on price relationships with VWAP and MA, along with instructions for implementing the script in TradingView. Additionally, it includes steps for accessing and saving the script in the TradingView platform.

Uploaded by

vijayprasannavs
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

SpringPad’s TradingView Strategy PineScript Code

//@version=5
strategy("VWAP and MA Mean Reversion Strategy with ATR Stop Loss", overlay=true)

// Inputs
length = input(14, "MA Length")
atrLength = input(14, "ATR 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("Stop Loss", "Buy", stop=stopPrice)

// Sell condition: Price is above VWAP but below MA


shortCondition = close > vwap and close < ma
if (shortCondition)
strategy.entry("Sell", strategy.short)
stopPrice = close + atrMultiplier * atr
strategy.exit("Stop Loss", "Sell", stop=stopPrice)

// Plotting
plot(vwap, title="VWAP", color=color.blue)
plot(ma, title="MA", color=color.orange)
STEPS

1) Go to - https://in.tradingview.com
2) Select – PRODUCTS -> SUPERCHARTS
3) Bottom of Screen – PINE EDITOR
4) COPY ABOVE CODE and PASTE IT
5) RENAME SCRIPT and SAVE
6) To use it, click INDICATORS -> Personal -> Select your saved script.

You might also like