Hi Everyone,
Attached is the code that I use. I guess the title of this discussion says it all but im really having a hard time adding securities on the fly and then retreiving data. All I could find in the documentation and looking at other discussions are codes that only add a few securities in the INITIALIZE function but nothing in custom function.
THe code returns this error:
Backtest Handled Error: The order quantity for JNJ cannot be calculated: the price of the security is zero.
Also, all current prices returned by the Debug function return a price of $0.
Side question: Why is this code so slow ?! When I run it for a longer period, it takes hours to run. Does it have to do with "
self.UniverseSettings.Resolution = Resolution.Minute"if so, I would gladly put a daily resolution but will I be able to run the code 1 and 2 minutes after open ?
Thanks in advance.