-
Notifications
You must be signed in to change notification settings - Fork 668
Claude/freqtrade strategy creation 014 j ld8mjvc x fz m5by z gjv ka #655
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
peterpeter228
wants to merge
5
commits into
iterativv:main
Choose a base branch
from
peterpeter228:claude/freqtrade-strategy-creation-014JLd8mjvcXFzM5byZGjvKa
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Claude/freqtrade strategy creation 014 j ld8mjvc x fz m5by z gjv ka #655
peterpeter228
wants to merge
5
commits into
iterativv:main
from
peterpeter228:claude/freqtrade-strategy-creation-014JLd8mjvcXFzM5byZGjvKa
+1,462
−0
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.