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 CarlTrading, 03-31-2026, 09:41 PM
        1 response
        67 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        36 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        59 views
        1 like
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        62 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        53 views
        0 likes
        Last Post CarlTrading  
        Working...
        X