- Removed v10 TradingView indicator (moneyline_v10_momentum_dots.pinescript) - Removed v10 penalty system from signal-quality.ts (-30/-25 point penalties) - Removed backtest result files (sweep_*.csv) - Updated copilot-instructions.md to remove v10 references - Simplified direction-specific quality thresholds (LONG 90+, SHORT 80+) Rationale: - 1,944 parameter combinations tested in backtest - All top results IDENTICAL (568 trades, $498 P&L, 61.09% WR) - Momentum parameters had ZERO impact on trade selection - Profit factor 1.027 too low (barely profitable after fees) - Max drawdown -$1,270 vs +$498 profit = terrible risk-reward - v10 penalties were blocking good trades (bug: applied to wrong positions) Keeping v9 as production system - simpler, proven, effective.
39 lines
1.1 KiB
Python
39 lines
1.1 KiB
Python
"""Utilities for loading OHLCV data for local backtesting."""
|
|
from __future__ import annotations
|
|
|
|
from dataclasses import dataclass
|
|
from pathlib import Path
|
|
from typing import Optional
|
|
|
|
import pandas as pd
|
|
|
|
|
|
@dataclass
|
|
class DataSlice:
|
|
symbol: str
|
|
timeframe: str
|
|
data: pd.DataFrame
|
|
|
|
|
|
def load_csv(path: Path, symbol: str, timeframe: str, start: Optional[str] = None, end: Optional[str] = None) -> DataSlice:
|
|
if not path.exists():
|
|
raise FileNotFoundError(f"Missing data file: {path}")
|
|
|
|
df = pd.read_csv(path, parse_dates=["timestamp"])
|
|
df = df.sort_values("timestamp").reset_index(drop=True)
|
|
if start:
|
|
df = df[df["timestamp"] >= pd.Timestamp(start)]
|
|
if end:
|
|
df = df[df["timestamp"] <= pd.Timestamp(end)]
|
|
if df.empty:
|
|
raise ValueError("No rows remain after applying date filters")
|
|
|
|
expected_cols = {"timestamp", "open", "high", "low", "close", "volume"}
|
|
missing = expected_cols.difference(df.columns)
|
|
if missing:
|
|
raise ValueError(f"Missing columns in {path}: {sorted(missing)}")
|
|
|
|
df = df.set_index("timestamp")
|
|
|
|
return DataSlice(symbol=symbol.upper(), timeframe=timeframe, data=df)
|