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 charlesugo_1, 05-26-2026, 05:03 PM
        0 responses
        52 views
        0 likes
        Last Post charlesugo_1  
        Started by DannyP96, 05-18-2026, 02:38 PM
        1 response
        142 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 05-11-2026, 05:56 AM
        0 responses
        160 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 05-10-2026, 08:12 PM
        0 responses
        96 views
        0 likes
        Last Post CarlTrading  
        Started by Hwop38, 05-04-2026, 07:02 PM
        0 responses
        276 views
        0 likes
        Last Post Hwop38
        by Hwop38
         
        Working...
        X