diff --git a/src/charts/chart-misc.js b/src/charts/chart-misc.js index bf91c8a..209a241 100644 --- a/src/charts/chart-misc.js +++ b/src/charts/chart-misc.js @@ -17,8 +17,8 @@ export function nearestOhlcStart(timestamp, periodSeconds=null) { return Math.round((timestamp-OHLC_START) / periodSeconds) * periodSeconds + OHLC_START } -export function pointsToTvOhlcStart(points) { +export function pointsToTvOhlcStart(points, periodSeconds=null) { return points === null ? null : points.map((p) => { - return {time: nearestOhlcStart(p.time/1000)*1000, price: p.price} + return {time: nearestOhlcStart(p.time, periodSeconds), price: p.price} }) }