0

In highcharts stock charts, different series types have different parameters for example the paramaters for macd can be seen here: https://api.highcharts.com/highstock/series.macd.params

I would like to be able to get a map of type names, like "macd" or "sm", to parameters. Preferably an example using the typescript version of Highstock, or even better if it was in angular-highcharts. For example:

{
  "sm" => ["index" : 1 , "period": 2],
  "macd" => ["index": 11, "longperiod":12 , "period":23, "shortperiod":22],
  .
  .
  .
}

Edit:

To clarify, how would I create an object with the default params across all indicators as shown for MACD here on line 97: https://github.com/highcharts/highcharts/blob/9b3c23b50892f96487593fd7e553d9432e60f635/ts/Stock/Indicators/MACD/MACDIndicator.ts#L97

I would like to get the params before adding the series to the chart if possible.

user1689987
  • 1,002
  • 1
  • 8
  • 23

2 Answers2

0

This is a path to find params options for MACD indicator chart.series[2].options.params. Another indicators can be show as a series linkedto bind to the series.

Demo: https://jsfiddle.net/BlackLabel/wa83fhdb/

Sebastian Hajdus
  • 1,422
  • 1
  • 5
  • 14
  • Any way to get the params without creating the series? Thank you for your response. – user1689987 Dec 05 '22 at 18:59
  • In Highstock, all technical indicators are new series types; technical indicators are connected to the main series by the [linkedTo](https://api.highcharts.com/highstock/plotOptions.series.linkedTo) option. – Sebastian Hajdus Dec 06 '22 at 10:10
0

The params for each type are available through the Highcharts.Series.types variable:

import * as Highcharts from "highcharts/highstock";
import HC_exporting from 'highcharts/modules/exporting';
HC_exporting(Highcharts);
import {Dictionary, PlotMacdOptions, Series, SeriesOptions} from 
   "highcharts";
import IndicatorsAll from "highcharts/indicators/indicators-all";
IndicatorsAll(Highcharts);

const seriesType = "macd";
const types: any= Highcharts.Series.types;
console.log( types[seriesType].defaultOptions.params);

enter image description here

user1689987
  • 1,002
  • 1
  • 8
  • 23