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

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.
    JimNinjaTrader Customer Service

    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
        JimNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by frankthearm, Today, 09:08 AM
        3 responses
        9 views
        0 likes
        Last Post NinjaTrader_Clayton  
        Started by yertle, Today, 08:38 AM
        5 responses
        15 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Started by adeelshahzad, Today, 03:54 AM
        3 responses
        16 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Started by bill2023, Yesterday, 08:51 AM
        6 responses
        27 views
        0 likes
        Last Post NinjaTrader_Erick  
        Started by NinjaTrader_ChelseaB, 01-08-2017, 06:59 PM
        80 responses
        19,667 views
        5 likes
        Last Post NinjaTrader_ChelseaB  
        Working...
        X