// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © maruf_bd //@version=5 indicator("~VWAP", overlay = false) l = input(6, "Price lookback") price = ta.cum(hlc3) highs = 0.0, lows = 0.0, closes = 0.0 for i = 0 to l highs := highs + high[i] lows := lows + low[i] closes := closes + close[i] avarages = array.new_float(l+1, 0.0) for i = 0 to l array.set ( avarages, i, (highs[i] + lows[i] + closes[i]) / 3 ) cum_price = array.sum(avarages) //_________________________________________________________________ cum_volume = 0.0 for i = 0 to l cum_volume := volume[i] //_________________________________________________________________ vwap = (cum_price * volume) / cum_volume //plot(vwap) alma = ta.alma(vwap, l, .90, 6) plot(alma, color = #44CA99)