bjurhager
Posts: 15
Joined: Thu Jul 22, 2021 1:01 pm

Add technical indicator from custom button

Hi,
I've created some custom buttons to add annotations like elliot, segmet, bar types etc but i cant figure out how to add indicators.
I can add class="highcharts-indicators" to open the popup but i don't want to use that.

So what i want to make is a custom button to turn on ex supertrend in the same way as i do with annotations.
<button class="highcharts-series-type-candlestick">
<span class="icon-type-candles"></span>
</button>

Is there any simple solution to add "EMA, SMA, Supertrend, Psar" in the same way?
best / Fredrik
dominik.c
Posts: 2081
Joined: Fri Aug 07, 2020 7:07 am

Re: Add technical indicator from custom button

Hello bjurhager!

Welcome to our forum and thanks for contacting us with your question!

You can create a custom HTML button and add to it an event listener in the load event. OnClick functionality should cover adding an indicator by using addSeries method.

API references:
https://api.highcharts.com/class-refere ... #addSeries
https://api.highcharts.com/highcharts/chart.events.load

Demo:
https://jsfiddle.net/BlackLabel/7qhjspyv/

Best regards!
Dominik Chudy
Highcharts Developer
bjurhager
Posts: 15
Joined: Thu Jul 22, 2021 1:01 pm

Re: Add technical indicator from custom button

Awesome, Thanks!
dominik.c
Posts: 2081
Joined: Fri Aug 07, 2020 7:07 am

Re: Add technical indicator from custom button

You're welcome!

In case of any further questions, feel free to contact us again.
Dominik Chudy
Highcharts Developer

Return to “Highcharts Stock”