vue中使用TradingView --7 自定义初始化指标线,设置颜色,自定义是否显示

特斯比特 2021-11-19 10:12:12


添加折线

_this. MALine5 = _this. chart. chart(). createStudy( 'Moving Average', false, false, [ 5], null, { 'Plot.color' : '#642d92'}); _this. MALine10 = _this. chart. chart(). createStudy( 'Moving Average', false, false, [ 10], null, { 'Plot.color' : '#5278a3'}); _this. MALine30 = _this. chart. chart(). createStudy( 'Moving Average', false, false, [ 30], null, { 'Plot.color' : '#238031'}); _this. MALine60 = _this. chart. chart(). createStudy( 'Moving Average', false, false, [ 60], null, { 'Plot.color' : '#850058'});

隐藏折线

_this. chart. chart(). getStudyById( _this. MALine5). setVisible( false); _this. chart. chart(). getStudyById( _this. MALine10). setVisible( false); _this. chart. chart(). getStudyById( _this. MALine30). setVisible( false); _this. chart. chart(). getStudyById( _this. MALine60). setVisible( false);

需要注意的是以上方法均在 onchartready里面执行

声明:本文内容不代表斑马投诉网站观点,内容仅供参考,不构成投资建议。投资有风险,选择需谨慎! 如涉及内容、版权等问题,请联系我们,我们会在第一时间作出调整!

相关文章