设置均线

在这里插入图片描述

       //均线
          _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.

Logo

前往低代码交流专区

更多推荐