Both Single Symbol Mode and Multi-Symbol BackTest seem to come close, but ultimately fail in their ability to support scripts designed to trade more than one symbol. Certainly at a simple level they work, but even slightly complicated scripts ultimately have issues.
Here is a simple program design:
CODE:
Please log in to see this code.
the objective is to loop through the entire watchlist (from 0 to WLCount -1) and for each name, create a pair with every name beginning 1 greater than the current symbol, all the way to the end, and then for each pair, add trading symbol logic for each Bar.
The problem is, it doesn't work. It doesn't work because when the Context is Set (to True) the two pairs are not Synched with each other, but rather with whichever symbol was clicked to launch the script.
so, i thought about another method: just do one pass through the list, starting from the clicked symbol and going all the way to the end, and then run the script in MultiSymbolMode -- thereby letting Wealth-Lab do the outer loop. This way, each pair will always be synched to the first clicked symbol from each run. Here is a code fragment for this:
CODE:
Please log in to see this code.
The problem with the above is that it is almost guaranteed to generate System.OutOfMemory errors if the dataset is too large.
Here is my enhancement request:
Write an Override for the SetContext function to make the SetContext "permanent", i.e.
CODE:
Please log in to see this code.
i believe this would allow complex systems to be run in Single System Mode without generating the memory errors and i think it would provide a lot of flexibility in other non-pair types of systems as well.