File size: 1,938 Bytes
c844020
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d8eea4e
c844020
 
 
 
 
 
 
 
 
 
 
 
 
 
d8eea4e
 
 
67894ff
d8eea4e
 
 
 
 
 
 
c844020
 
 
cef421c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>TradingView Chart</title>
    <style>
        html, body {
            margin: 0; padding: 0; width: 100%; height: 100%; overflow: hidden;
            background: #0b0e11;
        }
        #tradingview_widget_container {
            width: 100%;
            height: 100vh;
        }
    </style>
</head>
<body>
<div id="tradingview_widget_container"></div>

<script type="text/javascript" src="https://s3.tradingview.com/tv.js"></script>
<script type="text/javascript">
    // These variables are injected by Flask via Jinja
    const symbol = "{{ symbol|e }}";
    const exchange = "{{ exchange|e }}";
    const interval = "{{ interval|e }}"; // already normalized
    const theme = "{{ theme|e }}";
    // indicators is an array
    const indicators = {{ indicators|tojson|safe }};
    const fullSymbol = exchange + ":" + symbol;

    const widget = new TradingView.widget({
        autosize: true,
        symbol: fullSymbol,
        interval: interval,
        timezone: "Etc/UTC",
        theme: theme === "light" ? "light" : "dark",
        style: "1",
        locale: "en",
        toolbar_bg: "#0b0e11",
        enable_publishing: false,
        hide_top_toolbar: false,
        hide_legend: false,
        save_image: false,
        hide_volume: false,
        container_id: "tradingview_widget_container",
        studies: indicators,

        // Option A: add empty bars to the right (shifts chart left)
        right_offset: 80 // try increasing to 30–50 if you need more room
        // Some builds accept camelCase:
        // rightOffset: 20

        // Option B (fallback): comment out right_offset above and use this:
        // overrides: {
        //   "paneProperties.rightMargin": 80 // pixels of right padding
        // }
    });
</script>
</body>
</html>