I'm using the attached code to keep a list of trades that happened on the bid or ask during a bar period. For some reason I cannot get my script to match up with the Volume series. It is very close in many cases but does not actually match up. Below is examples of my prints on the bar close. Actual volume is Volume[0] and "we show" is the sum of the trades on the bid and ask as I'm calculating them. Any ideas why I am off?
sold into bid is 17161
bought into ask is 18377
unknown 0
Actual Volume is 35353
we show 35538
-----------------------------
sold into bid is 22753
bought into ask is 18985
unknown 0
Actual Volume is 41662
we show 41738
-----------------------------
sold into bid is 37206
bought into ask is 38434
unknown 0
Actual Volume is 75638
we show 75640
-----------------------------
sold into bid is 70606
bought into ask is 71293
unknown 0
Actual Volume is 141711
we show 141899
-----------------------------
sold into bid is 41050
bought into ask is 42687
unknown 0
Actual Volume is 83736
we show 83737
-----------------------------
Comment