Parallelizing buy/sell decisions in a multiple symbol strategy
Author: leszek
Creation Date: 5/6/2014 4:04 PM
profile picture


When your strategy includes multiple symbols and the buy/sell decisions per symbol are independent then you can easily parallelize those decisions per bar in your Execute function. Performance increase will depend on how many symbols you have and how computationally intensive are the buy/sell decisions - the more symbols you have and the more intensive the decisions are the more you'll gain in performance in backtesting etc. Here's a strategy example that uses the DJIA stocks with random buy/sell decisions that take at least 1 millisecond each:
Please log in to see this code.
profile picture


That's a great way to speed up a Strategy, so thank you for sharing this design pattern with the community. Personally, I prefer to use Parallel.For/ForEach for they're more intuitive and convenient than the ThreadPool (no WaitHandle, no AutoResetEvent, terser code - you know).
profile picture


agreed. :)