how to generate quantile number?
Hi guys, I wish to get a quantile number of an indicator, let's say simple moving average. How can I get the number so that I can use it to generate logical operators?
self.sma = bt.indicators.SimpleMovingAverage(
self.quantile = self.sma.quantileORsomething(0.75)
buy_signal = self.sma > self.quantile
Can anyone help? Many thanks!
@fanpeix I'm not quite sure what you mean by getting the quantile of an indicator. A quantile would apply to a series of data values, so you could get the last N values of the indicator and take the quantile of that, like below where I'm using NumPy's
vals = self.sma.get(size=10) quantiles = np.quantile(vals, [0.25, 0.5, 0.75], interpolation='linear')
run-out last edited by