Find the intraday "high" and "low" in 1min bar?
-
Hello everyone, i am a newbie using backtrader. i would like to ask for some helps.
i am going do intraday trading in 1mins, how can i find the intraday "high" and "low" in "self"?init
self.datahigh = self.datas[0].high
self
Dayhigh = max(self.datahigh[:0])
it seems slicing cannot be applied in bt, and how to use get(size=0,ago=??) to find the high at beginning ?
-
@Anthony-Chow said in Find the intraday "high" and "low" in 1min bar?:
ize=0,ago=??) to find the high at beginning ?
Dayhigh = max(self.datahigh.get(size=len(self),ago=0))
I think this will work. Size is the number of candles you want to account for while ago is how many candles ago you want the iteration to end
-
Also I think max should be 'Max'. I don't think it should make a difference but the documentation prefers this method
-
There's a couple of articles that should have enough information to help you along. Try the following and the link outs from within the articles as well: