jahnvi25
Posts: 293
Joined: Thu Oct 04, 2012 12:16 pm

anchored VWAP

is there a way to choose the starting date while drawing/adding VWAP indicator ? may be using annotation module how can i select starting date to vWAP ?

Thanks
andrzej.b
Site Moderator
Posts: 532
Joined: Mon Jul 15, 2024 12:34 pm

Re: anchored VWAP

Hi,

Thanks for the question.

The stock tools in Highcharts don't provide a direct option to set a starting date for the VWAP indicator through the UI. The stock tools are designed for quick and easy application of indicators, but they don't offer advanced configuration options like setting a custom start date directly from the interface.
To achieve this, you would typically need to handle it programmatically, as in this demo: https://jsfiddle.net/BlackLabel/L7tgfk2r/, by pre-calculating the VWAP and adding it as a custom series. This approach allows you to define the specific logic for starting the VWAP calculation from a particular date.
If you need this feature frequently, consider building a custom tool or UI component that allows users to select a start date and then recalculates and updates the VWAP series based on that input. This would involve a bit more development work but would provide the flexibility you need.

Feel free to reach out if you have any further questions.

Kind regards,
Andrzej
Highcharts Developer
jahnvi25
Posts: 293
Joined: Thu Oct 04, 2012 12:16 pm

Re: anchored VWAP

thanks a lot for reply,, is there a way i can use click event or something similar (selecting a candle) as a starting point ? is that feasible ?

Thanks
andrzej.b
Site Moderator
Posts: 532
Joined: Mon Jul 15, 2024 12:34 pm

Re: anchored VWAP

Hi,

Yes, it seems possible. There are API options to retrieve xAxis value on click:

Code: Select all

click: function(e) {
    console.log(
        Highcharts.dateFormat('%Y-%m-%d %H:%M:%S', e.xAxis[0].value),
        e.yAxis[0].value
    )
}
You might also try https://api.highcharts.com/highstock/pl ... ents.click to get xValue on series click

Here is a basic demo with the first event used to give you an idea: https://jsfiddle.net/BlackLabel/4mt69yLj/

I hope you will find it useful.

Kind regards,
Andrzej
Highcharts Developer
jahnvi25
Posts: 293
Joined: Thu Oct 04, 2012 12:16 pm

Re: anchored VWAP

thanks a lot.. this would definitely work for us..
andrzej.b
Site Moderator
Posts: 532
Joined: Mon Jul 15, 2024 12:34 pm

Re: anchored VWAP

That's great to hear! In case of any further questions, feel free to contact us again.
Andrzej
Highcharts Developer

Return to “Highcharts Stock”