Announcement

Collapse
No announcement yet.

bid or ask?

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

  • bid or ask?

    is there a way to distinguish whether the last traded price was a bought or sold when using onquotechanged? in the time and sales window in esignal it shows the last time, price and size and the font is green if it's a buy and red if it's a sell, is there a boolean or way to get this onquotechanged? thank you in advance, john

  • #2
    Every trade that occurs is always both a buy and a sell. You can't have one without the other. Generally the color is based on whether a transaction occurs at/below the bid and at/above the ask. If you want to get this info from the OnQuoteChanged, you can compare the last price field to the bid/ask fields and decide whether you want to consider it a buy (ask or above) or a sell (bid or below).

    Code:
    if (quote.dLast >= quote.dAsk)
    {
        // Print price in green
    }
    else if (quote.dLast <= quote.dBid)
    {
        // Print price in green
    }
    else
    {
        // Print price in white
    }

    Comment

    Working...
    X