| <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> |