I want to create a backtest sheet where all trades are there with trade time and price with exit price. In reinforcement learning all the things are done by the library they have given.
Hi Himanshu,
All calculations related to trades are done in the functions we have created instead of using any library. So, you can tweak the functions to extract the data you require for further analysis.
To create the backtest sheet, you can access data related to trades by modifying the 'run' function available in the notebook.
For example, you can extract the trade data by using the following variables at the end of the while loop in the 'run' function.
1. trade_entry_time : env.bars5m.index[env.curr_idx-env.trade_len]
2. trade_entry_price : env.bars5m['close'][env.curr_idx-env.trade_len]
3. trade_exit_time : env.curr_time
4. trade_exit_price : env.bars5m['close'][env.curr_idx]
5. position : env.position
you can create an empty dataframe before executing the 'run' function and append the above 5 variables as columns at the end of the while loop in the 'run' function to generate all details of the trades. This can be used to create backtest sheet you need.
Hope this helps!