def __init__(self, feed, p1, p2, instrument): super(RSI2, self).__init__(feed, 10000, round=lambda x: int(x), commission=NoCommission()) self.__instrument = instrument self.__priceDS = feed[instrument].price self.__entrySMA = ma.SMA(self.__priceDS, 240) self.__exitSMA = ma.SMA(self.__priceDS, 240) self.__rsi = rsi.RSI(self.__priceDS, 240) self.__p1 = p1 self.__p2 = p2 self.__longPos = None self.__shortPos = None
def SMA80(i): return ma.SMA(i, 80)
def SMA40(i): return ma.SMA(i, 40)
def SMA20(i): return ma.SMA(i, 20)
def SMA240(i): return ma.SMA(i, 240)
def SMA120(i): return ma.SMA(i, 120)