I'am trying to compare a bid and ask sorted list.
i clear the list after each candle.
My problem is i would like to find out a big imbalance and so i compare the list key value from 1 list with the second list -1*ticksize to get the right price.
looks like this
AskList:
1,06120 -> look at sell list 1,0615 (1,06120-1Ticksize)
i would like to use this but this is also not working
if (sellList.TryGetValue(kvp.Key, out lookSellPriceVolTmp))
{
Print();
}
Here is a Print
Every Ask i get through the complete Sell List and here you can see follow problem.
Green = OK
Red = Wrong
Thats OK there is no 1,06225 in sell List
10.04.2017 15:25:00 Buylist 1,0623 7 1,06225
10.04.2017 15:25:00 SelllistinBuy 1,0623 47
10.04.2017 15:25:00 SelllistinBuy 1,06235 23
10.04.2017 15:25:00 SelllistinBuy 1,06245 20
10.04.2017 15:25:00 SelllistinBuy 1,0625 63
10.04.2017 15:25:00 SelllistinBuy 1,06255 48
Thats Wrong 1,0623 is in sell List
10.04.2017 15:25:00 Buylist 1,06235 37 1,0623
10.04.2017 15:25:00 SelllistinBuy 1,0623 47
10.04.2017 15:25:00 SelllistinBuy 1,06235 23
10.04.2017 15:25:00 SelllistinBuy 1,06245 20
10.04.2017 15:25:00 SelllistinBuy 1,0625 63
10.04.2017 15:25:00 SelllistinBuy 1,06255 48
Thats OK 1,06235 is in selllist and it show my match
10.04.2017 15:25:00 Buylist 1,0624 62 1,06235
10.04.2017 15:25:00 SelllistinBuy 1,0623 47
10.04.2017 15:25:00 SelllistinBuy 1,06235 23
10.04.2017 15:25:00 Match 1,0624 62 1,06235 23
10.04.2017 15:25:00 SelllistinBuy 1,06245 20
10.04.2017 15:25:00 SelllistinBuy 1,0625 63
10.04.2017 15:25:00 SelllistinBuy 1,06255 48
Thats OK there is no 1,0624 in sell List
10.04.2017 15:25:00 Buylist 1,06245 45 1,0624
10.04.2017 15:25:00 SelllistinBuy 1,0623 47
10.04.2017 15:25:00 SelllistinBuy 1,06235 23
10.04.2017 15:25:00 SelllistinBuy 1,06245 20
10.04.2017 15:25:00 SelllistinBuy 1,0625 63
10.04.2017 15:25:00 SelllistinBuy 1,06255 48
Thats OK 1,06245 is in selllist and it show my match
10.04.2017 15:25:00 Buylist 1,0625 114 1,06245
10.04.2017 15:25:00 SelllistinBuy 1,0623 47
10.04.2017 15:25:00 SelllistinBuy 1,06235 23
10.04.2017 15:25:00 SelllistinBuy 1,06245 20
10.04.2017 15:25:00 Match 1,0625 114 1,06245 20
10.04.2017 15:25:00 SelllistinBuy 1,0625 63
10.04.2017 15:25:00 SelllistinBuy 1,06255 48
Thats OK 1,0625 is in selllist and it show my match
10.04.2017 15:25:00 Buylist 1,06255 97 1,0625
10.04.2017 15:25:00 SelllistinBuy 1,0623 47
10.04.2017 15:25:00 SelllistinBuy 1,06235 23
10.04.2017 15:25:00 SelllistinBuy 1,06245 20
10.04.2017 15:25:00 SelllistinBuy 1,0625 63
10.04.2017 15:25:00 Match 1,06255 97 1,0625 63
10.04.2017 15:25:00 SelllistinBuy 1,06255 48
Thats Wrong 1,06255 is in sell List
10.04.2017 15:25:00 Buylist 1,0626 8 1,06255
10.04.2017 15:25:00 SelllistinBuy 1,0623 47
10.04.2017 15:25:00 SelllistinBuy 1,06235 23
10.04.2017 15:25:00 SelllistinBuy 1,06245 20
10.04.2017 15:25:00 SelllistinBuy 1,0625 63
10.04.2017 15:25:00 SelllistinBuy 1,06255 48
Here are the two for commands where i compare the values.
foreach (KeyValuePair<double, long> kvpbuy in buyList) /// Go through all Buy Values
{
Print(Time[0] + " Buylist " + kvpbuy.Key + " " + kvpbuy.Value + " " + (kvpbuy.Key-1*TickSize));
foreach (KeyValuePair<double, long> kvpsell in sellList) /// Go through all Sell Values at each Buy Value
{
Print(Time[0] + " SelllistinBuy " + kvpsell.Key + " " + kvpsell.Value);
if (kvpbuy.Key == kvpsell.Key+1*TickSize) ///!!!Compare the Value!!!
{
Print(Time[0] + " Match " + kvpbuy.Key + " " + kvpbuy.Value + " " + kvpsell.Key + " " + kvpsell.Value);
}
}
}
I cannot find a wrong code so i need help.
Please let me know if i made a mistake or if it is a bug.
Thanks
Stefan
Comment