Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
so I was trying to come up with a way to more efficiently backtest/optimize parameters for my strategies, and I was thinking that several parameters should probably match (e.g. length of bars to consider).
After some digging, I saw a post which detailed how to use a GlobalDictionary for a sender/receiver(s), so that I might be able to have the receivers (say, entry/exit strategies) use the same parameters as the sender (say, indicator(s) from which strategies are based). The problem I'm running into is that trying to invoke the GlobalDictionary alone (to, for example, set the values in the dictionary as part of the indicator calculation) appears to slow my indicator/strategy calculations by quite a lot... So much so that it makes even generating the indicator by itself take at least 10x as long as it otherwise would. Am I doing something wrong here? Is this expected behavior with the GlobalDictionary? Or is there a different construct I should be using instead?
Thank you!
Can you help answer these questions from other members on NexusFi?
After doing some searching, I found another construct that allows sharing between analysis techniques and strategies: GlobalValue. This, too, appears to suffer from the same problem...
So, I was able to use GlobalValue, but upon trying to optimize inputs, I was informed that "GlobalDictionary does not support multithreaded...*stuff*". My last thought then was to pass in a bunch of numericrefs, one set of them so that the "sender" could update the values, and another set so that the "receiver" can grab them from the function once they're set... Much to my dismay, it would appear as though each strategy creates its own instance of the function. So, the assumption of being able to use the numericrefs as a sort of sender/receiver contract was false. I am now at a loss... Is it really not possible to have multiple strategies adhere to the same inputs, without setting them all to the same thing, and making optimization of parameters nearly worthless (since they're almost certainly going to use different lengths for the computations after optimization, even though they're based on the same indicator)? Any advice here would be greatly appreciated!
Also.. I think it would be possible to do as I describe by using a super mondo strategy that encompasses both the entry as well as the exits, but the programmer in me believes that to be a terrible solution due to separation of concerns and all this... There has to be a better way
it sounds like your Global Dictionary is not configured for multi threading as this shouldn't be a problem.
Check out the example in the help file:
In general I would say that the Dictionary is likely the bottleneck of your code and reducing calls to it to a minimum should speed up things (although the end result will likely still be slower than code without the dictionary). For example not reading the values on every tick/bar, but using the event handlers to only read the values when there was a change should speed things up.
It's now 2020 and I'm on TradeStation 10 update 50. I spent 4 days building a function using GlobalDictionary and it's set to Share. I did this because I need to read a file and didn't want to do that on every bar (tick?). Anyhow, I CAN CONFIRM IT IS STILL STUPIDLY SLOW. I'm using two data streams, 1 minute and 1 day. With 12 months of data loaded it takes 3 full minutes to recalc. If I put in dummy values for the function call it takes 3 seconds so 60 times faster.