Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Question About Adding Indicator Through Strategy

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

    Question About Adding Indicator Through Strategy

    Hello,

    When I add an indicator through a strategy with the Add() function in Initialize.. will the indicator be set to Calculate On Tick if the Strategy is also set to Calculate On Tick?

    Thank you for your time and response.

    #2
    Hello otislauwaert,

    Thanks for your post.

    Indicators added to a NinjaScript will inherit the CalculateOnBarClose property from the parent NinjaScript. In the case of adding an indicator to a strategy, the indicator will inherit the CalculateOnBarClose setting of the strategy.

    Publicly available information on CalculateOnBarClose can be found here - https://ninjatrader.com/support/help...onbarclose.htm

    Let us know if we can be of further assistance.

    Comment


      #3
      Originally posted by otislauwaert View Post
      When I add an indicator through a strategy with the Add() function in Initialize.. will the indicator be set to Calculate On Tick if the Strategy is also set to Calculate On Tick?
      Yes, but I'm pretty sure you can intervene (if needed) and do whatever you want.

      This example forces the inheritance:
      EMA ind = EMA(50);
      ind.CalclulateOnBarClose = CalculateOnBarClose;
      Add(ind);

      This example forces running on every tick:
      EMA ind = EMA(50);
      ind.CalclulateOnBarClose = false;
      Add(ind);

      This example forces running on close of every bar:
      EMA ind = EMA(50);
      ind.CalclulateOnBarClose = true;
      Add(ind);

      Comment


        #4
        Hello bltdavid,

        Testing the suggestion provided here does accomplish the goal. I've included an export that tests this. We don't have a supported way to set COBC for a child indicator from a parent NinjaScript, but if you have another way to do this, could you share an export that demonstrates?

        Attached Files

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        571 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        331 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        101 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        549 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        549 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X