admin管理员组

文章数量:1308040

I'm trying to add "Advanced Real Time chart" widget from tradinview. I'm able to add indicator Exponential moving average and Simple moving average. But it takes default 9 days length. I want to change that.

I tried as below but it does not work. Could somebody please help. Thanks a lot in advance.

widget = new TradingView.widget(
    {
        "width": 1200,
        "height": 700,
        "symbol": "NSE:DRREDDY",
        "interval": "D",
        "timezone": "Asia/Kolkata",
        "theme": "Dark",
        "style": "1",
        "locale": "in",
        "toolbar_bg": "#f1f3f6",
        "enable_publishing": false,
        "hide_side_toolbar": false,
        "allow_symbol_change": true,
        "details": true,
        "studies_overrides": {
            "moving average exponential.length": 20
        },
        "studies": [
            "MAExp@tv-basicstudies"
        ],

        "container_id": "tradingview_f6d89"
    }

I'm trying to add "Advanced Real Time chart" widget from tradinview. I'm able to add indicator Exponential moving average and Simple moving average. But it takes default 9 days length. I want to change that.

I tried as below but it does not work. Could somebody please help. Thanks a lot in advance.

widget = new TradingView.widget(
    {
        "width": 1200,
        "height": 700,
        "symbol": "NSE:DRREDDY",
        "interval": "D",
        "timezone": "Asia/Kolkata",
        "theme": "Dark",
        "style": "1",
        "locale": "in",
        "toolbar_bg": "#f1f3f6",
        "enable_publishing": false,
        "hide_side_toolbar": false,
        "allow_symbol_change": true,
        "details": true,
        "studies_overrides": {
            "moving average exponential.length": 20
        },
        "studies": [
            "MAExp@tv-basicstudies"
        ],

        "container_id": "tradingview_f6d89"
    }
Share Improve this question asked Aug 26, 2018 at 3:25 Dart ConsultantsDart Consultants 811 silver badge3 bronze badges 1
  • Wele to SO. Please provide the full widget code, not only the settings and results vs expected output. Please remember that SO is not a code-writing service. – not2qubit Commented Oct 9, 2018 at 5:51
Add a ment  | 

2 Answers 2

Reset to default 7

Here's the way to do it :

"studies": [
   {
     "id": "MAExp@tv-basicstudies",
     "version": 60,
     "inputs": {
       "length": 20
     }
   },
   ...

The code above takes EMA 20 ticks back on the current time frame (TF), so if you want days, you need to set TF to days and change this value to 9 (or equivalently, set TF to hours and set EMA to 24*9).

本文标签: