how to import the stock indicators?
xunxdd opened this issue · comments
how to import the stock technical indicators, such as ema, sma? thanks
Found it. The traditional script include. Otherwise, just load it the same as highmap or stocks
Hi @xunxdd, I have the same question, i.e. how to add technical indicators.
I tried doing something like this:
mounted () {
let indicatorsAll = document.createElement('script')
indicatorsAll.setAttribute('src', 'https://code.highcharts.com/stock/indicators/indicators-all.js')
document.head.appendChild(indicatorsAll)
let dragPanes = document.createElement('script')
dragPanes.setAttribute('src', 'https://code.highcharts.com/stock/modules/drag-panes.js')
document.head.appendChild(dragPanes)
let annotationsAdvanced = document.createElement('script')
annotationsAdvanced.setAttribute('src', 'https://code.highcharts.com/modules/annotations-advanced.js')
document.head.appendChild(annotationsAdvanced)
let priceIndicator = document.createElement('script')
priceIndicator.setAttribute('src', 'https://code.highcharts.com/modules/price-indicator.js')
document.head.appendChild(priceIndicator)
let fullScreen = document.createElement('script')
fullScreen.setAttribute('src', 'https://code.highcharts.com/modules/full-screen.js')
document.head.appendChild(fullScreen)
let stockTools = document.createElement('script')
stockTools.setAttribute('src', 'https://code.highcharts.com/modules/stock-tools.js')
document.head.appendChild(stockTools)
},
but it doesn't seem to work.
My template is this:
<template>
<highstock :options="ohlcv" ref="highcharts"></highstock>
</template>
And in vue.js I have this:
import VueHighcharts from 'vue-highcharts'
import Highcharts from 'highcharts'
import loadStock from 'highcharts/modules/stock'
loadStock(Highcharts)
Vue.use(VueHighcharts, { Highcharts })
Thanks!
import VueHighcharts from 'vue-highcharts'
import Highcharts from 'highcharts'
import loadStock from 'highcharts/modules/stock'
import loadIndicatorsAll from 'highcharts/indicators/indicators-all'
loadStock(Highcharts)
loadIndicatorsAll(Highcharts)
Vue.use(VueHighcharts, { Highcharts })