Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

On market data, time and sales, bid, ask, last

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

    On market data, time and sales, bid, ask, last

    I need to understand about MarketDataType

    There are options such as Ask, Bid and Last


    On the Time and sales sheet, How do I know program if it was a Ask Price or a Bid Price.

    Does the Last indicate if it was a sale? If so how do I know if it is a bid sale or an ask sale?

    This is what I have.


    double price = 0;
    long volume = 0;

    price = e.Price;
    volume = e.Volume;

    if (e.MarketDataType == MarketDataType.Ask)
    {
    return;
    }

    if (e.MarketDataType == MarketDataType.Bid)
    {
    return;
    }

    if (e.MarketDataType != MarketDataType.Last || price == 0)
    return;

    if (volumeList.Count == 0 && price
    != 0)
    {

    volumeList.Add(new PricetPoint(price, volume));
    }
    else
    {
    if (price != 0)
    {

    bool bPriceFound = false;
    for (int x = 0; x < volumeList.Count; x++)
    {

    if (price == volumeList[x].AskPrice)
    {
    bPriceFound = true;
    volumeList[x].AskVolume = volumeList[x].AskVolume + volume;
    }

    }
    if (bPriceFound == false)
    {
    volumeList.Add(new PricetPoint(price, volume));

    }
    }
    }

    if (e.MarketDataType == MarketDataType.Ask)
    {
    return;
    }

    if (e.MarketDataType == MarketDataType.Bid)
    {
    return;
    }

    #2
    Hello ballboy11,

    Thanks for your post.

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

    Please see the BuySellVolume indicator which comes with NinjaTrader for an example on how you can identify a buy/sell from a Last tick.

    We look forward to assisting.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    81 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    42 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    64 views
    2 likes
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    68 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    55 views
    0 likes
    Last Post CarlTrading  
    Working...
    X