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

Embedded Indicator and CalculateOnBarClose

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

    Embedded Indicator and CalculateOnBarClose

    Hello,

    Let's assume we have two indicators X and Y where the first one is set to CalculateOnBarClose (COBC) = true and the second one to COBC = false. If X is embedded in Y, does that mean that X would now run as if COBC = false?

    By the way, I stumbled upon an old thread where you said there was a bug related to using the COBC line on any indicator that is embedded (see http://www.ninjatrader.com/support/f...7&postcount=20). Has that bug been solved?

    Thanks in advance,

    Stopped

    #2
    Hi Stopped,

    CalculateOnBarClose should be assigned a maximum of 1 time in the calling script only. If your script A calls other scripts B and C, scripts B and C should not have any COBC assignment within.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Thanks RyanM,

      Just to clarify, regarding my first question, if A calls B and A has the COBC property set to False, would that mean that B would now be running with the COBC property set to False too?

      I am asking this because I had developed an indicator that was running correctly when calculated with COBC = True, but I am getting wrong results when I embedded that indicator into another one that is running with COBC = False.

      Thanks again.

      Comment


        #4
        Yes, you can have unexpected results and your indicator may not work properly if you assign COBC in called indicators. There's no answer here other than to follow this as best practice.

        Since you can always assign COBC from the indicator GUI, its assignment in a script should be avoided as often as possible. Assign only if the design of the indicator requires it, or you want to save time setting it via code while testing.

        If you need to combine parts of your script with COBC = true/false, this sample offers the recommended approach.
        Last edited by NinjaTrader_RyanM1; 10-17-2011, 10:53 AM.
        Ryan M.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by rocketman7, Today, 01:00 AM
        0 responses
        1 view
        0 likes
        Last Post rocketman7  
        Started by wzgy0920, 04-20-2024, 06:09 PM
        2 responses
        27 views
        0 likes
        Last Post wzgy0920  
        Started by wzgy0920, 02-22-2024, 01:11 AM
        5 responses
        32 views
        0 likes
        Last Post wzgy0920  
        Started by wzgy0920, 04-23-2024, 09:53 PM
        2 responses
        74 views
        0 likes
        Last Post wzgy0920  
        Started by Kensonprib, 04-28-2021, 10:11 AM
        5 responses
        193 views
        0 likes
        Last Post Hasadafa  
        Working...
        X