can timer cross several days
gl837617
Posts: 3
Can I set a time that across days or weeks?
Can I set a time that across days or weeks?
Comments
No, but if you are using defaultdict you could add an extra couple of keys.. date and time.. then each morning check if the date matches.. if it does set a timer up for the time value.
A default dict returns a default value if the dictionary does not contain that entry...
We set up the default dict above the model, at the class level, and it is available throughout the backtest.
This is a very simple default dict based model,
The first time past the symbol is not in the dictionary so it returns the default of 0.
If it is zero we enter a position and pop a one in there (day one).
Each day, if we are in a position it adds one to 'inPos'
When 'inPos' reaches 5 it exits and puts 999 in there.