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 CarlTrading, 03-31-2026, 09:41 PM
        1 response
        47 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        23 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        33 views
        1 like
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        51 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        42 views
        0 likes
        Last Post CarlTrading  
        Working...
        X