const lcjsTrader = require('@lightningchart/lcjs-trader')
const lcjs = require('@lightningchart/lcjs')
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 a Simple Moving Average indicator with time period count of 10.
tradingChart.indicators().addSimpleMovingAverage(10)
// Adding another SMA with an alternative way of setting the period count.
const sma20 = tradingChart.indicators().addSimpleMovingAverage()
sma20.setPeriodCount(20)
sma20.setLineColor('#80FF00')
// Reading data from a file.
await fetch(`${document.head.baseURI}examples/assets/0000/Alphabet Inc (GOOGL).csv`).then((res) => res.text()).then((text) => {
tradingChart.loadCsvString(text, 'Alphabet Inc (GOOGL)')
})
tradingChart.setCurrency('USD')
})
Simple Technical Analysis Example - Editor
Example showing a simple Technical Analysis Chart. Two Simple Moving Average indicators with different settings has been added to the chart. Note that technical indicators can be added in code but also via the indicators menu (Indicators - button on the toolbar on the left of the chart).