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 Balage0922, Today, 07:38 AM
        0 responses
        1 view
        0 likes
        Last Post Balage0922  
        Started by JoMoon2024, Today, 06:56 AM
        0 responses
        6 views
        0 likes
        Last Post JoMoon2024  
        Started by Haiasi, 04-25-2024, 06:53 PM
        2 responses
        19 views
        0 likes
        Last Post Massinisa  
        Started by Creamers, Today, 05:32 AM
        0 responses
        6 views
        0 likes
        Last Post Creamers  
        Started by Segwin, 05-07-2018, 02:15 PM
        12 responses
        1,786 views
        0 likes
        Last Post Leafcutter  
        Working...
        X