Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Order Type in orderflow

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

    Order Type in orderflow

    Hi,
    Is there a way we can know what type of ask and bid order is? Like is it market or limit order? Also can you explain what is the difference between last, ask and bid and volume we get with it.

    I have this script i want to know can from this thing, i can filter out what type was of last order was it bid or was it ask?
    if(marketDataUpdate.MarketDataType == MarketDataType.Last)
    {
    if(marketDataUpdate.Price >= marketDataUpdate.Ask)
    {Print($"Last-ASK, {marketDataUpdate.Last}, Vol, {marketDataUpdate.Volume}, Time, {currentTime:hh:mm:ss.fff}");}
    if(marketDataUpdate.Price <= marketDataUpdate.Bid)
    {Print($"Last-BID, {marketDataUpdate.Last}, Vol, {marketDataUpdate.Volume}, Time, {currentTime:hh:mm:ss.fff}");}

    }
    if(marketDataUpdate.MarketDataType == MarketDataType.Ask)
    {
    Print($"ASK,{marketDataUpdate.Ask}, Vol,{marketDataUpdate.Volume}, Time, {currentTime:hh:mm:ss.fff}");
    }
    if(marketDataUpdate.MarketDataType == MarketDataType.Bid)
    {
    Print($"BID,{marketDataUpdate.Bid}, Vol, {marketDataUpdate.Volume}, Time, {currentTime:hh:mm:ss.fff}");
    }​

    #2
    Hello patz1398,

    Thank you for your post.

    Please see this Investopedia article on the difference between last, bid, and ask:



    (e.MarketDataType == MarketDataType.Ask) and (e.MarketDataType == MarketDataType.Bid) are updates to resting limit orders in the level 1 book.

    MarketData: https://ninjatrader.com/support/help...marketdata.htm

    MarketDataEventArgs: https://ninjatrader.com/support/help...aeventargs.htm

    To identify whether the last update was last, bid, or ask, you can use this code from the MarketDataEventArgs help guide page:

    Code:
    protected override void OnMarketData(MarketDataEventArgs marketDataUpdate)
    {
        // Print some data to the Output window
        if (marketDataUpdate.MarketDataType == MarketDataType.Last)
            Print("Last = " + marketDataUpdate.Price);
        else if (marketDataUpdate.MarketDataType == MarketDataType.Ask)
            Print("Ask = " + marketDataUpdate.Price);
        else if (marketDataUpdate.MarketDataType == MarketDataType.Bid)
            Print("Bid = " + marketDataUpdate.Price);
    }​

    Comment


      #3
      Thank you for the reply, But can we identify if the order type is limit or market? or as you mentioned all of these are limit order. Or any other way i can get the type of market orders for orderflow. Another thing, so my last question was to see if the last order was type ask or bid on which deal was made or basically executed order?

      Comment


        #4
        Hello patz1398,

        As mentioned (e.MarketDataType == MarketDataType.Ask) and (e.MarketDataType == MarketDataType.Bid) are updates to resting limit orders in the level 1 book.

        A Last update would indicate a completed buy/sell. From the Investopedia article:

        "The last price is the execution price of the most recent trade. If a trader places a market buy or sell order, the price of that trade will become the new last price"

        To determine if the trade was a buy or sell, you can compare the price to the bid/ask price (MarketDataEventArgs.Bid/MarketDataEventArgs.Ask).

        Comment

        Latest Posts

        Collapse

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