def __init__(self): btind.SMA() btind.Stochastic() btind.RSI() btind.MACD() btind.CCI() TestInd().plotinfo.plot = False
def __init__(self): btind.SMA() btind.Stochastic() btind.RSI() btind.MACD() btind.CCI() TestInd().plotinfo.plot = False sma1, sma2 = bt.ind.SMA(period=10), bt.ind.SMA(period=30) crossover = bt.ind.CrossOver(sma1, sma2) self.signal_add(bt.SIGNAL_LONG, crossover)
def __init__(self): sma = btind.SMA(subplot=self.params.smasubplot) macd = btind.MACD() # In SMA we passed plot directly as kwarg, here the plotinfo.plot # attribute is changed - same effect macd.plotinfo.plot = not self.params.nomacdplot # Let's put rsi on stochastic/sma or the other way round stoc = btind.Stochastic() rsi = btind.RSI() if self.params.stocrsi: stoc.plotinfo.plotmaster = rsi stoc.plotinfo.plotlinelabels = self.p.stocrsilabels elif self.params.rsioverstoc: rsi.plotinfo.plotmaster = stoc elif self.params.rsioversma: rsi.plotinfo.plotmaster = sma
def __init__(self): self.dataclose = self.datas[0].close self.bbands = btind.BollingerBands(period=20, devfactor=2) self.stoch = btind.Stochastic(period=14, period_dfast=3, period_dslow=3) self.orders = list() self.short_signal = bt.And(self.dataclose > self.bbands.top, self.stoch.percK > 80) self.long_signal = bt.And(self.dataclose < self.bbands.bot, self.stoch.percK < 20) self.close_long_signal = self.dataclose >= self.bbands.top self.close_short_signal = self.dataclose <= self.bbands.bot self.loss_perc = 0.025
def __init__(self): super().__init__() self.ma = btind.MovingAverageSimple(self.datas[0], period = self.params.ma) self.ma1 = btind.MovingAverageSimple(self.datas[0], period = self.params.ma1) self.ma2 = btind.MovingAverageSimple(self.datas[0], period = self.params.ma2) self.atr = btind.AverageTrueRange(self.datas[0]) self.kst = btind.KnowSureThing(self.datas[0]) self.macd = btind.MACD(self.datas[0]) self.trix = btind.TrixSignal(self.datas[0]) self.ao = btind.AwesomeOscillator(self.datas[0]) self.tsi = btind.TrueStrengthIndicator(self.datas[0]) self.psar = btind.ParabolicSAR(self.datas[0]) self.adx = btind.AverageDirectionalMovementIndex(self.datas[0]) self.dpo = btind.DetrendedPriceOscillator(self.datas[0]) self.rsi = btind.RSI(self.datas[0]) self.accdec = btind.AccelerationDecelerationOscillator(self.datas[0]) self.bbands = btind.BollingerBands(self.datas[0]) self.cci = btind.CommodityChannelIndex(self.datas[0]) self.pgood = btind.PrettyGoodOscillator(self.datas[0]) self.williamsr = btind.WilliamsR(self.datas[0]) self.uo = btind.UltimateOscillator(self.datas[0]) self.stoch = btind.Stochastic(self.datas[0])
def __init__(self): super().__init__() self.ma1 = btind.MovingAverageSimple(self.datas[0], period = self.params.ma1) self.ma2 = btind.MovingAverageSimple(self.datas[0], period = self.params.ma2) self.stoch = btind.Stochastic(self.datas[0], period = self.params.period)