Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
So, the approach is quite different between MC and SC.
To simplify, let's suppose that MC and SC codes are both executed every 0.1s.
MultiCharts
Each 0.1s, MC code gets the InsideBid / InsideAsk and prints it : one line is printed.
Sierra Chart
There are 2 modes with SC.
Charts and indicators are also updated each 0.1s or whatever frequency defined by the user.
But there is another mode specific to T&S. With function sc.GetTimeAndSales(), we have an asynchronous access to all messages received from the feed. These messages are queued by SC when received and are available when the function is called.
So...
Each 0.1s, SC code reads all the messages arrived from the feed in the last 0.1s one by one: several lines are printed (as many lines as updates received from the feed during the 0.1s).
In other words, if InsideBid or InsideAsk has been updated 0.001s after the trade, MC code will probably miss this update whereas SC will print it. Because, by design, all messages from the feed are kept and queued in SC when dealing with T&S.
There's might also be another approach as I understand it correctly from NinjaTrader's OnMarketDepth method, which gets updated on every change in market depth (so presumably independent of time).
I couldn't get the code to work (I don't know much NinjaTrader), but here's what I have so far:
I don't know. Ironically I find NinjaTrader's documentation much more understandable, even though I practically never use NinjaTrader/NinjaScript. MC .NET's 'documentation' (read: references) are still foreign to me.
There is a flaw in what you are trying to do here. I suspect it's the same thing being attempted across all platforms.
The Time & Sales AKA Level 1 feed is EITHER
- A trade
- A change in bid
- A change in offer
That is all.
So - what you are doing here in the code above is getting a trade message:
MarketDataType.Last
But somehow expecting that message to also give you the bid & ask as well as the trade. This isn't the way the feed works.
The GetCurrentAskVolume() method will not give you the new bid/ask data because the bid/ask message has not come through yet. There are a few ways to get the current inside bid/ask and some are more timely than others.
The Time & Sales window in Ninja has a section at the top that shows the inside bid/offer info. From memory I believe that is what you are accessing with GetCurrentAskVolume(). This value is not updated on every change as Ninja would end up spinning the wheels just keeping that updated.
To interrogate the inside bid/ask - you have to wait for the L1 bid ask messages.
MarketDataType.Last - trade
MarketDataType.Bid - Inside bid update
MarketDataType.Ask - Inside Ask update
There is no way to get an update to the inside bid/ask BEFORE the MarketDataType.Bid or MarketDataType.Ask message gets to you.
Also - in the above code, you should be using OnMarketData NOT OnMarketDepth - OnMarketDepth is the L2 feed and has updates to all levels and therefore many times more messages than OnMarketData which is the Level 1 feed.
"There is a flaw in what you are trying to do here. I suspect it's the same thing being attempted across all platforms."
I will just answer for Sierra Chart.
I humbly think that there is no flaw, since, if no mistake, I am doing exactly what you say (or my understanding of what you say).
The code waits for the L1 messages and reads them one after the other.
As you say, these messages are either a trade or an update.
The code distinguishes the two and adapts the printing.
(The code does not try to have the trade and the update at the same time.)
What I wanted to check is: does the UPDATE message received just after a TRADE message reflects the liquidity which disappeared due to the trade?
To put it short...
With CME product I tested, the answer is: YES so no problem (refer to my message with all the colors)
With EUREX product I tested, the answer is: NO so there is something to be clarified. I have sent an e-mail to DTN IQFeed.
Once more, I am not disagreeing with you. I am just trying to explain what I have done. Except if I have missed something, it seems consistent with your recommendations.
Do you have the messages that came after this? I agree that you should get a bid update at this point.
The 3rd line there is an Ask update. To have no Bid update here would be counter to what the US exchanges do (as you know)
Perhaps Eurex thinks there's no need to send a bid update in this case as nothing is pulled from the bid and no bid changes have occured. You can figure it out for yourself, efectively. Seems an odd thing to do.
To better illustrate the difference I see between CME and EUREX, below please find a comparison between ES, FESX and BUND. All with the same Sierra Chart code. All a few minutes ago.
(1) ES @ CME : after trades at the bid, a message is sent to reflect that the bid size has decreased by the volume of the trades (same for ask)
[63522] Update without trade: Ask = 213 @ 1417.50 - Bid = 62 @ 1417.25 | 2012-08-21 02:28:25
[63523] New trade at the BID: 5 @ 1417.25 - Ask = 213 @ 1417.50 - Bid = 62 @ 1417.25 | 2012-08-21 02:28:25
[63524] New trade at the BID: 3 @ 1417.25 - Ask = 213 @ 1417.50 - Bid = 62 @ 1417.25 | 2012-08-21 02:28:25
[63525] New trade at the BID: 1 @ 1417.25 - Ask = 213 @ 1417.50 - Bid = 62 @ 1417.25 | 2012-08-21 02:28:25
[63526] New trade at the BID: 11 @ 1417.25 - Ask = 213 @ 1417.50 - Bid = 62 @ 1417.25 | 2012-08-21 02:28:25
[63527] Update without trade: Ask = 213 @ 1417.50 - Bid = 42 @ 1417.25 | 2012-08-21 02:28:25
--> 62 - (5+3+1+11) = 42... fine!
(2) FESX @ EUREX: the update message after the trade does not reflect what happened during the trade
[108761] Update without trade: Ask = 458 @ 2484.00 - Bid = 270 @ 2483.00 | 2012-08-21 02:42:29
[108762] New trade at the BID: 10 @ 2483.00 - Ask = 458 @ 2484.00 - Bid = 270 @ 2483.00 | 2012-08-21 02:42:29
[108764] Update without trade: Ask = 487 @ 2484.00 - Bid = 216 @ 2483.00 | 2012-08-21 02:42:29
--> If the EUREX messages were like CME's, it should have been Bid = 260
[108769] Update without trade: Ask = 487 @ 2484.00 - Bid = 228 @ 2483.00 | 2012-08-21 02:42:30
[108771] Update without trade: Ask = 495 @ 2484.00 - Bid = 228 @ 2483.00 | 2012-08-21 02:42:30
[108835] Update without trade: Ask = 484 @ 2484.00 - Bid = 229 @ 2483.00 | 2012-08-21 02:42:31
[108844] New trade at the ASK: 2 @ 2484.00 - Ask = 484 @ 2484.00 - Bid = 229 @ 2483.00 | 2012-08-21 02:42:31
[108845] Update without trade: Ask = 435 @ 2484.00 - Bid = 258 @ 2483.00 | 2012-08-21 02:42:31
--> If the EUREX messages were like CME's, it should have been Ask = 482
[108853] Update without trade: Ask = 420 @ 2484.00 - Bid = 374 @ 2483.00 | 2012-08-21 02:42:31
[108867] Update without trade: Ask = 423 @ 2484.00 - Bid = 374 @ 2483.00 | 2012-08-21 02:42:31
(3) BUND @ EUREX: the update message after the trade does not reflect what happened during the trade
[86471] Update without trade: Ask = 130 @ 141.68 - Bid = 8 @ 141.67 | 2012-08-21 02:34:35
[86473] New trade at the BID: 3 @ 141.67 - Ask = 130 @ 141.68 - Bid = 8 @ 141.67 | 2012-08-21 02:34:35
[86474] Update without trade: Ask = 127 @ 141.68 - Bid = 4 @ 141.67 | 2012-08-21 02:34:35
--> If the EUREX messages were like CME's, it should have been Bid = 5
I hope that DTN IQFeed will be able to explain this difference between CME and EUREX messages. It has a huge impact on codes which could be based on L1 messages.
Nicolas
PS - According to Sierra Chart, it is normal, in SC design, that the sequence numbers between [] do not follow each other. It does not mean that there are missing messages. ( Reference)
SC_TS_BIDASKVALUES --> "Bid and Ask quote data update"
(Actually, there is a 4th one SC_TS_MARKER to indicates a gap in the time and sales data, but, in all my checkings, I have never seen it whereas I have programmed an alert. I think it shows a gap in time: disconnection with data feed, etc.)
EDIT: To come back to your question...
"does it not tell you which type is coming in? Just "update without trade"?"
Answer is YES, just "update without trade". But I am printing nearly all the relevant fields (ask price, ask size, bid price, bid size, etc.). So we can see which one has been updated.