- Add two-tab navigation (Indicators, Strategies) in right sidebar - Move all strategy-related content to Strategies tab - Implement sidebar collapse/expand functionality - Add indicator visibility toggle (eye button) - Fix bug where wrong interval data was deleted on TF switch - Add localStorage persistence for sidebar state and active tab - Ensure indicators recalculate when TF changes
1500 lines
44 KiB
HTML
1500 lines
44 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>BTC Trading Dashboard</title>
|
|
<link rel="icon" href="data:,">
|
|
<script src="https://unpkg.com/lightweight-charts@5.1.0/dist/lightweight-charts.standalone.production.js"></script>
|
|
<style>
|
|
:root {
|
|
--tv-bg: #131722;
|
|
--tv-panel-bg: #1e222d;
|
|
--tv-border: #2a2e39;
|
|
--tv-text: #d1d4dc;
|
|
--tv-text-secondary: #787b86;
|
|
--tv-green: #26a69a;
|
|
--tv-red: #ef5350;
|
|
--tv-blue: #2962ff;
|
|
--tv-hover: #2a2e39;
|
|
}
|
|
|
|
* {
|
|
margin: 0;
|
|
padding: 0;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
body {
|
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
background: var(--tv-bg);
|
|
color: var(--tv-text);
|
|
height: 100vh;
|
|
display: flex;
|
|
flex-direction: column;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.toolbar {
|
|
background: var(--tv-panel-bg);
|
|
border-bottom: 1px solid var(--tv-border);
|
|
padding: 8px 16px;
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 16px;
|
|
height: 56px;
|
|
}
|
|
|
|
.toolbar-left {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 12px;
|
|
flex: 1;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.symbol-badge {
|
|
background: var(--tv-bg);
|
|
padding: 6px 12px;
|
|
border-radius: 4px;
|
|
font-weight: 600;
|
|
font-size: 14px;
|
|
border: 1px solid var(--tv-border);
|
|
white-space: nowrap;
|
|
}
|
|
|
|
.timeframe-scroll {
|
|
display: flex;
|
|
gap: 2px;
|
|
overflow-x: auto;
|
|
scrollbar-width: thin;
|
|
scrollbar-color: var(--tv-border) transparent;
|
|
flex: 1;
|
|
}
|
|
|
|
.timeframe-scroll::-webkit-scrollbar {
|
|
height: 4px;
|
|
}
|
|
|
|
.timeframe-scroll::-webkit-scrollbar-track {
|
|
background: transparent;
|
|
}
|
|
|
|
.timeframe-scroll::-webkit-scrollbar-thumb {
|
|
background: var(--tv-border);
|
|
border-radius: 2px;
|
|
}
|
|
|
|
.timeframe-btn {
|
|
background: transparent;
|
|
border: none;
|
|
color: var(--tv-text-secondary);
|
|
padding: 6px 10px;
|
|
font-size: 12px;
|
|
cursor: pointer;
|
|
border-radius: 4px;
|
|
transition: all 0.2s;
|
|
white-space: nowrap;
|
|
min-width: 36px;
|
|
}
|
|
|
|
.timeframe-btn:hover {
|
|
background: var(--tv-hover);
|
|
color: var(--tv-text);
|
|
}
|
|
|
|
.timeframe-btn.active {
|
|
background: var(--tv-blue);
|
|
color: white;
|
|
}
|
|
|
|
.connection-status {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 8px;
|
|
margin-left: auto;
|
|
white-space: nowrap;
|
|
}
|
|
|
|
.status-dot {
|
|
width: 8px;
|
|
height: 8px;
|
|
border-radius: 50%;
|
|
background: var(--tv-green);
|
|
}
|
|
|
|
.status-text {
|
|
font-size: 12px;
|
|
color: var(--tv-text-secondary);
|
|
}
|
|
|
|
.stats-panel {
|
|
background: var(--tv-panel-bg);
|
|
border-bottom: 1px solid var(--tv-border);
|
|
padding: 8px 16px;
|
|
display: flex;
|
|
gap: 32px;
|
|
height: 44px;
|
|
align-items: center;
|
|
}
|
|
|
|
.stat-item {
|
|
display: flex;
|
|
flex-direction: column;
|
|
}
|
|
|
|
.stat-label {
|
|
font-size: 10px;
|
|
color: var(--tv-text-secondary);
|
|
text-transform: uppercase;
|
|
letter-spacing: 0.5px;
|
|
}
|
|
|
|
.stat-value {
|
|
font-size: 14px;
|
|
font-weight: 600;
|
|
}
|
|
|
|
.stat-value.positive { color: var(--tv-green); }
|
|
.stat-value.negative { color: var(--tv-red); }
|
|
|
|
.main-container {
|
|
flex: 1;
|
|
display: flex;
|
|
flex-direction: row;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.chart-area {
|
|
flex: 1;
|
|
display: flex;
|
|
flex-direction: column;
|
|
overflow: hidden;
|
|
min-width: 0;
|
|
}
|
|
|
|
.chart-wrapper {
|
|
flex: 2;
|
|
position: relative;
|
|
background: var(--tv-bg);
|
|
min-height: 0;
|
|
}
|
|
|
|
#chart {
|
|
width: 100%;
|
|
height: 100%;
|
|
}
|
|
|
|
.ta-panel {
|
|
flex: 1;
|
|
background: var(--tv-panel-bg);
|
|
border-top: 1px solid var(--tv-border);
|
|
display: flex;
|
|
flex-direction: column;
|
|
}
|
|
|
|
/* Right Sidebar - Strategy Simulation */
|
|
.right-sidebar {
|
|
width: 350px;
|
|
background: var(--tv-panel-bg);
|
|
border-left: 1px solid var(--tv-border);
|
|
display: flex;
|
|
flex-direction: column;
|
|
overflow: hidden;
|
|
transition: width 0.3s ease;
|
|
}
|
|
|
|
.right-sidebar.collapsed {
|
|
width: 44px;
|
|
min-width: 44px;
|
|
}
|
|
|
|
.sidebar-header {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
padding: 12px 16px;
|
|
border-bottom: 1px solid var(--tv-border);
|
|
background: var(--tv-bg);
|
|
min-height: 48px;
|
|
}
|
|
|
|
.right-sidebar.collapsed .sidebar-header {
|
|
justify-content: center;
|
|
padding: 12px 4px;
|
|
}
|
|
|
|
.sidebar-title {
|
|
font-size: 14px;
|
|
font-weight: 600;
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 8px;
|
|
white-space: nowrap;
|
|
}
|
|
|
|
.right-sidebar.collapsed .sidebar-title {
|
|
display: none;
|
|
}
|
|
|
|
.sidebar-toggle {
|
|
background: transparent;
|
|
border: none;
|
|
color: var(--tv-text);
|
|
cursor: pointer;
|
|
padding: 4px;
|
|
font-size: 16px;
|
|
transition: transform 0.3s ease;
|
|
min-width: 24px;
|
|
min-height: 24px;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
}
|
|
|
|
.sidebar-toggle:hover {
|
|
background: var(--tv-hover);
|
|
border-radius: 4px;
|
|
}
|
|
|
|
.right-sidebar.collapsed .sidebar-toggle {
|
|
transform: rotate(180deg);
|
|
}
|
|
|
|
.sidebar-content {
|
|
flex: 1;
|
|
overflow-y: auto;
|
|
padding: 12px;
|
|
}
|
|
|
|
.right-sidebar.collapsed .sidebar-content {
|
|
display: none;
|
|
}
|
|
|
|
.sidebar-section {
|
|
margin-bottom: 16px;
|
|
border: 1px solid var(--tv-border);
|
|
border-radius: 6px;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.sidebar-section-header {
|
|
background: var(--tv-bg);
|
|
padding: 10px 12px;
|
|
font-size: 12px;
|
|
font-weight: 600;
|
|
text-transform: uppercase;
|
|
letter-spacing: 0.5px;
|
|
border-bottom: 1px solid var(--tv-border);
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 6px;
|
|
}
|
|
|
|
.sidebar-section-content {
|
|
padding: 12px;
|
|
}
|
|
|
|
/* Strategy Config Form */
|
|
.config-group {
|
|
margin-bottom: 12px;
|
|
}
|
|
|
|
.config-label {
|
|
display: block;
|
|
font-size: 11px;
|
|
color: var(--tv-text-secondary);
|
|
text-transform: uppercase;
|
|
margin-bottom: 4px;
|
|
}
|
|
|
|
.config-input {
|
|
width: 100%;
|
|
background: var(--tv-bg);
|
|
border: 1px solid var(--tv-border);
|
|
border-radius: 4px;
|
|
padding: 8px;
|
|
color: var(--tv-text);
|
|
font-size: 13px;
|
|
}
|
|
|
|
.config-input:focus {
|
|
outline: none;
|
|
border-color: var(--tv-blue);
|
|
}
|
|
|
|
/* Strategy List */
|
|
.strategy-item {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 8px;
|
|
padding: 10px;
|
|
border-bottom: 1px solid var(--tv-border);
|
|
cursor: pointer;
|
|
transition: background 0.2s;
|
|
}
|
|
|
|
.strategy-item:last-child {
|
|
border-bottom: none;
|
|
}
|
|
|
|
.strategy-item:hover {
|
|
background: var(--tv-hover);
|
|
}
|
|
|
|
.strategy-item.selected {
|
|
background: rgba(41, 98, 255, 0.1);
|
|
border-left: 3px solid var(--tv-blue);
|
|
}
|
|
|
|
.strategy-radio {
|
|
width: 16px;
|
|
height: 16px;
|
|
accent-color: var(--tv-blue);
|
|
}
|
|
|
|
.strategy-name {
|
|
flex: 1;
|
|
font-size: 13px;
|
|
}
|
|
|
|
.strategy-info {
|
|
color: var(--tv-text-secondary);
|
|
font-size: 14px;
|
|
cursor: help;
|
|
}
|
|
|
|
/* Results Panel */
|
|
.results-summary {
|
|
display: grid;
|
|
grid-template-columns: 1fr 1fr;
|
|
gap: 8px;
|
|
margin-bottom: 12px;
|
|
}
|
|
|
|
.result-stat {
|
|
background: var(--tv-bg);
|
|
padding: 8px;
|
|
border-radius: 4px;
|
|
text-align: center;
|
|
}
|
|
|
|
.result-stat-value {
|
|
font-size: 18px;
|
|
font-weight: 600;
|
|
}
|
|
|
|
.result-stat-label {
|
|
font-size: 10px;
|
|
color: var(--tv-text-secondary);
|
|
text-transform: uppercase;
|
|
}
|
|
|
|
/* Equity Sparkline */
|
|
.equity-sparkline {
|
|
height: 60px;
|
|
background: var(--tv-bg);
|
|
border-radius: 4px;
|
|
margin-bottom: 12px;
|
|
position: relative;
|
|
}
|
|
|
|
/* Action Buttons */
|
|
.action-btn {
|
|
width: 100%;
|
|
padding: 10px;
|
|
border: none;
|
|
border-radius: 4px;
|
|
font-size: 13px;
|
|
font-weight: 600;
|
|
cursor: pointer;
|
|
transition: opacity 0.2s;
|
|
margin-bottom: 8px;
|
|
}
|
|
|
|
.action-btn:hover {
|
|
opacity: 0.9;
|
|
}
|
|
|
|
.action-btn.primary {
|
|
background: var(--tv-blue);
|
|
color: white;
|
|
}
|
|
|
|
.action-btn.secondary {
|
|
background: var(--tv-bg);
|
|
color: var(--tv-text);
|
|
border: 1px solid var(--tv-border);
|
|
}
|
|
|
|
.action-btn.success {
|
|
background: var(--tv-green);
|
|
color: white;
|
|
}
|
|
|
|
/* Saved Simulations List */
|
|
.saved-sim-item {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
padding: 8px;
|
|
background: var(--tv-bg);
|
|
border-radius: 4px;
|
|
margin-bottom: 6px;
|
|
font-size: 12px;
|
|
}
|
|
|
|
.saved-sim-name {
|
|
flex: 1;
|
|
cursor: pointer;
|
|
}
|
|
|
|
.saved-sim-name:hover {
|
|
color: var(--tv-blue);
|
|
}
|
|
|
|
.saved-sim-actions {
|
|
display: flex;
|
|
gap: 4px;
|
|
}
|
|
|
|
.sim-action-btn {
|
|
background: transparent;
|
|
border: none;
|
|
color: var(--tv-text-secondary);
|
|
cursor: pointer;
|
|
padding: 2px 4px;
|
|
font-size: 12px;
|
|
}
|
|
|
|
.sim-action-btn:hover {
|
|
color: var(--tv-text);
|
|
}
|
|
|
|
/* Export Dialog */
|
|
.export-dialog {
|
|
position: fixed;
|
|
top: 50%;
|
|
left: 50%;
|
|
transform: translate(-50%, -50%);
|
|
background: var(--tv-panel-bg);
|
|
border: 1px solid var(--tv-border);
|
|
border-radius: 8px;
|
|
padding: 20px;
|
|
z-index: 10000;
|
|
min-width: 300px;
|
|
box-shadow: 0 4px 20px rgba(0,0,0,0.5);
|
|
}
|
|
|
|
.export-dialog-title {
|
|
font-size: 16px;
|
|
font-weight: 600;
|
|
margin-bottom: 16px;
|
|
}
|
|
|
|
.export-options {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 8px;
|
|
margin-bottom: 16px;
|
|
}
|
|
|
|
.export-option {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 8px;
|
|
padding: 8px;
|
|
background: var(--tv-bg);
|
|
border-radius: 4px;
|
|
cursor: pointer;
|
|
}
|
|
|
|
.export-option:hover {
|
|
background: var(--tv-hover);
|
|
}
|
|
|
|
.dialog-overlay {
|
|
position: fixed;
|
|
top: 0;
|
|
left: 0;
|
|
right: 0;
|
|
bottom: 0;
|
|
background: rgba(0,0,0,0.7);
|
|
z-index: 9999;
|
|
}
|
|
|
|
/* Price Scale Controls */
|
|
.price-scale-controls {
|
|
position: absolute;
|
|
right: 10px;
|
|
bottom: 10px;
|
|
display: flex;
|
|
flex-direction: row;
|
|
gap: 2px;
|
|
z-index: 10;
|
|
opacity: 0;
|
|
transition: opacity 0.2s;
|
|
}
|
|
|
|
.chart-wrapper:hover .price-scale-controls {
|
|
opacity: 1;
|
|
}
|
|
|
|
.ps-control-btn {
|
|
width: 20px;
|
|
height: 20px;
|
|
background: rgba(42, 46, 57, 0.9);
|
|
border: 1px solid #363c4e;
|
|
color: #d1d4dc;
|
|
font-size: 10px;
|
|
cursor: pointer;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
border-radius: 2px;
|
|
transition: all 0.2s;
|
|
padding: 0;
|
|
}
|
|
|
|
.ps-control-btn:hover {
|
|
background: #363c4e;
|
|
border-color: #4a4f5e;
|
|
}
|
|
|
|
.ps-control-btn.active {
|
|
background: #2962ff;
|
|
border-color: #2962ff;
|
|
color: white;
|
|
}
|
|
|
|
/* Navigation Controls */
|
|
.nav-controls {
|
|
position: absolute;
|
|
left: 50%;
|
|
transform: translateX(-50%);
|
|
bottom: 10px;
|
|
display: flex;
|
|
flex-direction: row;
|
|
gap: 4px;
|
|
z-index: 10;
|
|
opacity: 0;
|
|
transition: opacity 0.2s;
|
|
}
|
|
|
|
.chart-wrapper.show-nav .nav-controls {
|
|
opacity: 1;
|
|
}
|
|
|
|
.nav-btn {
|
|
width: 28px;
|
|
height: 28px;
|
|
background: rgba(42, 46, 57, 0.9);
|
|
border: 1px solid #363c4e;
|
|
color: #d1d4dc;
|
|
font-size: 14px;
|
|
cursor: pointer;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
border-radius: 4px;
|
|
transition: all 0.2s;
|
|
padding: 0;
|
|
}
|
|
|
|
.nav-btn:hover {
|
|
background: #363c4e;
|
|
border-color: #4a4f5e;
|
|
}
|
|
|
|
.nav-btn:active {
|
|
background: #2962ff;
|
|
border-color: #2962ff;
|
|
color: white;
|
|
}
|
|
|
|
.ha-header {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
padding: 12px 16px;
|
|
border-bottom: 1px solid var(--tv-border);
|
|
background: var(--tv-bg);
|
|
}
|
|
|
|
.ta-title {
|
|
font-size: 14px;
|
|
font-weight: 600;
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 8px;
|
|
}
|
|
|
|
.ta-interval {
|
|
background: var(--tv-blue);
|
|
color: white;
|
|
padding: 2px 8px;
|
|
border-radius: 4px;
|
|
font-size: 11px;
|
|
}
|
|
|
|
.ta-actions {
|
|
display: flex;
|
|
gap: 8px;
|
|
}
|
|
|
|
.ta-btn {
|
|
background: var(--tv-bg);
|
|
border: 1px solid var(--tv-border);
|
|
color: var(--tv-text);
|
|
padding: 6px 12px;
|
|
border-radius: 4px;
|
|
cursor: pointer;
|
|
font-size: 12px;
|
|
transition: all 0.2s;
|
|
}
|
|
|
|
.ta-btn:hover {
|
|
background: var(--tv-hover);
|
|
border-color: var(--tv-blue);
|
|
}
|
|
|
|
.ta-btn.ai-btn {
|
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
border: none;
|
|
color: white;
|
|
}
|
|
|
|
.ta-btn.ai-btn:hover {
|
|
opacity: 0.9;
|
|
}
|
|
|
|
.ta-last-update {
|
|
font-size: 11px;
|
|
color: var(--tv-text-secondary);
|
|
}
|
|
|
|
.ta-content {
|
|
flex: 1;
|
|
padding: 16px;
|
|
display: grid;
|
|
grid-template-columns: repeat(4, 1fr);
|
|
gap: 16px;
|
|
overflow-y: auto;
|
|
}
|
|
|
|
.ta-section {
|
|
background: var(--tv-bg);
|
|
border: 1px solid var(--tv-border);
|
|
border-radius: 8px;
|
|
padding: 12px;
|
|
}
|
|
|
|
.ta-section-title {
|
|
font-size: 11px;
|
|
color: var(--tv-text-secondary);
|
|
text-transform: uppercase;
|
|
margin-bottom: 8px;
|
|
letter-spacing: 0.5px;
|
|
}
|
|
|
|
.ta-trend {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 8px;
|
|
font-size: 18px;
|
|
font-weight: 600;
|
|
}
|
|
|
|
.ta-trend.bullish { color: var(--tv-green); }
|
|
.ta-trend.bearish { color: var(--tv-red); }
|
|
.ta-trend.neutral { color: var(--tv-text-secondary); }
|
|
|
|
.ta-strength {
|
|
font-size: 12px;
|
|
color: var(--tv-text-secondary);
|
|
margin-top: 4px;
|
|
}
|
|
|
|
.ta-signal {
|
|
display: inline-block;
|
|
padding: 4px 12px;
|
|
border-radius: 4px;
|
|
font-size: 12px;
|
|
font-weight: 600;
|
|
margin-top: 8px;
|
|
}
|
|
|
|
.ta-signal.buy {
|
|
background: rgba(38, 166, 154, 0.2);
|
|
color: var(--tv-green);
|
|
}
|
|
|
|
.ta-signal.sell {
|
|
background: rgba(239, 83, 80, 0.2);
|
|
color: var(--tv-red);
|
|
}
|
|
|
|
.ta-signal.hold {
|
|
background: rgba(120, 123, 134, 0.2);
|
|
color: var(--tv-text-secondary);
|
|
}
|
|
|
|
.ta-ma-row {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
padding: 6px 0;
|
|
border-bottom: 1px solid var(--tv-border);
|
|
font-size: 13px;
|
|
}
|
|
|
|
.ta-ma-row:last-child {
|
|
border-bottom: none;
|
|
}
|
|
|
|
.ta-ma-label {
|
|
color: var(--tv-text-secondary);
|
|
}
|
|
|
|
.ta-ma-value {
|
|
font-weight: 600;
|
|
}
|
|
|
|
.ta-ma-change {
|
|
font-size: 11px;
|
|
margin-left: 4px;
|
|
}
|
|
|
|
.ta-ma-change.positive { color: var(--tv-green); }
|
|
.ta-ma-change.negative { color: var(--tv-red); }
|
|
|
|
.indicator-list {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 2px;
|
|
margin-top: 8px;
|
|
max-height: 300px;
|
|
overflow-y: auto;
|
|
scrollbar-width: none;
|
|
}
|
|
.indicator-list::-webkit-scrollbar { display: none; }
|
|
|
|
/* Indicator Catalog (available indicators) */
|
|
.indicator-catalog {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 2px;
|
|
}
|
|
|
|
.indicator-catalog-item {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
padding: 5px 8px;
|
|
border-radius: 4px;
|
|
cursor: pointer;
|
|
transition: background 0.15s;
|
|
user-select: none;
|
|
border: 1px solid transparent;
|
|
}
|
|
|
|
.indicator-catalog-item:hover {
|
|
background: var(--tv-hover);
|
|
}
|
|
|
|
.indicator-catalog-item.previewing {
|
|
background: rgba(41, 98, 255, 0.1);
|
|
border: 1px solid var(--tv-blue);
|
|
}
|
|
|
|
.indicator-catalog-name {
|
|
font-size: 12px;
|
|
color: var(--tv-text-secondary);
|
|
}
|
|
|
|
.indicator-catalog-item:hover .indicator-catalog-name {
|
|
color: var(--tv-text);
|
|
}
|
|
|
|
.indicator-catalog-add {
|
|
font-size: 16px;
|
|
color: var(--tv-text-secondary);
|
|
cursor: pointer;
|
|
width: 20px;
|
|
height: 20px;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
border-radius: 4px;
|
|
opacity: 0;
|
|
transition: opacity 0.15s;
|
|
}
|
|
|
|
.indicator-catalog-item:hover .indicator-catalog-add {
|
|
opacity: 1;
|
|
}
|
|
|
|
.indicator-catalog-add:hover {
|
|
background: var(--tv-blue);
|
|
color: white;
|
|
}
|
|
|
|
/* Active indicators divider */
|
|
.indicator-active-divider {
|
|
font-size: 10px;
|
|
color: var(--tv-text-secondary);
|
|
text-transform: uppercase;
|
|
letter-spacing: 0.5px;
|
|
padding: 6px 8px 2px;
|
|
border-top: 1px solid var(--tv-border);
|
|
margin-top: 4px;
|
|
}
|
|
|
|
/* Active indicator items */
|
|
.indicator-active-list {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 2px;
|
|
}
|
|
|
|
.indicator-active-item {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 6px;
|
|
padding: 5px 8px;
|
|
border-radius: 4px;
|
|
border: 1px solid transparent;
|
|
transition: background 0.15s;
|
|
}
|
|
|
|
.indicator-active-item:hover {
|
|
background: var(--tv-hover);
|
|
}
|
|
|
|
.indicator-active-item.configuring {
|
|
background: rgba(41, 98, 255, 0.1);
|
|
border-color: var(--tv-blue);
|
|
}
|
|
|
|
.indicator-active-eye {
|
|
font-size: 11px;
|
|
cursor: pointer;
|
|
opacity: 0.6;
|
|
transition: opacity 0.15s;
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
.indicator-active-eye:hover {
|
|
opacity: 1;
|
|
}
|
|
|
|
.indicator-active-name {
|
|
flex: 1;
|
|
font-size: 12px;
|
|
color: var(--tv-text);
|
|
cursor: pointer;
|
|
white-space: nowrap;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
}
|
|
|
|
.indicator-config-btn {
|
|
background: transparent;
|
|
border: 1px solid var(--tv-border);
|
|
color: var(--tv-text-secondary);
|
|
width: 20px;
|
|
height: 20px;
|
|
border-radius: 4px;
|
|
cursor: pointer;
|
|
font-size: 10px;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
transition: all 0.15s;
|
|
flex-shrink: 0;
|
|
opacity: 0;
|
|
}
|
|
|
|
.indicator-active-item:hover .indicator-config-btn {
|
|
opacity: 1;
|
|
}
|
|
|
|
.indicator-config-btn:hover {
|
|
background: var(--tv-hover);
|
|
border-color: var(--tv-blue);
|
|
color: var(--tv-blue);
|
|
}
|
|
|
|
.indicator-config-btn.active {
|
|
background: var(--tv-blue);
|
|
border-color: var(--tv-blue);
|
|
color: white;
|
|
opacity: 1;
|
|
}
|
|
|
|
.indicator-remove-btn {
|
|
background: transparent;
|
|
border: none;
|
|
color: var(--tv-text-secondary);
|
|
width: 20px;
|
|
height: 20px;
|
|
border-radius: 4px;
|
|
cursor: pointer;
|
|
font-size: 14px;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
transition: all 0.15s;
|
|
flex-shrink: 0;
|
|
opacity: 0;
|
|
}
|
|
|
|
.indicator-active-item:hover .indicator-remove-btn {
|
|
opacity: 1;
|
|
}
|
|
|
|
.indicator-remove-btn:hover {
|
|
background: rgba(239, 83, 80, 0.2);
|
|
color: var(--tv-red);
|
|
}
|
|
|
|
.indicator-color-dot {
|
|
display: inline-block;
|
|
width: 8px;
|
|
height: 8px;
|
|
border-radius: 50%;
|
|
margin-left: 2px;
|
|
vertical-align: middle;
|
|
border: 1px solid rgba(255,255,255,0.2);
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
/* Chart Legend Overlay */
|
|
.chart-indicator-legend {
|
|
position: absolute;
|
|
top: 8px;
|
|
left: 8px;
|
|
z-index: 10;
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 3px;
|
|
pointer-events: auto;
|
|
max-height: calc(100% - 40px);
|
|
overflow-y: auto;
|
|
scrollbar-width: none;
|
|
}
|
|
.chart-indicator-legend::-webkit-scrollbar { display: none; }
|
|
|
|
.legend-item {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 4px;
|
|
padding: 2px 6px;
|
|
background: rgba(30, 33, 40, 0.85);
|
|
border: 1px solid var(--tv-border);
|
|
border-radius: 3px;
|
|
cursor: pointer;
|
|
transition: all 0.15s;
|
|
font-size: 11px;
|
|
white-space: nowrap;
|
|
width: fit-content;
|
|
}
|
|
|
|
.legend-item:hover {
|
|
border-color: var(--tv-blue);
|
|
background: rgba(30, 33, 40, 0.95);
|
|
}
|
|
|
|
.legend-item.legend-selected {
|
|
border-color: var(--tv-blue);
|
|
background: rgba(41, 98, 255, 0.15);
|
|
}
|
|
|
|
.legend-item.legend-dimmed {
|
|
opacity: 0.4;
|
|
}
|
|
|
|
.legend-dot {
|
|
width: 6px;
|
|
height: 6px;
|
|
border-radius: 50%;
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
.legend-label {
|
|
color: var(--tv-text);
|
|
font-size: 10px;
|
|
}
|
|
|
|
.legend-close {
|
|
color: var(--tv-text-secondary);
|
|
font-size: 12px;
|
|
line-height: 1;
|
|
opacity: 0;
|
|
transition: opacity 0.15s;
|
|
margin-left: 2px;
|
|
}
|
|
|
|
.legend-item:hover .legend-close {
|
|
opacity: 1;
|
|
}
|
|
|
|
.legend-close:hover {
|
|
color: var(--tv-red);
|
|
}
|
|
|
|
/* Scrollable config form */
|
|
#configForm {
|
|
max-height: 280px;
|
|
overflow-y: auto;
|
|
scrollbar-width: none;
|
|
}
|
|
#configForm::-webkit-scrollbar { display: none; }
|
|
|
|
.ta-level {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
padding: 8px 0;
|
|
font-size: 14px;
|
|
}
|
|
|
|
.ta-level-label {
|
|
color: var(--tv-text-secondary);
|
|
}
|
|
|
|
.ta-level-value {
|
|
font-weight: 600;
|
|
font-family: 'Courier New', monospace;
|
|
}
|
|
|
|
.ta-position-bar {
|
|
width: 100%;
|
|
height: 6px;
|
|
background: var(--tv-border);
|
|
border-radius: 3px;
|
|
margin-top: 8px;
|
|
position: relative;
|
|
}
|
|
|
|
.ta-position-marker {
|
|
position: absolute;
|
|
width: 12px;
|
|
height: 12px;
|
|
background: var(--tv-blue);
|
|
border-radius: 50%;
|
|
top: 50%;
|
|
transform: translate(-50%, -50%);
|
|
border: 2px solid var(--tv-bg);
|
|
}
|
|
|
|
.ta-loading {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
height: 100%;
|
|
color: var(--tv-text-secondary);
|
|
font-size: 14px;
|
|
}
|
|
|
|
.ta-error {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
height: 100%;
|
|
color: var(--tv-red);
|
|
font-size: 14px;
|
|
}
|
|
|
|
/* Simulation Panel Styles */
|
|
.sim-strategies {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 4px;
|
|
margin: 8px 0;
|
|
}
|
|
|
|
.sim-strategy-option {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 8px;
|
|
padding: 8px;
|
|
border-radius: 4px;
|
|
cursor: pointer;
|
|
transition: background 0.2s;
|
|
}
|
|
|
|
.sim-strategy-option:hover {
|
|
background: var(--tv-hover);
|
|
}
|
|
|
|
.sim-strategy-option input[type="radio"] {
|
|
cursor: pointer;
|
|
}
|
|
|
|
.sim-strategy-option label {
|
|
cursor: pointer;
|
|
flex: 1;
|
|
font-size: 13px;
|
|
}
|
|
|
|
.sim-strategy-info {
|
|
color: var(--tv-text-secondary);
|
|
cursor: help;
|
|
position: relative;
|
|
font-size: 14px;
|
|
width: 20px;
|
|
height: 20px;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
border-radius: 50%;
|
|
transition: background 0.2s;
|
|
}
|
|
|
|
.sim-strategy-info:hover {
|
|
background: var(--tv-hover);
|
|
color: var(--tv-text);
|
|
}
|
|
|
|
/* Tooltip */
|
|
.sim-strategy-info:hover::after {
|
|
content: attr(data-tooltip);
|
|
position: absolute;
|
|
bottom: 100%;
|
|
right: 0;
|
|
background: var(--tv-panel-bg);
|
|
border: 1px solid var(--tv-border);
|
|
padding: 8px 12px;
|
|
border-radius: 4px;
|
|
font-size: 12px;
|
|
width: 250px;
|
|
z-index: 100;
|
|
box-shadow: 0 4px 12px rgba(0,0,0,0.3);
|
|
color: var(--tv-text);
|
|
margin-bottom: 4px;
|
|
line-height: 1.4;
|
|
pointer-events: none;
|
|
}
|
|
|
|
.sim-input-group {
|
|
margin-bottom: 12px;
|
|
}
|
|
|
|
.sim-input-group label {
|
|
display: block;
|
|
font-size: 11px;
|
|
color: var(--tv-text-secondary);
|
|
margin-bottom: 4px;
|
|
text-transform: uppercase;
|
|
}
|
|
|
|
.sim-input {
|
|
width: 100%;
|
|
padding: 8px 12px;
|
|
background: var(--tv-bg);
|
|
border: 1px solid var(--tv-border);
|
|
border-radius: 4px;
|
|
color: var(--tv-text);
|
|
font-size: 13px;
|
|
font-family: inherit;
|
|
}
|
|
|
|
.sim-input:focus {
|
|
outline: none;
|
|
border-color: var(--tv-blue);
|
|
}
|
|
|
|
.sim-run-btn {
|
|
width: 100%;
|
|
padding: 10px;
|
|
background: var(--tv-blue);
|
|
color: white;
|
|
border: none;
|
|
border-radius: 4px;
|
|
cursor: pointer;
|
|
font-size: 13px;
|
|
font-weight: 600;
|
|
transition: opacity 0.2s;
|
|
margin-top: 8px;
|
|
}
|
|
|
|
.sim-run-btn:hover:not(:disabled) {
|
|
opacity: 0.9;
|
|
}
|
|
|
|
.sim-run-btn:disabled {
|
|
opacity: 0.5;
|
|
cursor: not-allowed;
|
|
}
|
|
|
|
.sim-results {
|
|
margin-top: 16px;
|
|
padding-top: 16px;
|
|
border-top: 1px solid var(--tv-border);
|
|
}
|
|
|
|
.sim-stat-row {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
padding: 6px 0;
|
|
font-size: 13px;
|
|
}
|
|
|
|
.sim-stat-row span:first-child {
|
|
color: var(--tv-text-secondary);
|
|
}
|
|
|
|
.sim-value {
|
|
font-weight: 600;
|
|
font-family: 'Courier New', monospace;
|
|
}
|
|
|
|
.sim-value.positive { color: var(--tv-green); }
|
|
.sim-value.negative { color: var(--tv-red); }
|
|
|
|
.loading-strategies {
|
|
padding: 12px;
|
|
text-align: center;
|
|
color: var(--tv-text-secondary);
|
|
font-size: 12px;
|
|
}
|
|
|
|
@media (max-width: 1400px) {
|
|
.ta-content {
|
|
grid-template-columns: repeat(3, 1fr);
|
|
}
|
|
}
|
|
|
|
@media (max-width: 1000px) {
|
|
.ta-content {
|
|
grid-template-columns: repeat(2, 1fr);
|
|
}
|
|
}
|
|
|
|
@media (max-width: 600px) {
|
|
.ta-content {
|
|
grid-template-columns: 1fr;
|
|
}
|
|
}
|
|
</style>
|
|
<link rel="stylesheet" href="./css/indicators-new.css">
|
|
</head>
|
|
<body>
|
|
<div class="toolbar">
|
|
<div class="toolbar-left">
|
|
<span class="symbol-badge">BTC/USD</span>
|
|
|
|
<div class="timeframe-scroll" id="timeframeContainer">
|
|
<!-- Timeframes will be inserted here by JS -->
|
|
</div>
|
|
</div>
|
|
|
|
<div class="connection-status">
|
|
<div class="status-dot" id="statusDot"></div>
|
|
<span class="status-text" id="statusText">Live</span>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="stats-panel">
|
|
<div class="stat-item">
|
|
<span class="stat-label">Price</span>
|
|
<span class="stat-value" id="currentPrice">--</span>
|
|
</div>
|
|
<div class="stat-item">
|
|
<span class="stat-label">Change</span>
|
|
<span class="stat-value" id="priceChange">--</span>
|
|
</div>
|
|
<div class="stat-item">
|
|
<span class="stat-label">High</span>
|
|
<span class="stat-value" id="dailyHigh">--</span>
|
|
</div>
|
|
<div class="stat-item">
|
|
<span class="stat-label">Low</span>
|
|
<span class="stat-value" id="dailyLow">--</span>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="main-container">
|
|
<div class="chart-area">
|
|
<div class="chart-wrapper" id="chartWrapper">
|
|
<div id="chart"></div>
|
|
<div class="price-scale-controls" id="priceScaleControls">
|
|
<button class="ps-control-btn auto-scale active" id="btnAutoScale" title="Auto Scale (A)">A</button>
|
|
<button class="ps-control-btn log-scale" id="btnLogScale" title="Logarithmic Scale">L</button>
|
|
</div>
|
|
<div class="nav-controls" id="navControls">
|
|
<button class="nav-btn" id="navLeft" title="Navigate Left (←)">‹</button>
|
|
<button class="nav-btn" id="navRight" title="Navigate Right (→)">›</button>
|
|
<button class="nav-btn" id="navRecent" title="Go to Recent (↑)">»</button>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="ta-panel" id="taPanel">
|
|
<div class="ha-header">
|
|
<div class="ta-title">
|
|
Technical Analysis
|
|
<span class="ta-interval" id="taInterval">1D</span>
|
|
</div>
|
|
<div class="ta-actions">
|
|
<span class="ta-last-update" id="taLastUpdate">--</span>
|
|
<button class="ta-btn ai-btn" id="aiBtn" onclick="openAIAnalysis()">
|
|
🤖 AI Analysis
|
|
</button>
|
|
<button class="ta-btn" onclick="refreshTA()">
|
|
🔄 Refresh
|
|
</button>
|
|
</div>
|
|
</div>
|
|
<div class="ta-content" id="taContent">
|
|
<div class="ta-loading">Waiting for candle data...</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Right Sidebar - Tools Panel -->
|
|
<div class="right-sidebar collapsed" id="rightSidebar">
|
|
<div class="sidebar-header">
|
|
<div class="sidebar-tabs">
|
|
<button class="sidebar-tab active" data-tab="indicators">📊 Indicators</button>
|
|
<button class="sidebar-tab" data-tab="strategies">📋 Strategies</button>
|
|
</div>
|
|
<button class="sidebar-toggle" onclick="toggleSidebar()">◀</button>
|
|
</div>
|
|
|
|
<div class="sidebar-content">
|
|
<!-- Indicators Tab -->
|
|
<div class="sidebar-tab-panel active" id="tab-indicators">
|
|
<div class="sidebar-section-indicators" id="indicatorPanel">
|
|
<div class="sidebar-section-header" style="padding: 8px 12px;">
|
|
<span>📊</span> Indicators
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Strategies Tab -->
|
|
<div class="sidebar-tab-panel" id="tab-strategies">
|
|
<!-- Strategy Selection -->
|
|
<div class="sidebar-section">
|
|
<div class="sidebar-section-header">
|
|
<span>📋</span> Select Strategy
|
|
</div>
|
|
<div class="sidebar-section-content" id="strategyList">
|
|
<div class="loading-strategies" style="text-align: center; color: var(--tv-text-secondary); padding: 20px;">
|
|
Loading strategies...
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Configuration -->
|
|
<div class="sidebar-section">
|
|
<div class="sidebar-section-header">
|
|
<span>⚙️</span> Configuration
|
|
</div>
|
|
<div class="sidebar-section-content">
|
|
<div class="config-group">
|
|
<label class="config-label">Start Date</label>
|
|
<input type="datetime-local" id="simStartDate" class="config-input">
|
|
</div>
|
|
|
|
<div class="config-group">
|
|
<label class="config-label">Confirmation TF (Optional)</label>
|
|
<select id="simSecondaryTF" class="config-input">
|
|
<option value="">None</option>
|
|
<option value="1h">1h</option>
|
|
<option value="4h">4h</option>
|
|
<option value="1d" selected>1d</option>
|
|
<option value="1w">1w</option>
|
|
</select>
|
|
</div>
|
|
|
|
<div class="config-group">
|
|
<label class="config-label">Risk % per Trade</label>
|
|
<input type="number" id="simRiskPercent" class="config-input" value="2" min="0.1" max="100" step="0.1">
|
|
</div>
|
|
|
|
<div class="config-group">
|
|
<label class="config-label">Stop Loss %</label>
|
|
<input type="number" id="simStopLoss" class="config-input" value="2" min="0.1" max="20" step="0.1">
|
|
</div>
|
|
|
|
<div id="strategyParams"></div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Run Button -->
|
|
<button class="action-btn primary" onclick="runSimulation()" id="runSimBtn" disabled>
|
|
▶ Run Simulation
|
|
</button>
|
|
|
|
<!-- Results Section -->
|
|
<div class="sidebar-section" id="resultsSection" style="display: none;">
|
|
<div class="sidebar-section-header">
|
|
<span>📊</span> Results
|
|
</div>
|
|
<div class="sidebar-section-content">
|
|
<div class="equity-sparkline" id="equitySparkline"></div>
|
|
|
|
<div class="results-summary">
|
|
<div class="result-stat">
|
|
<div class="result-stat-value" id="simTrades">--</div>
|
|
<div class="result-stat-label">Trades</div>
|
|
</div>
|
|
<div class="result-stat">
|
|
<div class="result-stat-value" id="simWinRate">--</div>
|
|
<div class="result-stat-label">Win Rate</div>
|
|
</div>
|
|
<div class="result-stat">
|
|
<div class="result-stat-value" id="simPnL">--</div>
|
|
<div class="result-stat-label">Total P&L</div>
|
|
</div>
|
|
<div class="result-stat">
|
|
<div class="result-stat-value" id="simProfitFactor">--</div>
|
|
<div class="result-stat-label">Profit Factor</div>
|
|
</div>
|
|
</div>
|
|
|
|
<button class="action-btn secondary" onclick="showSimulationMarkers()">
|
|
📍 Plot on Chart
|
|
</button>
|
|
<button class="action-btn secondary" onclick="saveSimulation()">
|
|
💾 Save Simulation
|
|
</button>
|
|
<button class="action-btn success" onclick="showExportDialog()">
|
|
📥 Export Report
|
|
</button>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Saved Simulations -->
|
|
<div class="sidebar-section">
|
|
<div class="sidebar-section-header">
|
|
<span>💾</span> Saved Simulations
|
|
</div>
|
|
<div class="sidebar-section-content" id="savedSimulations">
|
|
<div style="text-align: center; color: var(--tv-text-secondary); padding: 10px; font-size: 12px;">
|
|
No saved simulations
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Load Indicators Panel functions for global access -->
|
|
<script>
|
|
window.AVAILABLE_INDICATORS = [
|
|
{ type: 'hts', name: 'HTS Trend System', description: 'Fast/Slow MAs of High/Low prices' },
|
|
{ type: 'sma', name: 'SMA', description: 'Simple Moving Average' },
|
|
{ type: 'ema', name: 'EMA', description: 'Exponential Moving Average' },
|
|
{ type: 'rsi', name: 'RSI', description: 'Relative Strength Index' },
|
|
{ type: 'bb', name: 'Bollinger Bands', description: 'Volatility bands' },
|
|
{ type: 'macd', name: 'MACD', description: 'Moving Average Convergence Divergence' },
|
|
{ type: 'stoch', name: 'Stochastic', description: 'Stochastic Oscillator' },
|
|
{ type: 'atr', name: 'ATR', description: 'Average True Range' }
|
|
];
|
|
</script>
|
|
|
|
<script type="module" src="./js/app.js"></script>
|
|
</body>
|
|
</html>
|