Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How Ask price is above close price on historical bars?

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

    How Ask price is above close price on historical bars?

    For example, on many cases, when I do:

    Print ( Close[0] );
    Print ( Bars.GetAsk(CurrentBar) );

    the ask price is below close price on many occasions on historical bars.
    How does the engine work on historical bars with regard to this matter? (if indicator is executed Once in a bar or each tick, it doesnt matter, but lets say, OnBarClose).
    so what is the reason behind this?

    #2
    Hello ttodua,

    The close may not be the ask.

    The close is the last price received while a bar is open. That could be at the bid or the ask.
    What happens if you print Bars.GetClose(CurrentBar)?

    It also matters if Close[0] is in OnBarUpdate() or if TriggerCustomEvent() is being used when using bar information outside of OnBarUpdate().

    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      thanks.
      It is inside OnBarUpdate.
      I havenot checked Bars.GetClose(CurrentBar) but is there any case when for historical cases, that might be different than Close[0] for that bar?
      What I said, is that there are cases when:

      Print(Close[0]) ---> i.e. 83.55
      Print(Bars.GetAsk(CurrentBar)) ----> 83.54
      Print(Bars.GetBid(CurrentBar)) ----> 83.53

      so, that makes me to think why that happens, because if i correctly understood, the close should be either exactly at BID or ASK (or inside), but not above (or below ) both of them. Is not that the case?

      Comment


        #4
        Hello ttodua,

        No, I would expect the Bars.GetClose(CurrentBar) to be the same as Close[0] when in OnBarUpdate().

        The ask and bid are not the close and I would expect these can be different (which is why they are different methods).

        The ask and bid can change without a last tick. No, it would not be expected that the ask or bid match the close exactly as these update independently.
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

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