Compare commits

3 Commits

Author SHA1 Message Date
Simon Moisy
b013183f67 attempt fix for lookahead bias 2025-05-27 18:08:42 +08:00
Simon Moisy
6916722a43 Merge branch 'main' of ssh://dep.sokaris.link:2222/Simon/Cycles 2025-05-27 16:48:33 +08:00
Simon Moisy
47551d6781 ignoring credentials jsons 2025-05-27 16:47:20 +08:00
2 changed files with 6 additions and 3 deletions

3
.gitignore vendored
View File

@@ -6,6 +6,9 @@ __pycache__/
*.py[cod] *.py[cod]
*$py.class *$py.class
# ignore credentils JSON
/credentials/*.json
# C extensions # C extensions
*.so *.so

View File

@@ -123,12 +123,12 @@ class DefaultStrategy(StrategyBase):
if not self.initialized: if not self.initialized:
return StrategySignal("HOLD", 0.0) return StrategySignal("HOLD", 0.0)
if df_index < 1: if df_index < 2: # shifting one index to prevent lookahead bias
return StrategySignal("HOLD", 0.0) return StrategySignal("HOLD", 0.0)
# Check for meta-trend entry condition # Check for meta-trend entry condition
prev_trend = backtester.strategies["meta_trend"][df_index - 1] prev_trend = backtester.strategies["meta_trend"][df_index - 2]
curr_trend = backtester.strategies["meta_trend"][df_index] curr_trend = backtester.strategies["meta_trend"][df_index - 1]
if prev_trend != 1 and curr_trend == 1: if prev_trend != 1 and curr_trend == 1:
# Strong confidence when all indicators align for entry # Strong confidence when all indicators align for entry