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

leszek

#1
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:
CODE:
Please log in to see this code.
profile picture

Eugene

#2
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

leszek

#3
agreed. :)
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).