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

Optimization - expose Indicator result or code directly into Strategy

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

    Optimization - expose Indicator result or code directly into Strategy

    Hi,

    I have an entry strategy that, in a nutshell, is based on rising or falling bars.

    I was wondering which would be better / faster:

    1) Code the conditions and formula into an Indicator, expose the results through Properties (i.e. EnterLong = true), and then reference the indicator in Strategy for entry order placement

    -OR-

    2) Code the conditions and formula directly into the Strategy, and execute from there.

    Or is there any difference in performance at all? I'm planning to run the Indicator/Strat to scan approx 100 instruments at a time, and being a fresh-off-the-boat programmer so to speak, I'm not sure if minor performance improvements would matter when it comes to working with a large number of symbols.

    Thanks!

    -Nick

    #2
    Hi Nick,

    There could be a minor performance gain with option #2. The main impact on performance is the actual calculations made and by placing in a strategy directly you could save some object overhead.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      For my 2 cents, I would say in-line is almost always faster.

      However, that said, depending on the complexity of the function you're calling, the speed gain might not outweigh the benefits of clarity and portability of the code. IOW, the more complex the code in the function, the less effect a function call will have on the speed, but the more confusing the strategy code becomes.

      Small calculations I like to keep in-line, but more complex calculations, or those that I might want access to from something different in the future, I will go with a function call.

      Comment


        #4
        Thanks for the reply, guys.

        I tested out the indicator+strategy method, and did not really notice much lag, so went with that.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Brevo, Today, 01:45 AM
        0 responses
        3 views
        0 likes
        Last Post Brevo
        by Brevo
         
        Started by aussugardefender, Today, 01:07 AM
        0 responses
        3 views
        0 likes
        Last Post aussugardefender  
        Started by pvincent, 06-23-2022, 12:53 PM
        14 responses
        238 views
        0 likes
        Last Post Nyman
        by Nyman
         
        Started by TraderG23, 12-08-2023, 07:56 AM
        9 responses
        384 views
        1 like
        Last Post Gavini
        by Gavini
         
        Started by oviejo, Today, 12:28 AM
        0 responses
        6 views
        0 likes
        Last Post oviejo
        by oviejo
         
        Working...
        X