mirror of
https://github.com/ilahuerta-IA/backtrader-atr-stop-loss-usdchf.git
synced 2026-08-14 23:48:05 +00:00
docs: Clean up and clarify inline code comments
This commit is contained in:
@@ -210,8 +210,8 @@ SHORT_ANGLE_SCALE_FACTOR = 10000.0 # Scaling factor for angle calculati
|
||||
# === LONG PULLBACK ENTRY SYSTEM ===
|
||||
LONG_USE_PULLBACK_ENTRY = True # Enable 3-phase pullback entry system for long entries
|
||||
LONG_PULLBACK_MAX_CANDLES = 1 # Max red candles in pullback for long entries (1-3 recommended)
|
||||
LONG_ENTRY_WINDOW_PERIODS = 7 #10 # Bars to wait for breakout after pullback (long entries)
|
||||
LONG_ENTRY_PIP_OFFSET = 1.0 #0.5 #2.0 # Pips above first red candle high for long entry
|
||||
LONG_ENTRY_WINDOW_PERIODS = 7 # Bars to wait for breakout after pullback (long entries)
|
||||
LONG_ENTRY_PIP_OFFSET = 1.0 # Pips above first red candle high for long entry
|
||||
|
||||
# === SHORT PULLBACK ENTRY SYSTEM ===
|
||||
SHORT_USE_PULLBACK_ENTRY = True # Enable 3-phase pullback entry system for short entries
|
||||
@@ -221,20 +221,20 @@ SHORT_ENTRY_PIP_OFFSET = 1.0 # Pips below first green candle low f
|
||||
|
||||
# === TIME RANGE FILTER ===
|
||||
USE_TIME_RANGE_FILTER = True # ENABLED: Time filter for complete analysis
|
||||
ENTRY_START_HOUR = 7#6 # Start hour for entry window (UTC)
|
||||
ENTRY_START_HOUR = 7 # Start hour for entry window (UTC)
|
||||
ENTRY_START_MINUTE = 0 # Start minute for entry window (UTC)
|
||||
ENTRY_END_HOUR = 17#18 #15 # End hour for entry window (UTC)
|
||||
ENTRY_END_MINUTE = 0#59 # End minute for entry window (UTC)
|
||||
ENTRY_END_HOUR = 17 # End hour for entry window (UTC)
|
||||
ENTRY_END_MINUTE = 0 # End minute for entry window (UTC)
|
||||
|
||||
|
||||
class SunriseOsiris(bt.Strategy):
|
||||
params = dict(
|
||||
# === TECHNICAL INDICATORS ===
|
||||
ema_fast_length=14, # Fast EMA period for trend detection #14
|
||||
ema_medium_length=18, # Medium EMA period for trend confirmation #18
|
||||
ema_slow_length=24, #24, # Slow EMA period for trend strength # 24
|
||||
ema_fast_length=14, # Fast EMA period for trend detection
|
||||
ema_medium_length=18, # Medium EMA period for trend confirmation
|
||||
ema_slow_length=24, # Slow EMA period for trend strength
|
||||
ema_confirm_length=1, # Confirmation EMA (usually 1 for immediate response)
|
||||
ema_filter_price_length=50,#70,#50 # Price filter EMA to avoid counter-trend trades #50
|
||||
ema_filter_price_length=50, # Price filter EMA to avoid counter-trend trades
|
||||
ema_exit_length=25, # Exit EMA for crossover exit strategy
|
||||
|
||||
# === ATR RISK MANAGEMENT ===
|
||||
@@ -300,7 +300,7 @@ class SunriseOsiris(bt.Strategy):
|
||||
short_max_angle=SHORT_MAX_ANGLE, # Maximum angle in degrees for EMA slope (short entries)
|
||||
short_angle_scale_factor=SHORT_ANGLE_SCALE_FACTOR, # Scaling factor for angle calculation sensitivity (short entries)
|
||||
short_atr_sl_multiplier=2.5, # Stop Loss multiplier for SHORT trades
|
||||
short_atr_tp_multiplier=6.5,#3.5, # Take Profit multiplier for SHORT trades
|
||||
short_atr_tp_multiplier=6.5, # Take Profit multiplier for SHORT trades
|
||||
|
||||
# === SHORT PULLBACK ENTRY SYSTEM ===
|
||||
short_use_pullback_entry=SHORT_USE_PULLBACK_ENTRY, # Enable 3-phase pullback entry system for short entries
|
||||
@@ -882,7 +882,7 @@ class SunriseOsiris(bt.Strategy):
|
||||
|
||||
# Prevent entry and exit on same bar
|
||||
self.exit_this_bar = False # Flag to prevent entry on exit bar
|
||||
self.last_exit_bar_current = None # Track if we exited this specific bar #3
|
||||
self.last_exit_bar_current = None # Track if we exited this specific bar
|
||||
|
||||
# PULLBACK ENTRY STATE MACHINE
|
||||
self.pullback_state = "NORMAL" # States: NORMAL, WAITING_PULLBACK, WAITING_BREAKOUT
|
||||
|
||||
Reference in New Issue
Block a user