Hello.
Try to use ROC (Rate Of Change).
... import qnt.ta as qnta ... def single_pass_strategy(data, wma_period=20, roc_period=10): wma = qnta.lwma(data.sel(field='close'), wma_period) sroc = qnta.roc(wma, roc_period) # it measures the angle (tg) weights = xr.where(sroc > 0, 1, 0) return weights ...Regards.