Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Execution Efficiency

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Execution Efficiency

    Does anyone know which approach executes more efficiently:

    1. Have strategy call an indicator multiple times during execution, or
    2. Have the strategy call the indicator once, store the result and use it during its calculations?

    Rod

    #2
    Rod,

    The latter would be more computationally efficient overall, though with the speed of modern processors it wouldn't necessarily use up much more resources to do it the first way, but this would depend on the indicator you are using.

    1 would probably use more processor time, 2 would maybe use a bit more memory. Typically this is a trade off in different algorithms people use, i.e. if you increase memory usage you can decrease processor usage, if you increase processor usage you can decrease memory usage. Its not always this way, but a rule of thumb. In either case I believe the difference would be negligible unless the indicator is computationally intensive.

    Please let me know if you have any other questions.
    Last edited by NinjaTrader_AdamP; 04-18-2012, 08:31 AM.
    Adam P.NinjaTrader Customer Service

    Comment


      #3
      2 would always win, but you might lose code readability ...


      I would do #2, but only if it is slow to compute, like for some custom indicator.

      It is probably best to get something working, then optimize after.




      Originally posted by RodS7 View Post
      Does anyone know which approach executes more efficiently:

      1. Have strategy call an indicator multiple times during execution, or
      2. Have the strategy call the indicator once, store the result and use it during its calculations?

      Rod

      Comment


        #4
        thanks to you both - my instincts said that '2' would be optimal
        Last edited by RodS7; 04-18-2012, 12:51 PM.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by alifarahani, Today, 09:40 AM
        3 responses
        15 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by RookieTrader, Today, 09:37 AM
        4 responses
        17 views
        0 likes
        Last Post RookieTrader  
        Started by PaulMohn, Today, 12:36 PM
        0 responses
        4 views
        0 likes
        Last Post PaulMohn  
        Started by love2code2trade, 04-17-2024, 01:45 PM
        4 responses
        40 views
        0 likes
        Last Post love2code2trade  
        Started by junkone, Today, 11:37 AM
        3 responses
        23 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Working...
        X