如何覆盖交易视图小部件的研究

Leo*_*Leo 5 javascript widget tradingview-api

我正在尝试自定义交易视图小部件但没有成功,我想更改 RSI 指标的颜色,并更改级别,这是代码:

new TradingView.widget({
        "container_id": "box" + i,
        "autosize": true,
        "symbol": chartTicker,
        "interval": intervalValue,
        "timezone": timezoneValue,
        "theme": theme,
        "style": "1",
        "locale": "en",
        "toolbar_bg": toolbarbg,
        "enable_publishing": false,
        // "hide_legend": true,
        "hide_top_toolbar": false,
        "hide_side_toolbar": false,
        "save_image": false,
        "allow_symbol_change": allowsymbolchange,
        "show_popup_button": false,
        "withdateranges": withdateranges,
        "details": details,
        "hideideas": true,
        "disabled_features": ["use_localstorage_for_settings", create_volume_indicator_by_default"],
        "enabled_features": ["move_logo_to_main_pane", "hide_left_toolbar_by_default"],
        // "disabledDrawings": true,
        "studies_overrides": {
            "rsi.rsi.plot.color": "#2196f3",
            "rsi.level.0": 20,
            "rsi.level.1": 80
        },
        "studies": [
            "RSI@tv-basicstudies"
        ],
    });

Run Code Online (Sandbox Code Playgroud)

提前致谢

Nic*_*res 8

我的这段代码工作得很好。也许你可以用来查找错误。`

 var studies = [

     {
       id: "IchimokuCloud@tv-basicstudies",
       version: 2.0
    
     },

    {
      id: "BB@tv-basicstudies",
      inputs: {
        length: 25
      },

    },
    {
      id: "MASimple@tv-basicstudies",
      inputs: {
        length: 200
      }

    },
    {
      id: "MASimple@tv-basicstudies",
      inputs: {
        length: 100
      }

    },
    {
      id: "MASimple@tv-basicstudies",
      inputs: {
        length: 50
      }

    },
    {
      id: "MASimple@tv-basicstudies",
      inputs: {
        length: 9
      }

    },
    {
      id: "RSI@tv-basicstudies",

    },
    {
      id: "RSI@tv-basicstudies",
      inputs: {
        length: 4

      }

    }
  ];


  var chart1 = new TradingView.widget(
    {
      autosize: true,
      symbol: "OANDA:EURUSD",
      interval: "3",
      timezone: "America/Bogota",
      theme: "dark",
      style: "1",
      locale: "en",

      hide_side_toolbar: true,
      hide_top_toolbar: false,
      enable_publishing: false,
      allow_symbol_change: true,
      details: false,

      hidevolume: true,

      studies: studies,
      container_id: "tradingview_1"
    }
  );

Run Code Online (Sandbox Code Playgroud)

希望它有用。


Nic*_*res 4

正确的方法是,如下例所示

new TradingView.widget({
        "container_id": "box" + i,
        "autosize": true,
        "symbol": chartTicker,
        "interval": intervalValue,
        "timezone": timezoneValue,
        "theme": theme,
        "style": "1",
        "locale": "en",
        "toolbar_bg": toolbarbg,
        "enable_publishing": false,
        // "hide_legend": true,
        "hide_top_toolbar": false,
        "hide_side_toolbar": false,
        "save_image": false,
        "allow_symbol_change": allowsymbolchange,
        "show_popup_button": false,
        "withdateranges": withdateranges,
        "details": details,
        "hideideas": true,
        "disabled_features": ["use_localstorage_for_settings", create_volume_indicator_by_default"],
        "enabled_features": ["move_logo_to_main_pane", "hide_left_toolbar_by_default"],
        // "disabledDrawings": true,
        "studies": [
                    {
                      id: "RSI@tv-basicstudies",
                      inputs: {
                       length: 4
                      }
                    }
        ]
    });

Run Code Online (Sandbox Code Playgroud)

您可以像这样设置任何指标的输入,但我不知道如何更改指标的默认样式。也许你知道。