I want to pick the stocks that I long/short based on some initial calculations that only need be be run once. These are based on historical pricing data so I need access to this. When I try this in the 'initialize' sub I get an error because data has not been defined?
The only way around this that I can think of is to have an if statement in my before day trading, that runs the first time and then skips the code, but this seems like a bit of a hacky way to do it - is there a built in method I should use?