Swing VWAP Weekly Stock and Crypto Strategy
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © exlux99

//@version=4
strategy(title = "Swing VWAP Weekly Strategy", overlay = true,  pyramiding=1,initial_capital = 100, default_qty_type= strategy.percent_of_equity, default_qty_value = 100, calc_on_order_fills=false, slippage=0,commission_type=strategy.commission.percent,commission_value=0.03)


vwapweekly= security(syminfo.tickerid, "W", vwap)

long=( close > vwapweekly)
short=( close < vwapweekly)

strategy.entry("long", strategy.long,when=long,  comment = "long")
strategy.close("long",when=close < vwapweekly or vwapweekly[1] > vwapweekly)

strategy.entry("short", strategy.short,when=short, comment = "short")
strategy.close("short",when=close > vwapweekly or vwapweekly > vwapweekly[1])

