Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

GetCurrentBid / Ask .... .an equivalent for Last Price?

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

    GetCurrentBid / Ask .... .an equivalent for Last Price?

    I have a mouse event that needs to get the immediate current Last Price and not wait for a new bar.

    My indicator needs to be set to Calculat.OnPriceChange and the mouse event could fire before the bar closes (OnBarUpdate)

    (for fast scalping)

    so the code needs to not wait for a bar close

    Is there an equivalent fo GetCurrentBid / Ask for Last Price?

    Or, should I get it from OnMarketData?


    #2
    Hello llanqui,

    The last will update with the bar. With Calculate.OnPriceChange() the Close[0] will always be the current ask price.

    Or you can save this to a variable from OnMarketData().
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Which fires first...OnMarketData or OnBarUpdate???

      Comment


        #4
        Hello llanqui,

        There is no guarantee to the order, however OnBarUpdate() will typically run first.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Ok

          but also I found that Close[0] does not work inside a mouse click or keydown event...so I need to use OnMarketData

          I think it is giving the Close[0] of the first bar on the chart...

          So, it would be a good thing to have something like GetCurrentPrice() in addition to GetCurrentBid/Ask()


          Comment


            #6
            also, it seems that Close[0] does not work inside OnOrderUpdate()

            Comment


              #7
              Hello llanqui,

              TriggerCustomEvent() must be used to access series from non-data-driven methods.
              Chelsea B.NinjaTrader Customer Service

              Comment


                #8
                ok

                also OnMarketData works well it seems

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by CarlTrading, 03-31-2026, 09:41 PM
                1 response
                43 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Started by CarlTrading, 04-01-2026, 02:41 AM
                0 responses
                20 views
                0 likes
                Last Post CarlTrading  
                Started by CaptainJack, 03-31-2026, 11:44 PM
                0 responses
                29 views
                1 like
                Last Post CaptainJack  
                Started by CarlTrading, 03-30-2026, 11:51 AM
                0 responses
                46 views
                0 likes
                Last Post CarlTrading  
                Started by CarlTrading, 03-30-2026, 11:48 AM
                0 responses
                38 views
                0 likes
                Last Post CarlTrading  
                Working...
                X