I found that:
self.dataclose[-1] represents the price of todate and self.dataclose[-2] represents the price of previous day of todate.