Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to override the studies of the tradingview widget

I am trying to customize a trading view widget without success, I want to change the color of the RSI Indicator, and change the levels, this is the code:

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"
        ],
    });

Thanks in advance

like image 936
xarc Avatar asked Jan 28 '21 15:01

xarc


3 Answers

the correct way to do it is, like the example below

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
                      }
                    }
        ]
    });

You can set inputs of any indicator like this, but I do not know how to change default styles of the indicators. Maybe you know.

like image 145
Nicolas Torres Avatar answered Oct 18 '22 00:10

Nicolas Torres


Use the following code to customize RSI oscillator.

 "studies_overrides": {
            "relative strength index.rsi.color": "#2196f3",
            "relative strength index.upper band.color": "#2100f5",
            "relative strength index.lower band.color": "#2100f5",

            "relative strength index.upper band.value": 80,
            "relative strength index.lower band.value": 20,

        },
        "studies": [
            "RSI@tv-basicstudies"
        ]
like image 2
Hadi Moghaddar Avatar answered Oct 18 '22 00:10

Hadi Moghaddar


for example in tradingview constructor:


new Tradingview.widget({
    overrides: {
       "paneProperties.background": "#ffffff"
    },
    studies_overrides: {
       "volume.volume.color.0": "#00FFFF",
    }

})

Normally I would add more about the solution, but the library isn't open source and its licensing terms might prohibit reproducing any of its documentation.

like image 1
Amir Rezvani Avatar answered Oct 18 '22 01:10

Amir Rezvani