const lcjsTrader = require('@lightningchart/lcjs-trader')
const lcjs = require('@lightningchart/lcjs')
const { PriceChartType, OHLCTrackingType, ResultTablePosition } = 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 })
// Modify chart settings including price chart type.
tradingChart.setPriceChartType(PriceChartType.Bar)
tradingChart.setResultTablePosition(ResultTablePosition.TopLeft)
tradingChart.setOHLCCursorTracking(OHLCTrackingType.All)
tradingChart.showSymbolWatermark(true)
tradingChart.setWatermarkText('NVDA')
// Add various indicators and modify one of them
tradingChart.indicators().addVolume()
tradingChart.indicators().addRainbowOscillator()
const bb = tradingChart.indicators().addBollingerBand()
bb.setStandardDeviationNumber(2)
bb.setLineColor('#00FFFF')
bb.setFillColor('#00101010')
// Reading data from a file.
await fetch(`${document.head.baseURI}examples/assets/0002/NVIDIA Corp (NVDA).csv`).then((res) => res.text()).then((text) => {
tradingChart.loadCsvString(text, 'NVIDIA Corp (NVDA)')
})
tradingChart.setCurrency('USD')
})
Technical Analysis Chart with Indicators - Editor
Example where a couple of more complex technical indicators have been added to Technical Analysis Chart. Some chart settings such as watermark label and result table position have also been modified. Note that chart settings can be modified and technical indicators added in code but also via the menu buttons on the left of the chart.