Пример #1
0
    def __init__(self):
        self.pricech = pchannel.priceChannel(self.data0, subplot=False)
        self.pcl = self.pricech.pcl

        self.pc50 = pchannel.priceChannel(self.data0, period=50, subplot=False)
        self.pch50 = self.pc50.pch

        self.hhpcch = hhpc.PC(self.data0, subplot=False)
        self.hhpc = self.hhpcch.hhpc

        self.order = None

        self.bar_counter = 0
Пример #2
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]['newHighCH'] = NEW_HIGH.newHigh(d, subplot=False)
            self.inds[d]['newHigh'] = self.inds[d]['newHighCH'].newHigh

            self.inds[d]['pchannel'] = pchannel.priceChannel(d, subplot=False)
            self.inds[d]['pcl'] = self.inds[d]['pchannel'].l.pcl

            self.inds[d]['buy_order'] = None
            self.inds[d]['sell_order'] = None

            self.inds[d]['tradeNo'] = 0
            self.inds[d]['counter'] = 0
            self.inds[d]['eligible'] = False
            self.inds[d]['hi'], self.inds[d]['lo'] = d.high, d.low

        self.bar_counter = 0

        self.highest_lowest = []
Пример #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]['hhpcCH'] = hhpc.PC(d,subplot=False)
            self.inds[d]['llpc'] = self.inds[d]['hhpcCH'].l.llpc

            self.inds[d]['priceCH'] = pchannel.priceChannel(d,subplot=False)
            self.inds[d]['pcl'] = self.inds[d]['priceCH'].l.pcl

            self.inds[d]['csma200'] = btind.SMA(d.close,period=200)

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

            self.inds[d]['tradeNo'] = 0
            self.inds[d]['counter'] = 0
            self.inds[d]['eligible'] = False

        self.bar_counter = 0

        self.highest_lowest = []


        hi, lo = self.data.high, self.data.low
Пример #4
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
Пример #5
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]['RBBBHL'] = RBBBHL.RBBHL(d, subplot=False)
            self.inds[d]['hbb'] = self.inds[d]['RBBBHL'].l.hbb
            self.inds[d]['pdi'] = self.inds[d]['RBBBHL'].l.pdi
            self.inds[d]['mdi'] = self.inds[d]['RBBBHL'].l.mdi
            self.inds[d]['adx'] = self.inds[d]['RBBBHL'].l.adx
            self.inds[d]['adxma'] = self.inds[d]['RBBBHL'].l.adxma

            self.inds[d]['adx_condition'] = btind.crossover.CrossUp(
                self.inds[d]['adx'], self.inds[d]['adxma'])

            self.inds[d]['pcl'] = pchannel.priceChannel(d, subplot=False).l.pcl

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

        self.bar_counter = 0
Пример #6
0
    def __init__(self):

        # Initialize & assign Indicators here
        self.pc = pchannel.priceChannel(self.data,
                                        period=5,
                                        lookback=-1,
                                        subplot=False)

        self.order = None
Пример #7
0
 def __init__(self):
     
     self.pricechannel = pchannel.priceChannel(self.data,period=5,subplot=True)
     
     self.pch = self.pricechannel.pch
     self.pcl = self.pricechannel.pcl
 
     self.hhpcCurrent = 0.0
     self.llpcCurrent = 0.0
     self.highDone = False
     self.first = True
Пример #8
0
    def __init__(self):

        self.l.ma = SMA(self.data, period=self.p.period)
        self.transition = 0
        self.first_start = True
        self.highCond = CrossDown(self.data.close, self.l.ma)
        self.lowCond = CrossUp(self.data.close, self.l.ma)

        self.priceCH = pchannel.priceChannel(self.data, subplot=True)
        self.pch = self.priceCH.pch
        self.pcl = self.priceCH.pcl
Пример #9
0
 def __init__(self):
     self.dclose = self.datas[0].close
     self.ma50 = SMA(self.data0.close, period=self.p.period1, subplot=False)
     self.ma200 = SMA(self.data0.close,
                      period=self.p.period2,
                      subplot=False)
     self.price_channel = pchannel.priceChannel(self.data0, subplot=False)
     self.pch5 = self.price_channel.pch
     self.price_channels = hhpc.PC(self.data0, subplot=False)
     self.llpc = self.price_channels.llpc
     self.order = None
     self.bar_counter = 0
Пример #10
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]['pricech'] = pchannel.priceChannel(d, subplot=False)
            self.inds[d]['pcl'] = self.inds[d]['pricech'].pcl

            self.inds[d]['pc50'] = pchannel.priceChannel(d,
                                                         period=50,
                                                         subplot=False)
            self.inds[d]['pch50'] = self.inds[d]['pc50'].pch

            self.inds[d]['hhpcch'] = hhpc.PC(d, subplot=False)
            self.inds[d]['hhpc'] = self.inds[d]['hhpcch'].hhpc

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

        self.bar_counter = 0
Пример #11
0
    def __init__(self):

        self.pchannel = pchannel.priceChannel(self.data0,
                                              period=self.p.period,
                                              subplot=False)
        self.lines.pch = self.pchannel.lines.pch
        self.l.pcl = self.pchannel.l.pcl

        self.pchu_condition = btind.crossover.CrossUp(self.data0.high,
                                                      self.l.pch)
        self.pcld_condition = btind.crossover.CrossDown(
            self.data0.low, self.l.pcl)

        self.first = True
        self.first_pchu = True
        self.first_pcld = True
Пример #12
0
    def __init__(self):

        hi, lo = self.data.high, self.data.low
        if self.params.lookback:
            hi.lo = hi(self.params.lookback), lo(self.params.lookback)

        # Price Channels
        self.pchannel = pchannel.priceChannel(self.data0,
                                              period=self.params.period,
                                              subplot=False)
        self.lines.pch = self.pchannel.lines.pch
        self.lines.pcl = self.pchannel.lines.pcl
        self.hhllpc = hhpc.PC(self.data0, period=5, subplot=False)
        self.lines.hhpc = self.hhllpc.lines.hhpc
        self.lines.llpc = self.hhllpc.lines.llpc

        # Conditions Low < PCL and High > PCH
        # Can you please check which condition is correct?

        # CONDITION 1 - Checks crossover with the price channel of previous bar
        # (This is how Harsh Bhaiya checks in HHPC)
        # self.hhhpc_condition = crossover.CrossDown(self.data.low, self.pcl(-1))
        # self.lllpc_condition = crossover.CrossUp(self.data.high, self.pch(-1))

        # Condition 2 - Checks crossover with the price channel of current bar
        self.hhhpc_condition = crossover.CrossDown(self.data.low,
                                                   self.lines.llpc)
        self.lllpc_condition = crossover.CrossUp(self.data.high,
                                                 self.lines.hhpc)

        # Checking candles where High >= HHPC, Low <= LLPC
        self.overhhpc = Cmp(self.data0.high, self.lines.hhpc)
        self.underllpc = Cmp(self.lines.llpc, self.data0.low)

        # Miscellenaous Variables
        self.start = True
        self.hstart = 0  # Start of range of HHHPC. Changes when HHHPC condition met.
        self.lstart = 0  # For LLLPC

        self.hfirst = True  # 1st time condition met for HHHPC. Different behaviour
        self.lfirst = True  # For LLLPC

        # Useless transfer variables because I can't figure out
        # how to assign "Highest" to HHHPC[0] and same for LLLPC
        self.temph = Highest(hi, period=self.params.period, subplot=False)
        self.templ = Lowest(lo, period=self.params.period, subplot=False)
Пример #13
0
    def __init__(self):
        self.benchmark = self.getdatabyname(self.p.benchmark_name)
        self.inds = dict()
        for d in self.datas:
            if d._name == self.p.benchmark_name:
                continue

            self.inds[d] = dict()

            self.inds[d]['rsc_ind'] = RSC.rsc(d, self.benchmark, subplot=False)
            self.inds[d]['rsc'] = self.inds[d]['rsc_ind'].rsc
            self.inds[d]['rscma'] = btind.SMA(self.inds[d]['rsc'],
                                              period=10,
                                              subplot=False)

            self.inds[d]['priceCH'] = pchannel.priceChannel(d, subplot=False)
            self.inds[d]['pcl'] = self.inds[d]['priceCH'].l.pcl

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

        self.bar_counter = 0
Пример #14
0
    def __init__(self):
        self.benchmark = self.getdatabyname(self.p.benchmark_name)
        self.inds = dict()

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

            self.inds[d] = dict()

            self.inds[d]['rsc'] = RSC.rsc(d,self.benchmark)
            self.inds[d]['rscma'] = bt.ind.SMA(self.inds[d]['rsc'],period=10)

            self.inds[d]['pc'] = hhpc.PC(d,subplot=False)
            self.inds[d]['hhpc'] = self.inds[d]['pc'].l.hhpc
            self.inds[d]['pcl'] = pchannel.priceChannel(d,subplot=False).l.pcl
            self.inds[d]['adx'] = bt.ind.AverageDirectionalMovementIndex(d)
            self.inds[d]['adxma'] = bt.ind.SMA(self.inds[d]['adx'], period=2)

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

        self.bar_counter = 0
Пример #15
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]['dclose'] = self.datas[0].close
            self.inds[d]['ma50'] = SMA(d.close,
                                       period=self.p.period1,
                                       subplot=False)
            self.inds[d]['ma200'] = SMA(d.close,
                                        period=self.p.period2,
                                        subplot=False)
            self.inds[d]['price_channel'] = pchannel.priceChannel(
                d, subplot=False)
            self.inds[d]['pch5'] = self.inds[d]['price_channel'].pch
            self.inds[d]['price_channels'] = hhpc.PC(d, subplot=False)
            self.inds[d]['llpc'] = self.inds[d]['price_channels'].llpc

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

        self.bar_counter = 0