Welcome to the Traders Laboratory Forums.
Coding Forum Collaborate, receive help, or discuss coding related issues.

Reply
Old 03-26-2010, 06:55 AM   #545

BlowFish's Avatar

Join Date: Mar 2007
Location: In Da House
Posts: 3,292
Ignore this user

Thanks: 129
Thanked 1,054 Times in 702 Posts

Re: Volume Splitter

Thanks for the reminder. If it is the guy I think it is then it's well worth a look.
BlowFish is offline  
Reply With Quote
Old 03-29-2010, 10:27 AM   #546

daedalus's Avatar

Join Date: Jul 2007
Location: Omaha, NE
Posts: 627
Ignore this user

Thanks: 431
Thanked 551 Times in 228 Posts

Re: Volume Splitter

That a great video... truly one of the best i've seen in a LONG time. Applies almost same logic I do (entries are a bit different) but still, the LH/HL logic is the truth I chase personally.
daedalus is offline  
Reply With Quote
Old 03-30-2010, 02:45 PM   #547

Join Date: Feb 2008
Location: Germany
Posts: 391
Ignore this user

Thanks: 103
Thanked 186 Times in 89 Posts

Re: Volume Splitter

I started working on IQFeed again. It doesn't explicitly give you the side that the trade traded on. Instead it sends a message (they call it "Update Message") that contains the current trade price, bid price and ask price. I can see how chart software developers that implement this feed made the mistake of comparing the trade price to the inside market of that message. It initially did the same and I noticed trades and the inside market that are contained in the same message are not synchronized which is the reason for "trades between the bid or ask". It would report a trade at 123.22 while it bid was 123.21 and the ask was 123.23. If you had looked at the DOM though you would have seen that 123.22 went bid and as soon as it went bid, it got taken out. So that trade "between the bid or ask" was on the bid. What must be happening internally with IQFeed is that they update the inside market before the trade so the bid is already 1 tick lower before the trade is reported.

Instead of comparing against the current inside market, you should keep track of the market side of each price using an associative array (dictionary, map, hash, index or whatever your programming language calls it). This will always correctly determine the side of a trade independent of the how the feed reports the data. Here is what an implementation in C# would look like:


//enumeration for market side
public enum eSide {
None,
Bid,
Ask,
}

//static dictionary taht keeps track of market side at price
private static readonly Dictionary<decimal, eSide> _marketSideByPrice = new Dictionary<decimal, eSide>>();

private eSide GetTradeSide(decimal bidPrice, decimal askPrice, decimal tradePrice) {
//set side at bid
if (_marketSideByPrice.Conta insKey(bidPrice))
_marketSideByPrice[bidPrice] = eSide.Bid;
else
_marketSideByPrice.Add(bi dPrice, eSide.Bid);

//set side at ask
if (_marketSideByPrice.Conta insKey(askPrice))
_marketSideByPrice[askPrice] = eSide.Ask;
else
_marketSideByPrice.Add(as kPrice, eSide.Ask);

//get side at trade price
eSide tradeSide = marketSideByPrice[tradePrice];

return tradeSide;
}
AgeKay is offline  
Reply With Quote
The Following User Says Thank You to AgeKay For This Useful Post:
paolfili (03-31-2010)
Old 03-30-2010, 03:52 PM   #548

cunparis's Avatar

Join Date: May 2008
Location: Paris
Posts: 154
Ignore this user

Thanks: 238
Thanked 45 Times in 25 Posts

Re: Volume Splitter

Quote:
Originally Posted by AgeKay »
It would report a trade at 123.22 while it bid was 123.21 and the ask was 123.23. If you had looked at the DOM though you would have seen that 123.22 went bid and as soon as it went bid, it got taken out. So that trade "between the bid or ask" was on the bid. What must be happening internally with IQFeed is that they update the inside market before the trade so the bid is already 1 tick lower before the trade is reported.
I understand your example and I understand the algorithm of your code, but I don't see how (or when) your code will know that 123.22 went bid.

are you programming to their API directly? Is their API C#?
cunparis is offline  
Reply With Quote
Old 03-30-2010, 03:54 PM   #549

Join Date: Mar 2008
Location: Camas
Posts: 72
Ignore this user

Thanks: 5
Thanked 27 Times in 11 Posts

Re: Volume Splitter

Quote:
Originally Posted by cunparis »
I understand your example and I understand the algorithm of your code, but I don't see how (or when) your code will know that 123.22 went bid.

are you programming to their API directly? Is their API C#?
It's tracking each price and whether it was most recently a bid or an ask. So... when 123.22 went bid, it would be tracked as bid. When 123.21 went bid, it's tracked as bid. 123.22 is still in the dictionary as bid. So if a trade comes across at 123.22, it will be assigned as bid because that's the most recent value for that price.
taotree is offline  
Reply With Quote
The Following 2 Users Say Thank You to taotree For This Useful Post:
AgeKay (03-31-2010), cunparis (03-30-2010)
Old 03-30-2010, 04:16 PM   #550

cunparis's Avatar

Join Date: May 2008
Location: Paris
Posts: 154
Ignore this user

Thanks: 238
Thanked 45 Times in 25 Posts

Re: Volume Splitter

Quote:
Originally Posted by taotree »
It's tracking each price and whether it was most recently a bid or an ask. So... when 123.22 went bid, it would be tracked as bid. When 123.21 went bid, it's tracked as bid. 123.22 is still in the dictionary as bid. So if a trade comes across at 123.22, it will be assigned as bid because that's the most recent value for that price.
From what I understand we only get the update message on each trade.

Let's say first trade is at 150.05 on the bid and we've never been higher. Then the bid goes 150.06 but there are no trades. and now you get an update message with bid 150.07 ask 150.08 and a trade at 150.06. we wouldn't have 150.06 in our dictionary?

If the bid/ask changes were sent independently of the trades then everything would make a lot more sense. Please forgive me if I'm missing something really simple.
cunparis is offline  
Reply With Quote
Old 03-30-2010, 05:13 PM   #551

Join Date: Mar 2008
Location: Camas
Posts: 72
Ignore this user

Thanks: 5
Thanked 27 Times in 11 Posts

Re: Volume Splitter

Quote:
Originally Posted by cunparis »
From what I understand we only get the update message on each trade.

Let's say first trade is at 150.05 on the bid and we've never been higher. Then the bid goes 150.06 but there are no trades. and now you get an update message with bid 150.07 ask 150.08 and a trade at 150.06. we wouldn't have 150.06 in our dictionary?

If the bid/ask changes were sent independently of the trades then everything would make a lot more sense. Please forgive me if I'm missing something really simple.
It depends on your platform. Ninjatrader for example, the bid/ask changes are sent independently of the trades.

In many platforms where your indicator is only updated on trades and you call some API to get the inside bid/ask... in some cases (tradestation, for example) that means you might want to forget about trying to assign bid/ask to trades because it's using snapshotted bid/ask data which are stale. In some platforms, that can be accurate as it sounds like Agekay mentioned he was using one like that in a previous post.
taotree is offline  
Reply With Quote
Old 03-30-2010, 05:35 PM   #552

cunparis's Avatar

Join Date: May 2008
Location: Paris
Posts: 154
Ignore this user

Thanks: 238
Thanked 45 Times in 25 Posts

Re: Volume Splitter

Quote:
Originally Posted by taotree »
It depends on your platform. Ninjatrader for example, the bid/ask changes are sent independently of the trades.

In many platforms where your indicator is only updated on trades and you call some API to get the inside bid/ask... in some cases (tradestation, for example) that means you might want to forget about trying to assign bid/ask to trades because it's using snapshotted bid/ask data which are stale. In some platforms, that can be accurate as it sounds like Agekay mentioned he was using one like that in a previous post.
I'm using Ninjatrader & Market Delta (and tradestation but not for anything related to bid/ask). So far I've seen a lot of discrepancies in bid/ask data between ninja with zenfire and Market Delta with IQFeed. In a few cases the ninja volume ladder was missing 6% of the volume, in other cases it has more trades at bid than ask for a particular price level when market delta has the opposite. When that happens I've looked at the tradestation time & sales and determined that Market Delta was more correct. I'm not sure if it's the ninja software that has problems, the zen-fire datafeed, or both.

The platform can send the bid/ask changes independently but only if the datafeed supports it. I am under the impression that IQFeed sends them together.
cunparis is offline  
Reply With Quote

Reply

Tags
eot, volume splitter

Thread Tools
Display Modes Help Others By Rating This Thread
Help Others By Rating This Thread:


Similar Threads
Thread Thread Starter Forum Replies Last Post
Retest on Lower Volume with Volume Gradient walterw Technical Analysis 3 04-16-2009 12:10 AM
NYSE Up Volume($UVOL)/Down Volume ($DVOL) Comparison MC Market Internals 23 02-09-2009 09:18 AM

All times are GMT -4. The time now is 12:57 PM.
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
CS to VB integration by DeskLancer
©2006-2011 Traders Laboratory, All Rights Reserved.