File size: 2,664 Bytes
62a69ad
 
 
e829c46
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62a69ad
 
e829c46
62a69ad
e829c46
 
 
 
 
 
b49dda0
e829c46
 
62a69ad
e829c46
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62a69ad
e829c46
 
962abd5
e829c46
 
 
 
962abd5
e829c46
 
 
 
 
 
 
 
 
 
 
 
 
 
9aa800c
e829c46
 
 
3fd56cb
9c13d3f
ae3f6bd
e829c46
 
 
62a69ad
 
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<!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>
        body, html {
            margin: 0;
            padding: 0;
            width: 100%;
            height: 100%;
            overflow: hidden;
        }
        #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">
        // Parse URL parameters
        const urlParams = new URLSearchParams(window.location.search);
        // Get symbol from URL or default to BTCUSDT
        const symbol = urlParams.get('symbol') || 'BTCUSDT';

        // Get timeframe from URL or default to 1D
        let interval = urlParams.get('interval') || '1D';

        // Improved interval conversion that handles a wider range of formats
        const intervalMap = {
            '1m': '1',
            '3m': '3',
            '5m': '5',
            '5min': '5',
            '15m': '15',
            '15min': '15',
            '30m': '30',
            '30min': '30',
            '1h': '60',
            '2h': '120',
            '4h': '240',
            '1d': 'D',
            '1D': 'D',
            'D': 'D',
            '1W': 'W',
            'W': 'W',
            '1M': 'M',
            'M': 'M'
        };

        // Convert interval if it's in the map
        interval = intervalMap[interval] || interval;

        // Get exchange from URL or default to BINANCE
        const exchange = urlParams.get('exchange') || 'BINANCE';
        // Create the full symbol string
        const fullSymbol = exchange + ":" + symbol;

        // Initialize TradingView widget
        new TradingView.widget({
            "autosize": true,
            "symbol": fullSymbol,
            "interval": interval,
            "timezone": "Etc/UTC",
            "theme": "dark",
            "style": "1",
            "locale": "en",
            "toolbar_bg": "#f1f3f6",
            "enable_publishing": false,
            "hide_top_toolbar": false,
            "hide_legend": false,
            "save_image": false,
            "hide_volume": false,  // This hides the volume indicator
            "container_id": "tradingview_widget_container",
            "studies": [
                "PUB;ae9bc503c1604345bb8b6968d92f466c", // Ultimate RSI [OMAR]
                "PUB;2835" , //Fibbonaci

               
            ]
        });
    </script>
</body>
</html>