• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

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.
    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 cutzpr, Today, 08:44 AM
        1 response
        4 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by Burak, Yesterday, 10:40 PM
        1 response
        3 views
        0 likes
        Last Post NinjaTrader_ChrisL  
        Started by AdmiralUptick, Today, 05:35 AM
        1 response
        13 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by Gav_G, Today, 02:12 PM
        2 responses
        5 views
        0 likes
        Last Post Gav_G
        by Gav_G
         
        Started by Gav_G, Today, 01:41 PM
        0 responses
        5 views
        0 likes
        Last Post Gav_G
        by Gav_G
         
        Working...
        X