vwma_long = data.vwma(200) vwma_test = vwma_long.last Error: ..'NoneType' object has no attribute 'last'..
In this snippet, the error occurs because the code does not account for the data object returning null or None. To rectify this error we ask to function to return if it detects a null value.
vwma_long = data.vwma(200) if vwma_long is None: return vwma_test = vwma_long.last