I trade a different list of stocks each day. I'm trying to work out a good way to backtest and am hoping there's a good way that people have thought out for this.
Manually running the strategy on each instrument for each day and looking at the result, chart, then tabulating is not practical. Each time I make one small change to try and optimise the strategy I would need to re-run. Considering just 2 months of testing for 4 stocks a day would mean I would need to run around 240 separate runs then tabulate.
I'm hoping there is an easier way than the following.
The only idea I've come up with is the following:
- create a single strategy that loops through a number of instruments for each bar (say 1minute) each day
- for each day, the strategy would need to load the instruments from file (say at 9:29 am each morning) just before the open
- create a file that the strategy loads on startup. It parses the entire file and loads the instruments for that particular date (for example there may be 2 or 3 stocks on a certain date).
- every bar / tick update etc, would need to cycle through each instrument and check for entry/exit conditions.
A few questions:
1) is there another better way to do the above?
2) can you load instruments (Add data series) dynamically as the strategy runs? I've only ever done this at initialise time
Comment