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 Jonafare, 12-06-2012, 03:48 PM
    5 responses
    3,984 views
    0 likes
    Last Post rene69851  
    Started by Fitspressorest, Today, 01:38 PM
    0 responses
    2 views
    0 likes
    Last Post Fitspressorest  
    Started by Jonker, Today, 01:19 PM
    0 responses
    2 views
    0 likes
    Last Post Jonker
    by Jonker
     
    Started by futtrader, Today, 01:16 PM
    0 responses
    7 views
    0 likes
    Last Post futtrader  
    Started by Segwin, 05-07-2018, 02:15 PM
    14 responses
    1,791 views
    0 likes
    Last Post aligator  
    Working...
    X