def __init__(self, feed, entrySMA, exitSMA, rsiPeriod, overBoughtThreshold, overSoldThreshold):
     strategy.Strategy.__init__(self, feed, 2000)
     ds = feed["dia"].get_close_data_series()
     self.__entrySMA = ma.SMA(ds, entrySMA)
     self.__exitSMA = ma.SMA(ds, exitSMA)
     self.__rsi = rsi.RSI(ds, rsiPeriod)
     self.__overBoughtThreshold = overBoughtThreshold
     self.__overSoldThreshold = overSoldThreshold
     self.__longPos = None
     self.__shortPos = None
 def __init__(self, feed, fastSMA, slowSMA):
     strategy.Strategy.__init__(self, feed, 1000)
     ds = feed["orcl"].get_close_data_series()
     fastSMADS = ma.SMA(ds, fastSMA)
     slowSMADS = ma.SMA(ds, slowSMA)
     self.__crossAbove = cross.CrossAbove(fastSMADS, slowSMADS)
     self.__crossBelow = cross.CrossBelow(fastSMADS, slowSMADS)
     self.__longPos = None
     self.__shortPos = None
     self.__finalValue = None
Beispiel #3
0
    def __init__(self, feed, smaPeriod):
        strategy.Strategy.__init__(self, feed)

        assert (smaPeriod > 3)
        self.__lead = "^n225"
        self.__lag = "spy"
        # Exit signal is more sensitive than entry.
        adj_close = feed[self.__lead].get_adj_close_data_series()
        self.__crossAbove = cross.CrossAbove(adj_close,
                                             ma.SMA(adj_close, smaPeriod))
        self.__crossBelow = cross.CrossAbove(
            adj_close, ma.SMA(adj_close, int(smaPeriod / 2)))
        self.__pos = None
Beispiel #4
0
 def __init__(self, feed, smaPeriod):
     strategy.Strategy.__init__(self, feed, 1000)
     closeDS = feed["orcl"].get_close_data_series()
     self.__sma = ma.SMA(closeDS, smaPeriod)
     self.__crossAbove = cross.CrossAbove(closeDS, self.__sma)
     self.__crossBelow = cross.CrossBelow(closeDS, self.__sma)
     self.__position = None
Beispiel #5
0
 def __init__(self, feed):
     strategy.Strategy.__init__(self, feed)
     self.__rsi = rsi.RSI(feed["orcl"].get_close_data_series(), 14)
     self.__sma = ma.SMA(self.__rsi, 15)
Beispiel #6
0
 def __init__(self, feed):
     strategy.Strategy.__init__(self, feed)
     # We want a 15 period SMA over the closing prices.
     self.__sma = ma.SMA(feed["orcl"].get_close_data_series(), 15)
Beispiel #7
0
 def __init__(self, feed, smaPeriod):
     strategy.Strategy.__init__(self, feed, 1000)
     self.__sma = ma.SMA(feed["orcl"].get_close_data_series(), smaPeriod)
     self.__position = None