first hurst working, only for current TF
This commit is contained in:
@ -9,7 +9,8 @@
|
||||
<script src="{{ url_for('static', filename='candle-aggregator.js') }}"></script>
|
||||
<script src="{{ url_for('static', filename='sma.js') }}"></script>
|
||||
<script src="{{ url_for('static', filename='ema.js') }}"></script>
|
||||
<script src="{{ url_for('static', filename='bb.js') }}"></script>
|
||||
<script src="{{ url_for('static', filename='bb.js') }}"></script>
|
||||
<script src="{{ url_for('static', filename='hurst.js') }}"></script>
|
||||
<script src="{{ url_for('static', filename='indicators.js') }}"></script>
|
||||
<script src="{{ url_for('static', filename='indicator-manager.js') }}"></script>
|
||||
|
||||
@ -61,6 +62,14 @@
|
||||
}
|
||||
#candle-timer { font-size: 2rem; font-weight: 500; color: var(--accent-orange); }
|
||||
#timeframe-select { margin-top: 10px; }
|
||||
.progress-bar-container {
|
||||
width: 80%; height: 4px; background-color: var(--button-bg);
|
||||
border-radius: 2px; margin-top: 10px; overflow: hidden;
|
||||
}
|
||||
.progress-bar {
|
||||
width: 0%; height: 100%; background-color: var(--green);
|
||||
transition: width 0.4s ease-out;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
@ -86,6 +95,9 @@
|
||||
<option value="9">9m</option>
|
||||
<option value="10">10m</option>
|
||||
</select>
|
||||
<div id="progress-container" class="progress-bar-container">
|
||||
<div class="progress-bar"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-cell" id="indicator-cell-1"></div>
|
||||
<div class="control-cell" id="indicator-cell-2"></div>
|
||||
@ -123,27 +135,32 @@
|
||||
const chartTitle = document.getElementById('chart-title');
|
||||
const analyzeButton = document.getElementById('analyzeButton');
|
||||
const analysisResultDiv = document.getElementById('analysisResult');
|
||||
const progressContainer = document.getElementById('progress-container');
|
||||
const progressBar = document.querySelector('.progress-bar');
|
||||
|
||||
manager = createIndicatorManager(chart, baseCandleData1m);
|
||||
manager = createIndicatorManager(chart, baseCandleData1m, displayedCandleData);
|
||||
manager.populateDropdowns();
|
||||
|
||||
const socket = io();
|
||||
socket.on('connect', () => console.log('Socket.IO connected.'));
|
||||
|
||||
socket.on('history_progress', (data) => {
|
||||
if (data && data.progress) progressBar.style.width = `${data.progress}%`;
|
||||
});
|
||||
|
||||
socket.on('history_finished', (data) => {
|
||||
if (!data || !data.klines_1m) return;
|
||||
|
||||
const mappedKlines = data.klines_1m.map(k => ({
|
||||
progressBar.style.width = '100%';
|
||||
|
||||
baseCandleData1m = data.klines_1m.map(k => ({
|
||||
time: k[0] / 1000, open: parseFloat(k[1]), high: parseFloat(k[2]),
|
||||
low: parseFloat(k[3]), close: parseFloat(k[4])
|
||||
}));
|
||||
|
||||
baseCandleData1m.length = 0;
|
||||
for (const kline of mappedKlines) {
|
||||
baseCandleData1m.push(kline);
|
||||
}
|
||||
|
||||
updateChartForTimeframe();
|
||||
|
||||
setTimeout(() => { progressContainer.style.display = 'none'; }, 500);
|
||||
});
|
||||
|
||||
socket.on('trade', (trade) => {
|
||||
@ -152,7 +169,10 @@
|
||||
const candleTimestamp1m = tradeTime - (tradeTime % 60);
|
||||
|
||||
if (!currentCandle1m || candleTimestamp1m > currentCandle1m.time) {
|
||||
if (currentCandle1m) baseCandleData1m.push(currentCandle1m);
|
||||
if (currentCandle1m) {
|
||||
baseCandleData1m.push(currentCandle1m);
|
||||
manager.updateIndicatorsOnNewCandle(currentCandle1m);
|
||||
}
|
||||
currentCandle1m = { time: candleTimestamp1m, open: price, high: price, low: price, close: price };
|
||||
} else {
|
||||
currentCandle1m.high = Math.max(currentCandle1m.high, price);
|
||||
@ -166,17 +186,11 @@
|
||||
|
||||
let candleForUpdate;
|
||||
if (lastDisplayedCandle && displayedCandleTimestamp === lastDisplayedCandle.time) {
|
||||
candleForUpdate = { ...lastDisplayedCandle };
|
||||
candleForUpdate.high = Math.max(candleForUpdate.high, price);
|
||||
candleForUpdate.low = Math.min(candleForUpdate.low, price);
|
||||
candleForUpdate.close = price;
|
||||
candleForUpdate = { ...lastDisplayedCandle, high: Math.max(lastDisplayedCandle.high, price), low: Math.min(lastDisplayedCandle.low, price), close: price };
|
||||
displayedCandleData[displayedCandleData.length - 1] = candleForUpdate;
|
||||
} else if (!lastDisplayedCandle || displayedCandleTimestamp > lastDisplayedCandle.time) {
|
||||
} else {
|
||||
candleForUpdate = { time: displayedCandleTimestamp, open: price, high: price, low: price, close: price };
|
||||
displayedCandleData.push(candleForUpdate);
|
||||
|
||||
// A new candle has started, so update the indicators.
|
||||
manager.updateIndicatorsOnNewCandle(displayedCandleData);
|
||||
}
|
||||
|
||||
if (candleForUpdate) candlestickSeries.update(candleForUpdate);
|
||||
@ -201,6 +215,7 @@
|
||||
|
||||
setInterval(() => {
|
||||
const selectedIntervalSeconds = parseInt(timeframeSelect.value, 10) * 60;
|
||||
// **FIX**: Corrected syntax
|
||||
const now = new Date().getTime() / 1000;
|
||||
const secondsRemaining = Math.floor(selectedIntervalSeconds - (now % selectedIntervalSeconds));
|
||||
const minutes = Math.floor(secondsRemaining / 60);
|
||||
|
||||
Reference in New Issue
Block a user