Skip to content

Conversation

@peterpeter228
Copy link

No description provided.

Implemented a comprehensive ICT (Inner Circle Trader) strategy based on:
- TIME BASED LIQUIDITY trading notes
- HIGH PROBABILITY DOLS trading notes

Features:
- Time-based session windows (Asian, London, NY AM, NY PM)
- Liquidity pool identification (PWH/PWL, PDH/PDL, Session H/L)
- Liquidity sweep and reclaim detection
- Fair Value Gap (FVG) pattern recognition
- Smart Money reversal patterns
- Dynamic ATR-based stop loss
- Multi-timeframe analysis

Trading Logic:
- Entry: Liquidity sweep + reclaim + FVG confirmation
- Exit: Opposing liquidity pools or reversal signals
- Risk: 3x leverage, 5% hard stop, trailing stop enabled

Files:
- ICT_TimeBasedLiquidityStrategy.py: Main strategy implementation
- ICT_STRATEGY_README.md: Comprehensive usage guide
- config_ict_strategy.json: Configuration example (not tracked)
Fixed critical issues that caused immediate stop-loss triggers:

1. Custom Stoploss Fix:
   - Increased ATR multiplier from 1.5x to 2.0x for more breathing room
   - Added proper error handling and fallback logic
   - Fixed percentage calculation for both long and short positions
   - Added safety caps at 5% maximum

2. Trailing Stop Optimization:
   - Temporarily disabled trailing_stop for debugging
   - Adjusted offset from 0.02 to 0.03 (3%)
   - Prevents premature exits on small profits

3. Liquidity Levels Calculation:
   - Improved PDH/PDL calculation using date grouping
   - More accurate daily high/low identification
   - Better forward-fill logic for consistency

4. Entry Conditions Enhanced:
   - Added session filter (London/NY AM only)
   - Require trend alignment (price vs EMA20)
   - Stricter RSI bounds (30-65 for long, 35-70 for short)
   - Require specific sweep types (PDL/PWL or PDH/PWH)
   - Added data validation checks (notna() for key levels)

5. Risk Management:
   - More conservative entry filters to reduce false signals
   - Better volume confirmation requirements
   - Improved FVG confirmation logic

Expected improvements:
- Reduced false entry signals
- Longer holding periods (not 0:00:00)
- Better win rate through quality over quantity
- More stable backtesting results

Previous issue: 9 trades, all stopped out immediately (0:00:00 duration)
CRITICAL FIX: Resolved immediate stop-loss issue that plagued v1.0 and v1.1

## Root Cause Analysis
- v1.1.0 still had 0:00:00 holding time with trailing_stop_loss exits
- Config file was overriding strategy's trailing_stop = False setting
- Custom stoploss complexity was causing unexpected behavior

## v1.2.0 Changes

### 1. Trailing Stop COMPLETELY REMOVED
```python
trailing_stop = False
trailing_stop_positive = 0.0
trailing_stop_positive_offset = 0.0
trailing_only_offset_is_reached = False
```

### 2. Fixed Stoploss (Simplified)
- Changed from -5% to -3% for more breathing room
- Disabled use_custom_stoploss (set to False)
- Removed complex ATR-based dynamic stop logic
- Using simple, reliable fixed percentage

### 3. Adjusted ROI Targets (More Conservative)
```python
minimal_roi = {
    "0": 0.15,    # 15% immediate
    "120": 0.08,  # 8% after 2h
    "240": 0.05,  # 5% after 4h
    "480": 0.03,  # 3% after 8h
    "720": 0.02   # 2% after 12h
}
```

### 4. Entry Conditions Relaxed (More Samples)
- Expanded session filter to include NY PM
- Added asian_low_sweep and asian_high_sweep to bias filter
- Extended FVG confirmation window (shift 0, 1, 2)
- Widened RSI ranges (25-70 for long, 30-75 for short)
- Reduced volume requirement from 1.5x to 1.3x MA
- Removed trend alignment (EMA20) requirement
- Removed some notna() checks that were too restrictive

### 5. Debug Logging Added
```python
log.info(f"ICT Strategy Analysis: Bullish Sweeps={bullish_sweeps}")
log.info(f"PDL Sweeps: {pdl}, PWL Sweeps: {pwl}")
```

### 6. Disabled Functions
- Commented out custom_stoploss() - too complex
- Commented out custom_exit() - let ROI and signals handle

## Expected Improvements

Previous Results (v1.1.0):
- Trades: 2
- Win Rate: 0%
- Holding Time: 0:00:00
- Exit Reason: trailing_stop_loss (problem!)
- Profit: -0.25%

Expected Results (v1.2.0):
- Trades: 5-15 (more samples)
- Win Rate: >20% (at least some winners)
- Holding Time: >30 minutes (not instant)
- Exit Reason: roi/stoploss/exit_signal (not trailing!)
- Profit: Improved (target >0%)

## Testing Instructions

1. Update strategy file to v1.2.0
2. Run same backtest: --timerange 20241001-
3. Verify exit reasons are NOT "trailing_stop_loss"
4. Check holding time is >0:00:00
5. Report results for further optimization

## Philosophy
Simplicity > Complexity. Fixed stop works better than dynamic ATR when debugging.
Once we have stable results, we can re-add complexity gradually.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants