Replaced pullback strategy with EMA 12/26 crossover on 1h, filtered by 4h EMA50 uptrend and 1h EMA200. Exits via bearish cross or trailing stop. Dec 2025-May 2026 backtest: +1.89 USDT (+0.19%), 27 trades, 37% win rate, 0.29% max drawdown, while BTC dropped 6.7%. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2.3 KiB
2.3 KiB
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Project Overview
Freqtrade BTC/USDT bot on the 1h timeframe. Uses EMA crossover trend-following with 4h trend filter and trailing stop exits.
File Structure
├── docker-compose.yml # freqtrade + download-data services
├── config.json # Exchange, pairs, stake, API server
├── CLAUDE.md
└── user_data/
├── strategies/
│ ├── BTC_1h.py # EMA crossover strategy
│ └── TrendStructureExecutor.py # 5m trend-continuation strategy
├── data/ # Downloaded OHLCV data (gitignored)
└── backtest_results/ # Backtest results (gitignored)
Commands
Download data
docker compose run --rm freqtrade download-data --exchange binance --pairs BTC/USDT --timeframe 1h 4h --days 400
Backtest
docker compose run --rm freqtrade backtesting --strategy BTC1h --timeframe 1h --timerange 20251201-
Hyperopt
docker compose run --rm freqtrade hyperopt --strategy BTC1h --timeframe 1h --epochs 500 --spaces buy sell stoploss
Start live/dry-run
docker compose up -d
View logs
docker compose logs -f
Stop
docker compose down
Configuration Notes
- Dry-run is enabled by default (
dry_run: true). Set tofalseand add exchange API key/secret toexchange.key/exchange.secretto trade live. - The API server runs on
127.0.0.1:8080. Default credentials:freqtrader/changeme. - Data and backtest results persist in
user_data/across restarts.
Strategy (BTC1h)
| Aspect | Detail |
|---|---|
| Type | Trend-following EMA crossover |
| Entry | 4h price > EMA50 + 1h price > EMA200 + 12 EMA crosses above 26 EMA |
| Exit | 12 EMA crosses below 26 EMA, or trailing stop at +1% after +2.5% peak |
| Stop | -2.5% fixed |
| Performance | +1.89 USDT in 157 days (BTC dropped 6.7%). 27 trades, 37% win rate, 0.29% drawdown. Winners avg +2.48%, losers avg -1.24%. |
The strategy is asymmetric: it wins big (trailing stop at +2.48% avg on 37% of trades) and loses small (exit signal at -1.24% avg on 63%). It loses on most trades but profits overall.