设置均线

//均线
_this.MALine5 = widget
.chart()
.createStudy("Moving Average", false, false, [5, "close", 0], null, {
"Plot.color": "green",
"Plot.linewidth": 0,
});
_this.MALine10 = widget
.chart()
.createStudy("Moving Average", false, false, [10, "close", 0], null, {
"Plot.color": "red",
"Plot.linewidth": 0,
});
_this.MALine20 = widget
.chart()
.createStudy("Moving Average", false, false, [20, "close", 0], null, {
"Plot.color": "#409EFF",
"Plot.linewidth": 0,
});
位置截图:
在onChartReady里面 和自定义周期同级

隐藏均线

在设置的下面.setVisible(false)即可
//均线
_this.MALine5 = widget
.chart()
.createStudy("Moving Average", false, false, [5, "close", 0], null, {
"Plot.color": "green",
"Plot.linewidth": 0,
});
_this.MALine10 = widget
.chart()
.createStudy("Moving Average", false, false, [10, "close", 0], null, {
"Plot.color": "red",
"Plot.linewidth": 0,
});
_this.MALine20 = widget
.chart()
.createStudy("Moving Average", false, false, [20, "close", 0], null, {
"Plot.color": "#409EFF",
"Plot.linewidth": 0,
});
widget.chart().getStudyById(_this.MALine5).setVisible(false);
widget.chart().getStudyById(_this.MALine10).setVisible(false);
widget.chart().getStudyById(_this.MALine20).setVisible(false);
vue TradingView k线地址 : https://blog.csdn.net/pxhing/article/details/106997657.
vue TradingView为k线做标记: https://blog.csdn.net/pxhing/article/details/118584281.
这篇博客详细介绍了如何在VueTradingView组件中创建和配置不同周期的移动平均线(MA),包括绿色的5日MA,红色的10日MA和蓝色的20日MA。同时,提供了代码示例展示如何在后期隐藏这些均线,只需调用setVisible(false)方法即可。文章还附带了两个相关的VueTradingView教程链接,分别涉及k线标记和自定义周期设置。

4928

被折叠的 条评论
为什么被折叠?



