- 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.
58 lines
1.2 KiB
Python
58 lines
1.2 KiB
Python
import unicodedata
|
|
import sys
|
|
import re
|
|
|
|
from setuptools.extern import six
|
|
|
|
|
|
# HFS Plus uses decomposed UTF-8
|
|
def decompose(path):
|
|
if isinstance(path, six.text_type):
|
|
return unicodedata.normalize('NFD', path)
|
|
try:
|
|
path = path.decode('utf-8')
|
|
path = unicodedata.normalize('NFD', path)
|
|
path = path.encode('utf-8')
|
|
except UnicodeError:
|
|
pass # Not UTF-8
|
|
return path
|
|
|
|
|
|
def filesys_decode(path):
|
|
"""
|
|
Ensure that the given path is decoded,
|
|
NONE when no expected encoding works
|
|
"""
|
|
|
|
if isinstance(path, six.text_type):
|
|
return path
|
|
|
|
fs_enc = sys.getfilesystemencoding() or 'utf-8'
|
|
candidates = fs_enc, 'utf-8'
|
|
|
|
for enc in candidates:
|
|
try:
|
|
return path.decode(enc)
|
|
except UnicodeDecodeError:
|
|
continue
|
|
|
|
|
|
def try_encode(string, enc):
|
|
"turn unicode encoding into a functional routine"
|
|
try:
|
|
return string.encode(enc)
|
|
except UnicodeEncodeError:
|
|
return None
|
|
|
|
|
|
CODING_RE = re.compile(br'^[ \t\f]*#.*?coding[:=][ \t]*([-\w.]+)')
|
|
|
|
|
|
def detect_encoding(fp):
|
|
first_line = fp.readline()
|
|
fp.seek(0)
|
|
m = CODING_RE.match(first_line)
|
|
if m is None:
|
|
return None
|
|
return m.group(1).decode('ascii')
|