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 llanqui, Today, 03:53 AM
        0 responses
        2 views
        0 likes
        Last Post llanqui
        by llanqui
         
        Started by burtoninlondon, Today, 12:38 AM
        0 responses
        10 views
        0 likes
        Last Post burtoninlondon  
        Started by AaronKoRn, Yesterday, 09:49 PM
        0 responses
        14 views
        0 likes
        Last Post AaronKoRn  
        Started by carnitron, Yesterday, 08:42 PM
        0 responses
        11 views
        0 likes
        Last Post carnitron  
        Started by strategist007, Yesterday, 07:51 PM
        0 responses
        14 views
        0 likes
        Last Post strategist007  
        Working...
        X