Implement Strategy tab with Ping-Pong backtesting and crossover-based signal logic

- Add 'Strategy' tab to sidebar for backtesting simulations
- Create strategy-panel.js for Ping-Pong and Accumulation mode simulations
- Refactor all indicators (MA, HTS, RSI, MACD, BB, STOCH, Hurst) to use strict crossover-based signal calculation
- Update chart.js with setSimulationMarkers and clearSimulationMarkers support
- Implement single-entry rule in Ping-Pong simulation mode
This commit is contained in:
DiTus
2026-03-03 13:15:29 +01:00
parent 73f325ce19
commit d92af6903d
13 changed files with 626 additions and 104 deletions

View File

@ -21,9 +21,20 @@ constructor() {
this.indicatorSignals = [];
this.summarySignal = null;
this.lastCandleTimestamp = null;
this.simulationMarkers = [];
this.init();
}
setSimulationMarkers(markers) {
this.simulationMarkers = markers || [];
this.updateSignalMarkers();
}
clearSimulationMarkers() {
this.simulationMarkers = [];
this.updateSignalMarkers();
}
init() {
this.createTimeframeButtons();
@ -584,11 +595,18 @@ async loadSignals() {
}
}
updateSignalMarkers() {
updateSignalMarkers() {
const candles = this.allData.get(this.currentInterval);
if (!candles || candles.length === 0) return;
const markers = calculateSignalMarkers(candles);
let markers = calculateSignalMarkers(candles);
// Merge simulation markers if present
if (this.simulationMarkers && this.simulationMarkers.length > 0) {
markers = [...markers, ...this.simulationMarkers];
// Re-sort combined markers by time
markers.sort((a, b) => a.time - b.time);
}
// If we have a marker controller, update markers through it
if (this.markerController) {