ohlc
Major update for version 2
install
node.js
npm install ohlc
var ohlc =
Browser
CDN
sumple data
arrayData = [ ["2017-01-04",348,350,346,350,68700], ["2017-01-05",350,353,349,352,59200], ["2017-01-06",350,358,350,356,168900]]
toDaily()
output to daily data
;/// result ... "Date": '2017-04-03' Open: 352 High: 352 Low: 348 Close: 348 Volume: 108200 ...
toWeekly()
output to weekly data
;/// result ... "Date": '2017-04-02' Open: 352 High: 352 Low: 338 Close: 339 Volume: 379400 ...
toMonthly
output to monthly data
;/// result ... "Date": '2017-04-01' Open: 352 High: 370 Low: 330 Close: 357 Volume: 1514900 ...
value(period)
output data
// dailyvalue// equal toDaily // weeklyvalue'weekly'// equal toWeekly // monthlyvalue'monthly'// equal toMonthly
toChartData(period)
It complies with high charts
Candlestick | Highcharts
https://www.highcharts.com/samples/data/aapl-ohlc.json
var chartData = ; Object//=> ['candle', 'volume', 'sma5', 'sma25'] chartDatacandle90//=> [1494979200000, 370, 372, 365, 369]chartDatavolume90//=> [1494979200000, 32300]chartDatasma590//=> [1494979200000, 372]chartDatasma2590//=> [1494979200000, 359]moment//=> '2017-05-17'
start() and end()
Set the output period
prices = ;/// prices.length is 101 prices = start'2017-04-03';/// prices.length is 40 prices = ;/// prices.length is 67 prices = start'2017-04-03';/// prices.length is 6
sma
This will add sma(simple MA)
;/// result ... Date: '2017-05-31' Open: 372 High: 372 Low: 362 Close: 364 Volume: 46500 sma5: 373 sma25: 373 sma75: 360 ...