如何将多个时间分辨率(如 1D、1W、1M、全部)添加到 TradingView 图表库
How to add multiple time resolutions (like 1D, 1W, 1M, All) to TradingView charting library
如何将所需的时间分辨率添加到 TradingView 图表库图表,如下例所示(1D、5D、1M、3M,...)并触发事件以更新来自自定义的数据 API?
https://www.tradingview.com/chart/03M7zkuw/?symbol=NASDAQ%3AAAPL
除了 resolveSymbol 函数中的 supported_resolutions 之外,我找不到任何文档。
即使将此设置设置为 ['1'、'5'、'15'、'30'、'60'、'1D'、'1W'、'1M'],我仍然只有 5y 和 1y 选项,就像设置没有做任何事情一样。
我做错了什么?
我在 resolveSymbol javascript 函数中的代码:
var symbolInfo = {
ticker: charts.chartContainer.data("ticker"),
name: charts.chartContainer.data("ticker"),
description: charts.chartContainer.data("ticker"),
type: "",
session: '24x7',
timezone: 'Etc/UTC',
exchange: "",
minmov: 1,
pricescale: 100,
has_intraday: false,
has_no_volume: true,
has_weekly_and_monthly: false,
supports_group_request: true,
supported_resolutions: charts.configurationData.supported_resolutions,
volume_precision: 2,
data_status: 'streaming',
};
setTimeout(function() {
onSymbolResolvedCallback(symbolInfo);
});
谢谢!
所以对于以后的问题,答案是在configurationData中添加time_frames:
time_frames: [
{ text: "1y", resolution: "1D", description: "1 Year" },
{ text: "3m", resolution: "1D", description: "3 Months"},
{ text: "1m", resolution: "1D", description: "1 Month" },
{ text: "1w", resolution: "60", description: "1 Week" },
{ text: "1d", resolution: "5", description: "1 Day" },
{ text: "1000y", resolution: "1D", description: "All", title: "All" }
]
如何将所需的时间分辨率添加到 TradingView 图表库图表,如下例所示(1D、5D、1M、3M,...)并触发事件以更新来自自定义的数据 API? https://www.tradingview.com/chart/03M7zkuw/?symbol=NASDAQ%3AAAPL
除了 resolveSymbol 函数中的 supported_resolutions 之外,我找不到任何文档。 即使将此设置设置为 ['1'、'5'、'15'、'30'、'60'、'1D'、'1W'、'1M'],我仍然只有 5y 和 1y 选项,就像设置没有做任何事情一样。
我做错了什么?
我在 resolveSymbol javascript 函数中的代码:
var symbolInfo = {
ticker: charts.chartContainer.data("ticker"),
name: charts.chartContainer.data("ticker"),
description: charts.chartContainer.data("ticker"),
type: "",
session: '24x7',
timezone: 'Etc/UTC',
exchange: "",
minmov: 1,
pricescale: 100,
has_intraday: false,
has_no_volume: true,
has_weekly_and_monthly: false,
supports_group_request: true,
supported_resolutions: charts.configurationData.supported_resolutions,
volume_precision: 2,
data_status: 'streaming',
};
setTimeout(function() {
onSymbolResolvedCallback(symbolInfo);
});
谢谢!
所以对于以后的问题,答案是在configurationData中添加time_frames:
time_frames: [
{ text: "1y", resolution: "1D", description: "1 Year" },
{ text: "3m", resolution: "1D", description: "3 Months"},
{ text: "1m", resolution: "1D", description: "1 Month" },
{ text: "1w", resolution: "60", description: "1 Week" },
{ text: "1d", resolution: "5", description: "1 Day" },
{ text: "1000y", resolution: "1D", description: "All", title: "All" }
]