code: def onNewValue(self, dateTime, value):
      super(RSIEventWindow, self).onNewValue(dateTime, value)
  
      # Formula from http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:relative_strength_index_rsi
      if value is not None and self.windowFull():
          if self.__prevGain is None:
              assert self.__prevLoss is None
              avgGain, avgLoss = avg_gain_loss(
                  self.getValues(), 0, len(self.getValues())
              )
          else:
              # Rest of averages are smoothed
              assert self.__prevLoss is not None
              prevValue = self.getValues()[-2]
              currValue = self.getValues()[-1]
              currGain, currLoss = gain_loss_one(prevValue, currValue)
              avgGain = (
                  self.__prevGain * (self.__period - 1) + currGain
              ) / float(self.__period)
              avgLoss = (
                  self.__prevLoss * (self.__period - 1) + currLoss
              ) / float(self.__period)
  
          if avgLoss == 0:
              self.__value = 100
          else:
              rs = avgGain / avgLoss
              self.__value = 100 - 100 / (1 + rs)
  
          self.__prevGain = avgGain
          self.__prevLoss = avgLoss
  
file_path: pyalgotrade/pyalgotrade/technical/rsi.py
imports: from six.moves import xrange
  from pyalgotrade import technical
label_desc: Use image node_id 2 for calling the RSIEventWindow obj's underlying member method code with example usage: obj.onNewValue(dateTime, value) without return types