Regarding lookback period and width

Course Name: Deep Reinforcement Learning in Trading, Section No: 11, Unit No: 8, Unit type: Notebook

I didn't understand what is lookback and what is wdw5m and why it is taken 9 and why wdw1h,1d are multiplied by 15/24 and 15 respectively. Please help regarding this

Hi,



Before the notebook on "Assemble States", there is a notebook in section 11 unit 3 titled "Get Last N Time Bars" where we have discussed how to resample existing 1-minute data to different intervals.



First, you are starting off with 5-minute data. and for that the width is taken as 9 days, i.e. we first define the width(time interval, in days) for the 5 minutes as 9 days.



For width of 1 hour time bars, we will multiply the lookback period by 15 in order to create a time interval(width) wider than the lookback period and divide it by 24 as there are 24 hours in a day. Finally, we will apply ceil method on that (You can refer to the notebook on why this function is used). This is done to make sure that the width should be greater than the lookback period and that's why we multiply lookback period with an arbitrarily chosen number(15) higher than the lookback period.



For width of 1 day time bars, we will multiply the lookback period by 15 (to have a wider time interval than lookback period) and apply ceil method on that.





I hope this helps.

why it is 9 days, is it like hyperparameter that we choose or there is any logic behind this?

Hi,



The width of 9 days is arbitrarily chosen. Choosing a width is done to reduce the computation power as whenever you create time bars for certain lookback, you need to pull data from the start date.



Hope this helps.