Author |
Topic: Different sized volume bars do not tally? (C#) (4 messages, Page 1 of 1) |
||||
---|---|---|---|---|---|
Moderators: VPfau | |||||
WTeng Posts: 8 Joined: Nov 28, 2014 |
Hi all,
I am using C#, and was obtaining different sized volume bars through the method RequestBars. The method will trigger an OnBarsReceived event which gives the subscription and a bar array as arguments. Upon checking the volume of the last element of the bar array, I find that the volumes do not tally. For example, for 1512 volume bar array, the last bar had a volume of 1060, but for a 1000 volume bar array, the bar had a volume of 836. Logically, the last element of the 1000 volume bar array should have a volume of 60, as 1060 - 1000 = 60. But why is it not the case? Wu liang Teng |
||||
WTeng Posts: 8 Joined: Nov 28, 2014 |
Update:
I looped through the bar arrays, and found that an element in the middle of the array will not have the intended volume. E.g. if there are 44 bars in a 1512-bar request, the last element has a volume of 101, element 14 has a volume of 823, and the rest has a volume of 1512. I would expect all elements prior to the last element to have a volume of 1512, but why is it not the case? Wu liang Teng |
||||
WTeng Posts: 8 Joined: Nov 28, 2014 |
Can any moderator help?
Why doesn't all 1512 volumed bars have 1512 as the volume when I receive them as part of the request? I would expect the volume to be 1512 before a new bar is created. Hence, all bars should have a volume of 1512 except the last bar. However, from the results, there are bars in the middle with volume smaller than 1512. Wu liang Teng |
||||
VPfau Moderator Posts: 164 Joined: |
Hello Wu liang Teng,
Volume bars calculates starting some point. i.e. say you request starts 100 ticks back, we calculate first bar starting 100th tick. For example: Ticks# Volume 1. 52 2. 46 3. 33 25 Volume bars 1. 25; 1 tick 2. 25; 1 tick 3. 2 + 23; 1 tick and 2 tick 4. 23 + 2; 2 tick and 3 tick 5. 25; 3 tick 6. 6; 3 tick 40 Volume bar 1. 40; 1 tick 2. 12 + 28; 1 tick and 2 tick 3. 18 + 22; 2 tick and 3 tick 4. 11; 3 tick As you see, bars calculated with different volume parameters has different volume at the end. Also, all bars are separated by day boundaries. That is why you got bars with different volume in the middle of series. Vitaliy Pfau |
||||