Up until recently, TWS provided up to 5 levels of market depth, and it made sense to calculate depth balance as the difference between cumulative bid size and cumulative ask size. More precisely, the balance was calculated as balance = 100 * (cumulativeBid - cumulativeAsk) / (cumulativeBid + cumulativeAsk); where cumulativeBid is a simple sum of all bid sizes through all 5 levels, and cumulativeAsk is a simple sum of all ask sizes through all 5 levels.
Now that we have 10 levels of market depth in TWS, the simple summation of sizes is probably not appropriate. That's because the sizes at the top levels (1 to 5) seem more important than the sizes at the bottom levels (6 to 10), and should be weighted more. The question that I ponder is, what kind of weighting should be used? One possible approach is to use a weighting equivalent to the (10 - level). So, the size at level 1 would get a weight of 10, the size at level 2 would get a weight of 9, and so on to level 10 with a weight of 1. This schema would put 10 times more weight on level 1, compared to weight on level 10. If you can think of a better weighting mechanism, please post your thoughts here. Once we settle on the weighting, I'll modify the framework to calculate and record weighted balance, in addition to simple balance. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "JBookTrader" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/jbooktrader?hl=en -~----------~----~----~----~------~----~------~--~---
