charts / index.html
CORVO-AI's picture
Update index.html
9c13d3f verified
<!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>