Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Question about OnBarUpdate of Strategy

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

    Question about OnBarUpdate of Strategy

    In a strategy, the OnBarUpdate method is read on every tick or on bar close? I have the CalculateOnBarClose variable set to true on initializebut it does not exit where I want to. The way I have it set up is to read on bar close and compare to the open price. If the change is N number of points then exit. But I think it is executing before like if it was reading ticks. In simulation it does run as it should.

    #2
    lgarcia3,

    Not sure I understand you correctly. I suggest you print Time[0] to see the timestamp of what is being processed. Then you can ID that each bar has a unique timestamp which will confirm that you are processing once at the end of each bar.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Well, what I was trying to say is that I programmed my strategy to enter at certain point and to exit when it reaches certain number of points gained/lost. Now, it has to happen after the bar closes; it checks where it closed and if it has reached either point of profit/loss or more then fires the order. It is not happening like that though. It is reaching the profit point in the middle of a bar and firing the order there; but not after the bar has closed.
      In any case, I'll try that and see the time stamp.

      Comment


        #4
        lgarcia3,

        Please ensure you are actually using CalculateOnBarClose = true. No intrabar action should ever trigger when it is set to true.
        Josh P.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        68 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        41 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        24 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        27 views
        0 likes
        Last Post TheRealMorford  
        Started by Mindset, 02-28-2026, 06:16 AM
        0 responses
        54 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Working...
        X