示例#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]['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 = []
示例#2
0
    def __init__(self):
        self.inds = dict()

        for d in self.datas:
            self.inds[d] = dict()

            if d._name == self.p.benchmark_name:
                continue

            self.inds[d]['newHighCH'] = NEW_HIGH.newHigh(d,subplot=False)
            self.inds[d]['newHigh'] = self.inds[d]['newHighCH'].newHigh

            self.inds[d]['newHighStop80CH'] = NEW_HIGH_STOP80.newHighstop80(d,subplot=False)
            self.inds[d]['newHighStop80'] = self.inds[d]['newHighStop80CH'].newHighstop80

            self.inds[d]['llpcCH'] = hhpc.PC(d,subplot=False)
            self.inds[d]['llpc'] = self.inds[d]['llpcCH'].l.llpc


            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]['first_order'] = True
            self.inds[d]['prev_llpc'] = 0
            self.inds[d]['hi'], self.inds[d]['lo'] = d.high, d.low
            self.inds[d]['temp'] = list()
        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]['newHighCH'] = NEW_HIGH.newHigh(d,subplot=False)
            self.inds[d]['newHigh'] = self.inds[d]['newHighCH'].newHigh

            self.inds[d]['newHighStop70CH'] = NEW_HIGH_STOP70.newHighstop70(d,subplot=False)
            self.inds[d]['newHighstop70'] = self.inds[d]['newHighStop70CH'].newHighstop70

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

            self.inds[d]['hi'] = d.high
            self.inds[d]['lo'] = d.low

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

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

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

        self.bar_counter = 0

        self.highest_lowest = []
        hi,lo = self.data0.high , self.data0.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]['newHighCH'] = NEW_HIGH.newHigh(d, subplot=False)
            self.inds[d]['newHigh'] = self.inds[d]['newHighCH'].newHigh

            self.inds[d]['newHighStop75CH'] = NEW_HIGH_STOP75.newHighstop75(
                d, subplot=False)
            self.inds[d]['newHighStop75'] = self.inds[d][
                'newHighStop75CH'].newHighstop75

            self.inds[d]['range'] = RANGE.RANGE(d, subplot=False).l.range

            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 = []
示例#5
0
    def __init__(self):

        self.inds = dict()

        for d in self.datas:
            if d._name == self.p.benchmark_name:
                continue
            print('[+] Initializing indicators for : ' + str(d._name))

            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]['newHighStop70CH'] = NEW_HIGH_STOP70.newHighstop70(
                d, subplot=False)
            self.inds[d]['newHighStop70'] = self.inds[d][
                'newHighStop70CH'].newHighstop70

            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
    def __init__(self):
        self.newHighch = NEW_HIGH.newHigh(self.data0, subplot=False)
        self.newHigh = self.newHighch.newHigh

        self.newHighstop70ch = NEW_HIGH_STOP70.newHighstop70(self.data0,
                                                             subplot=False)
        self.newHighstop70 = self.newHighstop70ch.newHighstop70

        self.newHighstop75ch = NEW_HIGH_STOP75.newHighstop75(self.data0,
                                                             subplot=False)
        self.newHighstop75 = self.newHighstop75ch.newHighstop75

        self.newHighstop50ch = NEW_HIGH_STOP50.newHighstop50(self.data0,
                                                             subplot=False)
        self.newHighstop50 = self.newHighstop50ch.newHighstop50

        self.newHighstop80ch = NEW_HIGH_STOP80.newHighstop80(self.data0,
                                                             subplot=False)
        self.newHighstop80 = self.newHighstop80ch.newHighstop80

        self.newHighstop85ch = NEW_HIGH_STOP85.newHighstop85(self.data0,
                                                             subplot=False)
        self.newHighstop85 = self.newHighstop85ch.newHighstop85

        self.newHighstop90ch = NEW_HIGH_STOP90.newHighstop90(self.data0,
                                                             subplot=False)
        self.newHighstop90 = self.newHighstop90ch.newHighstop90
示例#7
0
    def __init__(self):
        '''
        Create an dictionary of indicators so that we can dynamically add the
        indicators to the strategy using a loop. This mean the strategy will
        work with any numner of data feeds.
        '''

        self.benchmark = self.getdatabyname(self.p.benchmark_name)

        self.inds = dict()
        for i, d in enumerate(self.datas):
            print('Initializing Indicators for Data :', d._name)
            if d._name == self.p.benchmark_name:
                continue
            self.inds[d] = dict()

            # Custom Indicators
            # self.inds[d]['dmich'] = dmi_inds.DMICH(d)
            # self.inds[d]['bch'] = dmi_inds.BCH(d)
            self.inds[d]['rsch'] = rscch.RSCCH(d, self.benchmark)
            self.inds[d]['pc'] = hhpc.PC(d)
            self.inds[d]['newHigh'] = NEW_HIGH.newHigh(d)
            self.inds[d]['HPCHU'] = PCHL.PCHL(d)

            # New Custom Indicators
            # self.inds[d]['RSH10'] = bt.indicators.SMA(self.inds[d]['rsch'].rsh, period=10)
            # self.inds[d]['RSL10'] = bt.indicators.SMA(self.inds[d]['rsch'].rsl, period=10)
            # self.inds[d]['ROC1'] = bt.indicators.ROC100(d, period=1)

            # Standard Indicatora
            # self.inds[d]['sma_close'] = bt.indicators.SMA(d.close,period=50)
            # self.inds[d]['vma'] = bt.indicators.SMA(d.volume,period=200)
            # self.inds[d]['RSCMA5'] = bt.indicators.SMA(self.inds[d]['rsch'].rsc,period=5)
            self.inds[d]['RSCMA10'] = bt.indicators.SMA(
                self.inds[d]['rsch'].rsc, period=10)
            # self.inds[d]['RSCMA200'] = bt.indicators.SMA(self.inds[d]['rsch'].rsc,period=200)
            # self.inds[d]['PCH25'] = bt.indicators.basicops.Highest(d.high(-1),
            #                                                        period=25)  # -1 to not include current bar
            # self.inds[d]['PCL25'] = bt.indicators.basicops.Lowest(d.low(-1), period=25)

            # Cross Conditions RSC
            # self.inds[d]['RSC CU'] = bt.indicators.crossover.CrossUp(self.inds[d]['rsch'].rsc, self.inds[d]['RSCMA10'])
            # self.inds[d]['RSC CD'] = bt.indicators.crossover.CrossDown(self.inds[d]['rsch'].rsc,
            #                                                            self.inds[d]['RSCMA10'])

        # To keep track of pending orders and buy price/commission
        self.order = None
        self.buyprice = None
        self.buycomm = None

        self.last_values = {}
        self.data_value_json = {}
 def __init__(self):
     self.newHighch = NEW_HIGH.newHigh(self.data0)
     self.newHigh = self.newHighch.newHigh