コード例 #1
0
ファイル: cmf.py プロジェクト: mrotke/pyStock
    def __init__(self, high, low, close, volume, info, n=21):
        indicator.__init__(self, 'CMF%u' % n, 'trend')
        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)
コード例 #2
0
ファイル: dmi.py プロジェクト: mrotke/pyStock
    def __init__(self, high, low, atr, n=14):
        indicator.__init__(self, 'DMI%u' % n, 'trend')
        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
コード例 #3
0
    def __init__(self, high, low, close, n=14, d_n=3):
        indicator.__init__(self, 'Stoch%u' % n, 'momentum')
        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)
コード例 #4
0
    def __init__(self, high, low, close, n=14):
        indicator.__init__(self, 'CCI%u' % n, 'momentum')
        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
コード例 #5
0
 def __init__(self, prices, n=14):
     indicator.__init__(self, 'RSI%u' % n, 'momentum')
     self.n = n
     self.overBoughtLvl = 70
     self.overSellLvl = 30
     self.hystersis = 5
     self.rsi = self.InitRSI(prices, 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)
コード例 #6
0
    def __init__(self, high, low, close, volume, info, n=14):
        indicator.__init__(self, 'MFI%u' % n, 'momentum')
        self.n = n
        self.info = info
        self.typicalPrice = (high + low + close) / 3
        self.moneyFlow, self.posFlow, self.negFlow, self.mfi = self.InitMoneyFlow(
            self.typicalPrice, volume, n)
        # money on the market plot
        self.moneyMarket = self.moneyFlow.cumsum()

        # Signals
        fromBottom, fromTop = FindIntersections(self.mfi, 20)
        self.buy = fromBottom
        fromBottom, fromTop = FindIntersections(self.mfi, 80)
        self.sell = fromTop
        # TrenToFall / TrendToRise
        fromBottom, fromTop = FindIntersections(self.mfi, 10)
        self.buyStrong = fromBottom
        fromBottom, fromTop = FindIntersections(self.mfi, 90)
        self.sellStrong = fromTop
コード例 #7
0
ファイル: trend.py プロジェクト: mrotke/pyStock
 def __init__(self, data, type='rising'):
     indicator.__init__(self, 'Trend', 'trend')
     self.type = type
     self.trends = self.Init(data)