title: Pyalgotrade - TA-LIB - Indicator Returns "NONE"
body: <p>I'm working with Pyalgotrade to test a trading strategy in python. Pyalgotrade allows for the use of a library called TA-LIB,which is a technical analysis library. For some reason, when I use the PPO indicator it returns "None". The indicator takes in a few arguments:(<a href="http://gbeced.github.io/pyalgotrade/docs/v0.12/html/talib.html" rel="nofollow noreferrer">http://gbeced.github.io/pyalgotrade/docs/v0.12/html/talib.html</a>)</p>
  
  <p>I provided a snippet of the output which for now is only the closing stock price of the day and what was supposed to be the output from this indicator. 'DDD' is the ticker I've been testing with.</p>
  
  <p>I've been trying to get this to work for longer than I would like to admit. 
  How can I fix this?</p>
  
  <p>OUTPUT:</p>
  
  <pre><code>2016-11-08 00:00:00 strategy [INFO] 13.56,None
  2016-11-09 00:00:00 strategy [INFO] 13.77,None
  2016-11-10 00:00:00 strategy [INFO] 14.06,None
  2016-11-11 00:00:00 strategy [INFO] 14.71,None
  2016-11-14 00:00:00 strategy [INFO] 14.3,None
  2016-11-15 00:00:00 strategy [INFO] 13.91,None
  </code></pre>
  
  <p>Here's my code:</p>
  
  <pre><code>from pyalgotrade import strategy
  from pyalgotrade.tools import yahoofinance
  from pyalgotrade import talibext
  from pyalgotrade.talibext import indicator
  import talib
  import numpy
  
  class MyStrategy(strategy.BacktestingStrategy):
      def __init__(self, feed, instrument):
          super(MyStrategy, self).__init__(feed, 1000)
          self.__position = None
          self.__instrument = instrument
          self.setUseAdjustedValues(True) 
          self.__prices = feed[instrument].getPriceDataSeries()
  
          self.__PPO = talibext.indicator.PPO(feed,0,12,26,9)
  
      def onEnterOk(self, position):
          execInfo = position.getEntryOrder().getExecutionInfo()
          self.info("BUY at $%.2f" % (execInfo.getPrice()))
  
      def onEnterCanceled(self, position):
          self.__position = None
  
      def onExitOk(self, position):
          execInfo = position.getExitOrder().getExecutionInfo()
          self.info("SELL at $%.2f" % (execInfo.getPrice()))
          self.__position = None
  
      def onExitCanceled(self, position):
          # If the exit was canceled, re-submit it.
          self.__position.exitMarket()
  
      def onBars(self, bars):
  
          bar = bars[self.__instrument]
          self.info("%s,%s" % (bar.getClose(),self.__PPO))
  
      def run_strategy(inst):
      # Load the yahoo feed from the CSV file
  
      feed = yahoofinance.build_feed([inst],2015,2016, ".")
  
      # Evaluate the strategy with the feed.
      myStrategy = MyStrategy(feed, inst)
      myStrategy.run()
      print "Final portfolio value: $%.2f" % myStrategy.getBroker().getEquity()
  
  
  def main():
      instruments = ['ddd']
      for inst in instruments:
              run_strategy(inst)
  
  
  if __name__ == '__main__':
          main()
  </code></pre>