Exemplo n.º 1
0
 def __init__(self, prices):
     indicator.__init__(self, 'Williams', 'trend', prices.index)
     self.jaw, self.teeth, self.lips = self.Init(prices)
     # Signals
     fromBottom, fromTop = FindIntersections(self.lips, self.jaw)
     self.sell = fromTop
     fromBottom, fromTop = FindIntersections(self.lips, self.teeth)
     self.buy = fromBottom
Exemplo n.º 2
0
    def __init__(self, high, low, close, n=14):
        indicator.__init__(self, 'CCI%u' % n, 'momentum', close.index)
        self.n = n
        self.factor = 0.015
        self.cci = self.InitCCI(high, low, close)
        self.cciSignal = CreateMovingAverage(self.cci, self.n * 1.5)

        # Signals
        fromBottom, fromTop = FindIntersections(self.cci, -100)
        self.buy = fromBottom
        fromBottom, fromTop = FindIntersections(self.cci, 100)
        self.sell = fromTop
Exemplo n.º 3
0
 def __init__(self, close):
     indicator.__init__(self, 'MACD', 'trend', close.index)
     self.macd, self.signal = self.InitMACD(close)
     self.buy, self.sell = FindIntersections(self.macd, self.signal)
     # Create histogram
     histogram = self.macd.subtract(self.signal)
     self.hplus = CreateSubsetByValues(histogram, 0, 100)
     self.hminus = CreateSubsetByValues(histogram, -100, 0)
Exemplo n.º 4
0
    def __init__(self, high, low, close, volume, info, n=21):
        indicator.__init__(self, 'CMF%u' % n, 'trend', close.index)
        self.n = n
        self.info = info
        self.cmf, self.cosc = self.Init(high, low, close, volume, n)

        # Signals Chaikin Oscillator Bullish/Bearish. Crossings.
        self.toRise, self.toFall = FindIntersections(self.cosc, 0)
Exemplo n.º 5
0
    def __init__(self, high, low, atr, n=14):
        indicator.__init__(self, 'DMI%u' % n, 'trend', low.index)
        self.n = n
        self.dip, self.din, self.adx = self.InitDMI(high, low, atr)

        # Signals
        fromBottom, fromTop = FindIntersections(self.dip, self.din)
        self.buy = fromBottom
        self.sell = fromTop
Exemplo n.º 6
0
    def __init__(self, high, low, close, n=14, d_n=3):
        indicator.__init__(self, 'Stoch%u' % n, 'momentum', close.index)
        self.n = n
        self.d_n = n
        self.overBoughtLvl = 80
        self.overSellLvl = 20
        self.k, self.d = self.InitStoch(high, low, close)

        # Signals for stoch
        self.buy, self.sell = FindIntersections(self.k, self.d)
Exemplo n.º 7
0
    def __init__(self, close, n=20, k=2):
        indicator.__init__(self, 'Bollinger', 'momentum', close.index)
        self.n = n
        self.k = k
        self.consolidationLvl = 15  # percent
        self.variabilityLvl = 50  # percent
        self.mavg, self.upperBand, self.lowerBand = self.InitBollinger(
            close, self.n, self.k)
        self.std = self.upperBand - self.lowerBand
        self.absStd = (self.std * 100) / self.std.max()

        # Signals
        fromBottom, fromTop = FindIntersections(self.upperBand, close)
        self.sell = fromBottom
        fromBottom, fromTop = FindIntersections(self.lowerBand, close)
        self.buy = fromTop
        self.consolidation = CreateSubsetByValues(self.absStd, 0,
                                                  self.consolidationLvl)
        self.variability = CreateSubsetByValues(self.absStd,
                                                self.variabilityLvl, 100)
Exemplo n.º 8
0
 def __init__(self, close, n=14):
     indicator.__init__(self, 'RSI%u' % n, 'momentum', close.index)
     self.n = n
     self.overBoughtLvl = 70
     self.overSellLvl = 30
     self.hystersis = 5
     self.rsi = self.InitRSI(close, self.n)
     self.notSellSignal = CreateSubsetByValues(self.rsi, 0, 30)
     self.notBuySignal = CreateSubsetByValues(self.rsi, 70, 100)
     self.trendToFall = CreateSubsetByValues(self.rsi, 100 - self.hystersis,
                                             100)
     self.trendToRise = CreateSubsetByValues(self.rsi, 0, self.hystersis)
     self.fromBottom50, self.fromTop50 = FindIntersections(self.rsi, 50)
Exemplo n.º 9
0
    def __init__(self, open, high, low, close):
        indicator.__init__(self, 'Ichimoku', 'momentum', close.index)
        self.tenkanSen, self.kijunSen, self.chikouSpan, self.senkouSpanA, self.senkouSpanB = self.__initIchimoku(
            open, high, low, close)
        self.low = low
        self.signals = pd.DataFrame(columns=['value', 'type', 'name'])

        # Range
        self.pmax = close.max()
        self.pmin = close.min()

        # Signals
        self.buy = None
        self.sell = None

        # Tenkan sen and kijun sen
        fromBottom, fromTop = FindIntersections(self.tenkanSen, self.kijunSen)
        self.__filterAppendSignals('TenKij', 1, fromBottom, fromTop)

        # ClosePrice and kijun sen
        fromBottom, fromTop = FindIntersections(close, self.kijunSen)
        self.__filterAppendSignals('CloseKij', 0, fromBottom, fromTop)

        # Senkou Span cross
        fromBottom, fromTop = FindIntersections(self.senkouSpanA,
                                                self.senkouSpanB,
                                                dropna=False)
        self.__filterAppendSignals('KumoChg', 4,
                                   fromBottom.shift(-26).dropna(),
                                   fromTop.shift(-26).dropna())

        # Chikou Span cross
        fromBottom, fromTop = FindIntersections(self.chikouSpan,
                                                close,
                                                dropna=False)
        self.__filterAppendSignals('ChiClose', 2,
                                   fromBottom.shift(26).dropna(),
                                   fromTop.shift(26).dropna())

        # Kumo Breakout
        kumoTop = pd.concat([self.senkouSpanA, self.senkouSpanB]).max(level=0)
        kumoBottom = pd.concat([self.senkouSpanA,
                                self.senkouSpanB]).min(level=0)
        fromBottom, fromTop = FindIntersections(close, kumoTop)
        self.__appendSignals('KumoBr', 'buy', 3, fromBottom)
        fromBottom, fromTop = FindIntersections(close, kumoBottom)
        self.__appendSignals('KumoBr', 'sell', 3, fromTop)