NexusFi: Find Your Edge


Home Menu

 





GlobalDictionary - incredibly inefficient calculations?


Discussion in TradeStation

Updated
      Top Posters
    1. looks_one technoloG with 3 posts (0 thanks)
    2. looks_two Big Mike with 1 posts (0 thanks)
    3. looks_3 MagicTH with 1 posts (1 thanks)
    4. looks_4 ABCTG with 1 posts (1 thanks)
    1. trending_up 1,723 views
    2. thumb_up 2 thanks given
    3. group 3 followers
    1. forum 5 posts
    2. attach_file 0 attachments




 
Search this Thread

GlobalDictionary - incredibly inefficient calculations?

  #1 (permalink)
 technoloG 
Walnut Creek, CA/USA
 
Experience: Beginner
Platform: Tradestation
Broker: Tradestation
Trading: Interest Rate Futures
Posts: 6 since Sep 2018
Thanks Given: 3
Thanks Received: 1

Hi all,

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!

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Futures True Range Report
The Elite Circle
Are there any eval firms that allow you to sink to your …
Traders Hideout
Exit Strategy
NinjaTrader
ZombieSqueeze
Platforms and Indicators
The space time continuum and the dynamics of a financial …
Emini and Emicro Index
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Get funded firms 2023/2024 - Any recommendations or word …
61 thanks
Funded Trader platforms
39 thanks
NexusFi site changelog and issues/problem reporting
26 thanks
The Program
18 thanks
GFIs1 1 DAX trade per day journal
18 thanks
  #2 (permalink)
 technoloG 
Walnut Creek, CA/USA
 
Experience: Beginner
Platform: Tradestation
Broker: Tradestation
Trading: Interest Rate Futures
Posts: 6 since Sep 2018
Thanks Given: 3
Thanks Received: 1

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...

Started this thread Reply With Quote
  #3 (permalink)
 technoloG 
Walnut Creek, CA/USA
 
Experience: Beginner
Platform: Tradestation
Broker: Tradestation
Trading: Interest Rate Futures
Posts: 6 since Sep 2018
Thanks Given: 3
Thanks Received: 1


An update:

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

Started this thread Reply With Quote
  #4 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,431 since Apr 2013
Thanks Given: 481
Thanks Received: 1,623

technoloG,

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:
 
Code
To create an instance of GlobalDictionary to share values within same window type:

myGlobal = GlobalDictionary.create();

To create an instance of GlobalDictionary to share values beyond the same window type or between two charts when multi-core charting is enabled.

myGlobal = GlobalDictionary.create(true, "share_name");
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.

Regards,

ABCTG

Follow me on Twitter Reply With Quote
Thanked by:
  #5 (permalink)
MagicTH
Denver CO/USA
 
Posts: 2 since May 2018
Thanks Given: 0
Thanks Received: 1

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.

Reply With Quote
Thanked by:
  #6 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,396 since Jun 2009
Thanks Given: 33,172
Thanks Received: 101,536

Have you tried MultiCharts by chance?

MagicTH View Post
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.

Sent using the NexusFi mobile app

We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote




Last Updated on December 10, 2020


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts