Example #1
0
    def __init__(self):
        self.inds = dict()

        for d in self.datas:
            if d._name == self.p.benchmark_name:
                continue
            self.inds[d] = dict()

            self.inds[d]['csma200'] = btind.SMA(d.close, period=200)
            self.inds[d]['dmi'] = dmi_inds.BCH(d, subplot=False)
            self.inds[d]['bbh'] = self.inds[d]['dmi'].bbh
            self.inds[d]['adx'] = btind.AverageDirectionalMovementIndex(
                d, period=14, subplot=False)
            self.inds[d]['adxma'] = btind.SMA(self.inds[d]['adx'], period=2)

            self.inds[d]['rbbhl'] = RBBBHL.RBBHL(d, subplot=False)
            self.inds[d]['hbb'] = self.inds[d]['rbbhl'].hbb

            self.inds[d]['order'] = None
            self.inds[d]['sellStop'] = None
            self.inds[d]['onceTrue'] = False
            self.inds[d]['sell_condition'] = btind.crossover.CrossDown(
                self.inds[d]['adx'], self.inds[d]['adxma'])

            self.inds[d]['bar_counter'] = 0
Example #2
0
 def __init__(self):
     self.l.adx = btind.AverageDirectionalMovementIndex(self.data0)
     self.l.adxma = btind.SMA(self.l.adx(0), period=2)
     self.crossup_condition = btind.crossover.CrossUp(
         self.l.adx(0), self.l.adxma(0))
     self.hi = []
     self.lo = []
Example #3
0
    def __init__(self):

        self.inds = dict()

        for d in self.datas:
            if d._name == self.p.benchmark_name:
                continue

            self.inds[d] = dict()

            self.inds[d]['pdimdiCH'] = PDIMDIHL.PDIMDIHL(d, subplot=False)
            self.inds[d]['pdi'] = self.inds[d]['pdimdiCH'].l.pdi
            self.inds[d]['mdi'] = self.inds[d]['pdimdiCH'].l.mdi

            self.inds[d]['adx'] = btind.AverageDirectionalMovementIndex(
                d, subplot=False)
            self.inds[d]['adxma'] = btind.SMA(self.inds[d]['adx'].l.adx,
                                              period=2,
                                              subplot=False)

            self.inds[d]['LLPCH'] = hhpc.PC(d, subplot=False)
            self.inds[d]['llpc'] = self.inds[d]['LLPCH'].l.llpc
            self.inds[d]['PC'] = pchannel.priceChannel(d, subplot=False)
            self.inds[d]['pch'] = self.inds[d]['PC'].l.pch

            self.inds[d]['order'] = None

            self.inds[d]['eligible'] = False

            self.inds[d]['counter'] = 0

            self.inds[d]['tradeno'] = 0
            self.inds[d]['is_last'] = False

        self.bar_counter = 0
Example #4
0
 def __init__(self):
     self.l.pdi = btind.PlusDirectionalIndicator(self.data0, period=14)
     self.l.mdi = btind.MinusDirectionalIndicator(self.data0, period=14)
     self.l.adx = btind.AverageDirectionalMovementIndex(self.data0,
                                                        period=14)
     self.l.adxma = btind.SMA(self.l.adx, period=2)
     self.adx_condition = btind.crossover.CrossUp(self.adx(0),
                                                  self.adxma(0))
Example #5
0
    def __init__(self):
        super(CrossOver2, self).__init__()
        self.log('======CrossOver2 init=======', isprint=True)
        # self.log('======Crossover3 init=======', isprint=True)
        sma_fast = bt.indicators.MovAv.SMA(period=self.p.fast)
        sma_slow = bt.indicators.MovAv.SMA(period=self.p.slow)
        self.adx = btind.AverageDirectionalMovementIndex(period=18)

        self.name = 'CrossOver2'
        # btind.BollingerBands()

        # btind.AverageDirectionalMovementIndex(period=9)
        self.buysig = btind.CrossOver(sma_fast, sma_slow)
Example #6
0
    def __init__(self):
        self.sma = []
        self.adx = []
        self.volszo = []
        self.logfile = open('log.txt', 'w')

        for d in self.datas:
            d.adx = btind.AverageDirectionalMovementIndex(
                d, period=self.p.adxperiod)
            d.volszo = VolSZO(d,
                              szolength=self.p.szolength,
                              sumlength=self.p.sumlength,
                              signal_percent=self.p.signal_percent)
Example #7
0
    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])
Example #8
0
    def __init__(self):

        self.inds = dict()

        for d in self.datas:
            if d._name == self.p.benchmark_name:
                continue

            self.inds[d] = dict()

            self.inds[d]['hbbCH'] = RBBBHL.RBBHL(d, subplot=False)
            self.inds[d]['hbb'] = self.inds[d]['hbbCH'].l.hbb
            self.inds[d]['pdi'] = self.inds[d]['hbbCH'].l.pdi
            self.inds[d]['mdi'] = self.inds[d]['hbbCH'].l.mdi

            self.inds[d]['adx'] = btind.AverageDirectionalMovementIndex(
                d, subplot=False)
            self.inds[d]['adxma'] = btind.SMA(self.inds[d]['adx'].l.adx,
                                              period=2,
                                              subplot=False)
            self.inds[d]['crossDownadx'] = btind.crossover.CrossDown(
                self.inds[d]['adx'], self.inds[d]['adxma'])
            self.inds[d]['adxcrossUp'] = btind.crossover.CrossUp(
                self.inds[d]['adx'], self.inds[d]['adxma'])

            self.inds[d]['order'] = None

            self.inds[d]['eligible'] = False

            self.inds[d]['counter'] = 0

            self.inds[d]['tradeno'] = 0
            self.inds[d]['is_last'] = False

            self.inds[d]['buy_condition'] = False

        self.bar_counter = 0
Example #9
0
    def __init__(self):
        sma_fast = self.p._movav(period=self.p.fast)
        sma_slow = self.p._movav(period=self.p.slow)
        self.adx = btind.AverageDirectionalMovementIndex(period=self.p.slow)

        self.buysig = btind.CrossOver(sma_fast, sma_slow)