def __getNextLine(self, bar):
        ret = None

        if len(self) > 0:
            lastLine = self[-1]
            close = bar.getClose(self.__useAdjustedValues)
            if lastLine.isWhite():
                if close > lastLine.getHigh():
                    # Price extends in the same direction
                    ret = Line(lastLine.getHigh(), close, bar.getDateTime(), True)
                elif self.__isReversal(close, False):
                    # Price change is enough to warrant a reversal.
                    ret = Line(close, lastLine.getLow(), bar.getDateTime(), False)
            else:
                if close < lastLine.getLow():
                    # Price extends in the same direction
                    ret = Line(close, lastLine.getLow(), bar.getDateTime(), False)
                elif self.__isReversal(close, True):
                    # Price change is enough to warrant a reversal.
                    ret = Line(lastLine.getHigh(), close, bar.getDateTime(), True)
        else:
            white = False
            if bar.getClose(self.__useAdjustedValues) >= bar.getOpen(self.__useAdjustedValues):
                white = True
            ret = Line(bar.getLow(self.__useAdjustedValues), bar.getHigh(self.__useAdjustedValues), bar.getDateTime(), white)
        return ret
dataset/ETHPy150Open gbeced/pyalgotrade/pyalgotrade/technical/linebreak.py/LineBreak.__getNextLine/original