exiting 3 days after entry
jh124532
Posts: 1
I am still very much learning but could anyone share thoughts on how to construct an exit for the end of general trading hours (4pm ) 3 days after entry?
Not worried about the specifics of exiting at 4PM more curious how to code the 3 days in the future.
Comments
Trevor Trinkino : You can setup a class dictionary that saves the value for the number of days since you entered the position, then you can update it each day and reference the dictionary at the end of each day to exit. Also need to run the backtest as a single multiday job
David Bradley : you can use the order_id returned by algo_buy / algo_sell as keys in the dictionary, make sure to put it in on_save / on_restore
Steven Chai : one cheap way to do this....