Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

CalculateOnBarClose

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

    CalculateOnBarClose

    I have an indicator that uses CalculateOnBarClose=False. I'm using it in a strategy that uses CalculateOnBarClose=True.

    In the initialize section i put add(theIndicator) and it adds it to the chart when I start the strategy. However, it appears to be setting CalculateOnBarClose=true, which is not how the indicator is designed. Is this correct? Is there a way to change it?

    Rich

    #2
    Hi Rich,

    If you're using the indicator in a strategy, you don't want to assign COBC anywhere in the indicator.

    Only the calling (in this case the strategy) script should assign COBC.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Follow-up question

      So your saying that if the strategy is set to COBC=false, the indicator will always be the same and that I need to program the indicator to work with COBC=false. Is that correct?

      Rich

      Comment


        #4
        Yes, you only want COBC assigned in one place -- the strategy.

        You don't want to assign COBC in the indicator, but can code in your strategy logic that only checks its value at bar close. For this, can use FirstTickOfBar to check new bars. A complete sample on combining cobc true / false logic within one script is available here:
        Ryan M.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by charlesugo_1, 05-26-2026, 05:03 PM
        0 responses
        59 views
        0 likes
        Last Post charlesugo_1  
        Started by DannyP96, 05-18-2026, 02:38 PM
        1 response
        143 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 05-11-2026, 05:56 AM
        0 responses
        161 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 05-10-2026, 08:12 PM
        0 responses
        97 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