BjarkeSvane
Posts: 4
Joined: Wed Sep 15, 2021 8:39 am

Is Highcharts VWAP point range limited ?

Mon Sep 27, 2021 7:53 am

Hi,

I suspect that there is an issue with the automatic calculation of the Volume Weighted Average Price (VWAP), in that it seems to only calculate the average from a limited number of points.
Is this correct? And if so, how do I correct the code to instead base the VWAP on the entire series?

I noticed the potential issue when testing a live-update of my chart with some artificial data - every 3 seconds a new identical data point was added to the series. Initially, the VWAP behaves as expected, but after ~100 new points it suddenly jumps to the exact value of the added point.

Please see attached screenshot for a visual presentation of the problem. Prices are on top, volume is on bottom. VWAP is the grey line, and the orange line corresponds to the current time.
Screenshot 2021-09-21 131311.png
Screenshot 2021-09-21 131311.png (3.57 KiB) Viewed 149 times
Best regards,
Bjarke Svane

mateusz.b
Posts: 510
Joined: Tue Jul 13, 2021 11:34 am

Re: Is Highcharts VWAP point range limited ?

Tue Sep 28, 2021 12:51 pm

Hello BjarkeSvane,

Thanks for contacting us with your question.

Lagging indicators, including VWAP, require some previous data in order to confirm trends and show changes in trends. As you can read in the API docs, the default period (number of required previous values) for VWAP is 30. My first guess is that your issue might be related to vwap.params.period option, and It would be great if you could try to play a bit with different period values to confirm if that is the case.

If that doesn't help, to tell you exactly what is the cause of the problem I will need you to provide me with a reproduction of that issue, preferably in a form of a live working demo. You can start here: https://jsfiddle.net/BlackLabel/2L1h78qz/

Let me know if vwap.params.period was what you were looking for and feel free to ask any futher questions.
Best regards!

BjarkeSvane
Posts: 4
Joined: Wed Sep 15, 2021 8:39 am

Re: Is Highcharts VWAP point range limited ?

Wed Oct 06, 2021 6:43 am

Thank you for taking the time to answer.
Unfortunately the params.period was not the issue. It seems to me like the VWAP calculation does not use the entire series, when the number of data points is very large. Instead I implemented the calculation server-side and plot it as a new series, which works excellently.

Best regards

mateusz.b
Posts: 510
Joined: Tue Jul 13, 2021 11:34 am

Re: Is Highcharts VWAP point range limited ?

Wed Oct 06, 2021 11:46 am

Hello BjarkeSvane,

Glad to hear you have figured it out on your own. I took a closer look at the issue and it seems like there really is a problem with the calculations. I can't tell it for sure now, but just wanted to let you know that we're investigating it and if it's a bug, an appropriate github issue will be created and hopefully we will see a fix soon.

Thanks for pointing it out. I will let you know once we have any updates on this subject.
Best regards!

Return to “Highcharts Stock”