我正在使用TradingView(v 1.13),并实现了自定义UDF数据供稿。我正在将音量绘制为自定义指标。在custom_indicators文件中定义。我对如何格式化以B / M / K格式显示在y轴上的数字感到困惑。就像Chart Image中所示。我在文档中找不到任何内容。
这是我的小部件构造函数
var widget = window.tvWidget = new TradingView.widget({
// debug: true, // uncomment this line to see Library errors and warnings in the console
fullscreen: true,
symbol: self.subject,
interval: '15',
container_id: "coins_trading_view_coin",
datafeed: new Datafeeds.UDFCompatibleDatafeed(window.base_url,6000000),
library_path: "/charting_library/",
locale: self.getParameterByName('lang') || "en",
indicators_file_name: window.base_url+"/charting_library/custom_indicators.js",
disabled_features: ["use_localstorage_for_settings","header_compare","header_chart_type"],
enabled_features: [""],
charts_storage_url: 'https://saveload.tradingview.com',
charts_storage_api_version: "1.1",
client_id: 'tradingview.com',
user_id: 'public_user_id',
theme: self.getParameterByName('theme'),
allow_symbol_change : false,
hide_side_toolbar : true,
overrides: {
"mainSeriesProperties.candleStyle.upColor": "#0C8912",
"mainSeriesProperties.candleStyle.downColor": "#C23A40"
},
time_frames: []
});
这是我针对Volume的自定义指标配置
{
name: "Trading Volume",
metainfo: {
"_metainfoVersion": 40,
"id": "Trading Volume@tv-basicstudies-1",
"scriptIdPart": "",
"name": "Trading Volume",
"description": "TIE: Trading Volume",
"shortDescription": "Volume",
"is_hidden_study": true,
"is_price_study": false,
"isCustomIndicator": true,
"plots": [{"id": "plot_2", "type": "line"}],
"defaults": {
"styles": {
"plot_2": {
"linestyle": 0,
"visible": true,
"linewidth": 1,
"plottype": 5,
"trackPrice": false,
"transparency": 40,
"color": "#BFBFBF"
}
},
"precision": 1,
"inputs": {}
},
"styles": {
"plot_2": {
"title": "Volume",
"histogramBase": 0,
}
},
"inputs": [],
},