MidasBot: bot trading crypto IA + stratégies Ichimoku validées

- Infra: Freqtrade (futures dry-run) + Redis + dashboard + Docker Compose
- Couche IA: ai_analyzer (Claude via abonnement, MCP TradingView, backfill biais)
- Stratégies: SampleStrategy, AiBiasStrategy, IchimokuLS (long/short, validée
  train/test + données vierges + walk-forward), MTFIchimoku, variantes hyperopt
- Arbitrage CEX (dry-run), backtesting, walk-forward, volatility targeting
- IchimokuLS en dry-run live (config_live.json)

Claude-Session: https://claude.ai/code/session_01VHETcFacdnDhQzthLpdYFR
This commit is contained in:
jerem
2026-06-23 19:25:49 +02:00
commit 633b033f4d
59 changed files with 3868 additions and 0 deletions

View File

@@ -0,0 +1,68 @@
# pragma pylint: disable=missing-docstring, invalid-name, too-few-public-methods
"""
TrendMomentumStrategy — tentative d'amélioration du rendement (vs SampleStrategy).
Idée : n'entrer que sur des tendances confirmées et fortes (filtre EMA50 + ADX),
laisser courir les gains (ROI plus haut + trailing), couper vite les perdants.
Objectif : meilleur rendement ajusté du risque — PAS de promesse de +10 %/semaine.
"""
from __future__ import annotations
import talib.abstract as ta
from pandas import DataFrame
from freqtrade.strategy import IStrategy
class TrendMomentumStrategy(IStrategy):
INTERFACE_VERSION = 3
timeframe = "1h"
# Laisser courir : on vise des gains plus gros, on attend plus longtemps.
minimal_roi = {"0": 0.12, "240": 0.06, "720": 0.03, "1440": 0}
stoploss = -0.06 # on coupe vite les perdants
trailing_stop = True
trailing_stop_positive = 0.025
trailing_stop_positive_offset = 0.04
trailing_only_offset_is_reached = True
startup_candle_count: int = 60
process_only_new_candles = True
use_exit_signal = True
def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
dataframe["ema_fast"] = ta.EMA(dataframe, timeperiod=9)
dataframe["ema_slow"] = ta.EMA(dataframe, timeperiod=21)
dataframe["ema_trend"] = ta.EMA(dataframe, timeperiod=50)
dataframe["adx"] = ta.ADX(dataframe, timeperiod=14)
dataframe["rsi"] = ta.RSI(dataframe, timeperiod=14)
macd = ta.MACD(dataframe)
dataframe["macd"] = macd["macd"]
dataframe["macdsignal"] = macd["macdsignal"]
return dataframe
def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
dataframe.loc[
(
(dataframe["ema_fast"] > dataframe["ema_slow"]) # tendance courte haussière
& (dataframe["close"] > dataframe["ema_trend"]) # au-dessus tendance MT
& (dataframe["adx"] > 25) # tendance forte
& (dataframe["macd"] > dataframe["macdsignal"]) # momentum haussier
& (dataframe["rsi"] > 50)
& (dataframe["rsi"] < 75) # pas en surachat extrême
& (dataframe["volume"] > 0)
),
"enter_long",
] = 1
return dataframe
def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
dataframe.loc[
(
(dataframe["macd"] < dataframe["macdsignal"]) # momentum se retourne
& (dataframe["close"] < dataframe["ema_slow"])
& (dataframe["volume"] > 0)
),
"exit_long",
] = 1
return dataframe