Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

MultiTimeFrame CalcOnBarClose

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

    MultiTimeFrame CalcOnBarClose

    Hey Everybody,
    When using MultiTimeFrame charts in a strategy, is it possible to set CalculateOnBarClose = true on one and CalculateOnBarClose = false on the other? I've searched Help and the Forum and can't find the answer.

    The second chart (index 1) is exactly the same as the primary (index 0). Both are 10 Range.

    When the primary is in CalcOnBarClose = false, I want the index 1 chart to stay in CalcOnBarClose = true.

    So, when a condition happens on the index 1 chart (COBC = true), I want the primary chart (COBC = false) to see that and take action.

    Is it even possible to have one chart processing tic by tic and the other processing bar by bar in the same strategy? I've tried all kinds of things, but the strat will always run on one or the other.

    Thanks,
    Joe

    #2
    No, processing of the script is all or nothing for CalculateOnBarClose. It will either be all true or all false. If you want to mimic some true and some false, you need to set it to false and duplicate the true logic by filtering out all the intrabar processing with if (FirstTickOfBar).
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      OK, that's what I kind of suspected. I thought about FirstTickOfBar but it won't work since I need to know whether the last Range Bar closed higher or lower than it opened.
      Thanks for the speedy reply!
      Joe

      Comment


        #4
        The closing event of a bar is the same event as the opening of the next bar. So you can use if (FirstTickOfBar) and then back reference the indexes by 1 to access the just closed bar. So use [1].
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Josh,
          My situation was a little more complicated since the strat doesn't go into CalcOnBarClose = false until it gets a setup and places the trade.
          However, your suggestion gave me a great idea. I just set a variable = Close of the setup bar (tradeprice. while COBC = true). COBC is immediately set to COBC = false as soon as the trade is placed. Then I set another variable at FirstTickOfBar (while COBC = false), then compare the 2 on the next tic. That tells me if the bar after the entry bar has a Close > Open or Close < Open.

          It may be off a tic at times due to an opening tic gap, but it works GREAT and does exactly what it's needed for!

          Thanks for the suggestion!!!
          Joe

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          647 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          369 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          108 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          572 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          573 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X