code: def onBars(self, bars):
      # If a position was not opened, check if we should enter a long position.
      if self.__position is None:
          if cross.cross_above(self.__prices, self.__sma) > 0:
              shares = int(
                  self.getBroker().getCash()
                  * 0.9
                  / bars[self.__instrument].getPrice()
              )
              # Enter a buy market order. The order is good till canceled.
              self.__position = self.enterLong(
                  self.__instrument, shares, True
              )
      # Check if we have to exit the position.
      elif (
          not self.__position.exitActive()
          and cross.cross_below(self.__prices, self.__sma) > 0
      ):
          self.__position.exitMarket()
  
file_path: pyalgotrade/samples/sma_crossover.py
imports: from pyalgotrade import strategy
  from pyalgotrade.technical import ma
  from pyalgotrade.technical import cross
label_desc: Use image node_id 6 for calling the SMACrossOver obj's underlying member method code with example usage: obj.onBars(bars) without return types