Announcement

Collapse
No announcement yet.

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 Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        630 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        364 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        105 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        566 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        568 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X