def onBars(self, bars):
    if (self.__ma2[(- 1)] is None):
        return
    if (self.__position is not None):
        if ((not self.__position.exitActive()) and (cross.cross_below(self.__ma1, self.__ma2) > 0)):
            self.__position.exitMarket()
    if (self.__position is None):
        if (self.buyCon1() and self.buyCon2()):
            shares = int(((self.getBroker().getCash() * 0.2) / bars[self.__instrument].getPrice()))
            self.__position = self.enterLong(self.__instrument, shares)
            print(bars[self.__instrument].getDateTime(), bars[self.__instrument].getPrice())
def onBars(self, bars):
    if (self.__ma2[(- 1)] is None):
        return
    if (self.__position is not None):
        if ((not self.__position.exitActive()) and (cross.cross_below(self.__ma1, self.__ma2) > 0)):
            self.__position.exitMarket()
    if (self.__position is None):
        if (self.buyCon1() and self.buyCon2()):
            shares = int(((self.getBroker().getCash() * 0.2) / bars[self.__instrument].getPrice()))
            self.__position = self.enterLong(self.__instrument, shares)
            print(bars[self.__instrument].getDateTime(), bars[self.__instrument].getPrice())