Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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.

    JimNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by burtoninlondon, Today, 12:38 AM
    0 responses
    10 views
    0 likes
    Last Post burtoninlondon  
    Started by AaronKoRn, Yesterday, 09:49 PM
    0 responses
    14 views
    0 likes
    Last Post AaronKoRn  
    Started by carnitron, Yesterday, 08:42 PM
    0 responses
    11 views
    0 likes
    Last Post carnitron  
    Started by strategist007, Yesterday, 07:51 PM
    0 responses
    14 views
    0 likes
    Last Post strategist007  
    Started by StockTrader88, 03-06-2021, 08:58 AM
    44 responses
    3,983 views
    3 likes
    Last Post jhudas88  
    Working...
    X