small fixes for backtest

This commit is contained in:
Boki 2025-07-03 18:14:40 -04:00
parent 6df32dc18b
commit 6cf3179092
16 changed files with 2180 additions and 16 deletions

View file

@ -413,11 +413,11 @@ export class BacktestEngine extends EventEmitter {
let trendDuration = 0;
while (currentTime <= endTime) {
// Every 20-50 days, change trend
// Every 10-30 days, change trend (more frequent for testing)
if (trendDuration <= 0) {
trend = Math.random() > 0.5 ? 1 : -1;
trendStrength = 0.002 + Math.random() * 0.003; // 0.2% to 0.5% daily trend
trendDuration = Math.floor(20 + Math.random() * 30);
trendStrength = 0.003 + Math.random() * 0.005; // 0.3% to 0.8% daily trend
trendDuration = Math.floor(10 + Math.random() * 20); // Shorter trends
}
// Generate price movement with trend and noise