Code:
input vwmaLength = 20;
input maLength = 20;
input averageType = AverageType.SIMPLE;
def VWMA = Sum(volume * close, vwmaLength) / Sum(volume, vwmaLength);
def MA = MovingAverage(averageType, close, maLength);
def priceCrossBelowSMA = VWMA [1] > MA [1] and VWMA < MA;
plot Scandown = priceCrossBelowSMA;
def priceCrossAboveSMA = VWMA [1] < MA [1] and VWMA > MA;
plot Scanup = priceCrossAboveSMA;