const lcjsTrader = require('@lightningchart/lcjs-trader')
const lcjs = require('@lightningchart/lcjs')
const { MovingAverageType, Source } = lcjsTrader
lcjsTrader.trader(TRADER_LICENSE).then(async (trader) => {
// Create a trading chart. Optionally, various chart settings can be provided.
const tradingChart = trader.tradingChart({ loadFromStorage: false })
// Add several volatility indicators to the chart and modify some of their properties.
tradingChart.indicators().addAverageTrueRange()
.setPeriodCount(14)
tradingChart.indicators().addChaikinVolatility()
.setMovingAverageType(MovingAverageType.WeightedMovingAverage)
tradingChart.indicators().addEhlerFisherTransform()
.setSmoothingPeriodCounts(5, 3)
tradingChart.indicators().addHighMinusLow()
.setLineColor('#00EEEE')
tradingChart.indicators().addHistoricalVolatilityIndex()
.setStandardDeviations(3)
tradingChart.indicators().addMassIndex()
.setLineWidth(2)
tradingChart.indicators().addZValue()
.setSource(Source.Oc2)
// Reading data from a file.
await fetch(`${document.head.baseURI}examples/assets/0010/Toyota Motor Corporation (TM).csv`).then((res) => res.text()).then((text) => {
tradingChart.loadCsvString(text, 'Toyota Motor Corporation (TM)')
tradingChart.setCurrency('USD')
})
})
Volatility Indicators Example - Editor
Example showing available volatility indicators in Technical Analysis Chart. As their name suggests, these indicators measure the volatility of the stock. They appear as a separate segment below the main chart. Note that all the indicators can also be added, modified, and removed via User Interface.