'tradingview chart time order violation error
I create a chart with TradingView library.this is option that i use to init chart :
var widget = window.tvWidget = new TradingView.widget({
debug: true,
fullscreen: true,
symbol: 'WEBT',
interval: '60',
height: "142px",
container_id: "tv_chart_container",
datafeed: new Datafeeds.UDFCompatibleDatafeed("/tradingview/udf"),
library_path: "/assets/charting_library/",
disabled_features: ["use_localstorage_for_settings"],
charts_storage_api_version: "1.1",
client_id: 'tradingview.dotnet',
user_id: 'public_user_id',
theme: getParameterByName('theme'),
time_frames: [
{ text: "60", resolution: "60"},
{ text: "1D", resolution: "1D"},
{ text: "1W", resolution: "1W"},
],
});
I use UDF to transfer data from server to chart . the UDF return this response :
{"s":"ok","t":[1612432588,1612446988],"c":[10000,9999],"o":[21000,9999],"h":[21000,9999],"l":[10000,9999],"v":[76300,19998]}
after chart loaded I have a error in console :
PutToCacheNewBar: time violation, previous bar time: 2021-02-04T13:56:48.000Z should be less or equal to new time: 2021-02-04T09:56:58.000
time order violation, prev: Thu, 04 Feb 2021 13:56:48 GMT, cur: Thu, 04 Feb 2021 09:56:58 GMT
and every time UDF loaded volume of candles changed !
Solution 1:[1]
Found out when I remove the has_empty_bars: true
from resolveSymbol
config it seems to work fine.
Solution 2:[2]
bars array should be sorted in ascending based on 'time' value.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Charles Chiakwa |
Solution 2 | Bhavesh Jain |