Yvictor / TradingGym

Trading and Backtesting environment for training reinforcement learning agent or simple rule base algo.
MIT License
1.54k stars 349 forks source link

step_len is added twice to check it exceeds len(self.price) #13

Closed jsrimr closed 3 years ago

jsrimr commented 3 years ago

https://github.com/Yvictor/TradingGym/blob/8af2bb02250797c580b37c7ef43aab21b2d968c7/trading_env/envs/training_v1.py#L183-L207

Maybe line 207 should be changed from

 if self.step_st+self.obs_len+self.step_len >= len(self.price):

to

 if self.step_st+self.obs_len >= len(self.price):
DenisLitvin commented 3 years ago

It looks correct. imagine step_st is a current index/step in a states array, whereas step_len is just an amount of steps it jumps when iterating