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 SalmaTrader, 07-07-2026, 10:26 PM
        0 responses
        50 views
        0 likes
        Last Post SalmaTrader  
        Started by CarlTrading, 07-05-2026, 01:16 PM
        0 responses
        22 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 06-17-2026, 10:32 AM
        0 responses
        16 views
        0 likes
        Last Post CaptainJack  
        Started by kinfxhk, 06-17-2026, 04:15 AM
        0 responses
        22 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Started by kinfxhk, 06-17-2026, 04:06 AM
        0 responses
        23 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Working...
        X