diff --git a/TradingBot_V1.6_Adaptive_Complete_CORRECTED.ipynb b/TradingBot_V1.6_Adaptive_Complete_CORRECTED.ipynb index 731f27d..07045d4 100644 --- a/TradingBot_V1.6_Adaptive_Complete_CORRECTED.ipynb +++ b/TradingBot_V1.6_Adaptive_Complete_CORRECTED.ipynb @@ -153,6 +153,120 @@ "print(\"βœ… Infrastructure modules loaded\")" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## πŸ“‹ CENTRALIZED TRADING CONFIGURATION\n", + "\n", + "**All trading parameters in one place for easy management**" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# ============================================================================\n", + "# CENTRALIZED TRADING CONFIGURATION\n", + "# ============================================================================\n", + "# All trading parameters should be configured here and referenced throughout\n", + "# the notebook to avoid scattered settings\n", + "\n", + "TRADING_CONFIG = {\n", + " # ========================================================================\n", + " # LOT SIZING & POSITION MANAGEMENT\n", + " # ========================================================================\n", + " 'lot_sizing': {\n", + " 'min_lot': 0.10, # Minimum lot size\n", + " 'max_lot': 0.20, # Maximum lot size\n", + " 'default_lot': 0.10, # Fallback lot size\n", + " 'use_adaptive': True, # Use adaptive position sizing\n", + " },\n", + " \n", + " # ========================================================================\n", + " # RISK MANAGEMENT\n", + " # ========================================================================\n", + " 'risk': {\n", + " 'max_risk_per_trade': 0.02, # 2% max risk per trade\n", + " 'max_positions': 1, # Maximum concurrent positions\n", + " 'max_daily_loss': 0.05, # 5% max daily loss\n", + " },\n", + " \n", + " # ========================================================================\n", + " # CONFIDENCE THRESHOLDS\n", + " # ========================================================================\n", + " 'confidence': {\n", + " 'base_threshold': 70, # Base confidence threshold (all sessions)\n", + " 'ny_threshold': 70, # NY session threshold (was 97, reduced for more trades)\n", + " 'asian_threshold': 70, # Asian session threshold\n", + " 'london_threshold': 70, # London session threshold\n", + " },\n", + " \n", + " # ========================================================================\n", + " # ATR & STOP LOSS\n", + " # ========================================================================\n", + " 'atr': {\n", + " 'base_multiplier': 1.5, # Base ATR multiplier for SL/TP\n", + " 'period': 14, # ATR calculation period\n", + " },\n", + " \n", + " # ========================================================================\n", + " # NEWS FILTER\n", + " # ========================================================================\n", + " 'news_filter': {\n", + " 'enabled': True, # Enable/disable news filter\n", + " 'minutes_before': 30, # Minutes before event to block\n", + " 'minutes_after': 30, # Minutes after event to block\n", + " },\n", + " \n", + " # ========================================================================\n", + " # SESSION SETTINGS\n", + " # ========================================================================\n", + " 'sessions': {\n", + " 'asian_enabled': True,\n", + " 'london_enabled': False, # Currently disabled\n", + " 'ny_enabled': True,\n", + " 'overlap_enabled': False, # Currently disabled\n", + " },\n", + " \n", + " # ========================================================================\n", + " # TRADING SYMBOLS\n", + " # ========================================================================\n", + " 'symbols': {\n", + " 'primary': 'XAUUSD', # Primary trading symbol (Gold)\n", + " 'alternative': [], # Alternative symbols (if needed)\n", + " },\n", + "}\n", + "\n", + "# ============================================================================\n", + "# HELPER FUNCTIONS\n", + "# ============================================================================\n", + "\n", + "def get_config(section, key=None):\n", + " \"\"\"Get configuration value\"\"\"\n", + " if key is None:\n", + " return TRADING_CONFIG.get(section, {})\n", + " return TRADING_CONFIG.get(section, {}).get(key)\n", + "\n", + "def update_config(section, key, value):\n", + " \"\"\"Update configuration value (runtime only, doesn't save to notebook)\"\"\"\n", + " if section not in TRADING_CONFIG:\n", + " TRADING_CONFIG[section] = {}\n", + " TRADING_CONFIG[section][key] = value\n", + " print(f\"βœ… Updated: {section}.{key} = {value}\")\n", + "\n", + "# Print current configuration\n", + "print(\"βœ… TRADING CONFIGURATION LOADED\")\n", + "print()\n", + "print(f\"πŸ“Š Lot Sizing: {TRADING_CONFIG['lot_sizing']['min_lot']} - {TRADING_CONFIG['lot_sizing']['max_lot']} lots\")\n", + "print(f\"⚠️ Max Risk: {TRADING_CONFIG['risk']['max_risk_per_trade']*100}% per trade\")\n", + "print(f\"🎯 Confidence Threshold: {TRADING_CONFIG['confidence']['base_threshold']}%\")\n", + "print(f\"πŸ›‘οΈ News Filter: {'ENABLED' if TRADING_CONFIG['news_filter']['enabled'] else 'DISABLED'}\")\n", + "print(f\"🌍 Primary Symbol: {TRADING_CONFIG['symbols']['primary']}\")" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -343,12 +457,12 @@ "\n", "\n", "╔════════════════════════════════════════════════════════╗\n", - "β•‘ ADAPTIVE RHYTHM STATUS - 12:05:07 UTC β•‘\n", + "β•‘ ADAPTIVE RHYTHM STATUS - 12:17:23 UTC β•‘\n", "╠════════════════════════════════════════════════════════╣\n", "β•‘ Aktuelles Intervall: 5 Minuten β•‘\n", "β•‘ Trading Session: LONDON β•‘\n", "β•‘ VolatilitΓ€tslevel: MEDIUM β•‘\n", - "β•‘ ATR (H1): 14.69 β•‘\n", + "β•‘ ATR (H1): 14.83 β•‘\n", "╠════════════════════════════════════════════════════════╣\n", "β•‘ INTERVALL-SCHEMA: β•‘\n", "β•‘ β€’ Overlap (13-16 UTC): 5-15 Min (aktivste Phase) β•‘\n", @@ -442,29 +556,17 @@ "name": "stderr", "output_type": "stream", "text": [ - "2026-01-14 12:05:09,185 - INFO - 🎯 Advanced Position Manager initialized\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "🎯 Initializing Advanced Position Management...\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "2026-01-14 12:05:09,186 - INFO - Adaptive Sizing: βœ…\n", - "2026-01-14 12:05:09,187 - INFO - Trailing Stop: βœ…\n", - "2026-01-14 12:05:09,188 - INFO - Partial TP: βœ…\n" + "2026-01-14 12:17:24,380 - INFO - 🎯 Advanced Position Manager initialized\n", + "2026-01-14 12:17:24,381 - INFO - Adaptive Sizing: βœ…\n", + "2026-01-14 12:17:24,382 - INFO - Trailing Stop: βœ…\n", + "2026-01-14 12:17:24,382 - INFO - Partial TP: βœ…\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ + "🎯 Initializing Advanced Position Management...\n", "βœ… Advanced Position Management activated!\n", " πŸ“Š Adaptive Position Sizing: ACTIVE\n", " β€’ High Confidence (β‰₯80%): 1.5x risk\n", @@ -1159,14 +1261,17 @@ "metadata": {}, "outputs": [], "source": [ - "def calculate_position_size(self, symbol, stop_loss_pips, max_risk_per_trade=0.02):", + "def calculate_position_size(self, symbol, stop_loss_pips, max_risk_per_trade=None):", " \"\"\"", " Berechnet die Positionsgrâße basierend auf Risiko", " \"\"\"", + " if max_risk_per_trade is None:", + " max_risk_per_trade = TRADING_CONFIG[\"risk\"][\"max_risk_per_trade\"]", + " ", " account_info = mt.account_info()", " if not account_info:", " print(f\"⚠️ Keine Account-Info verfΓΌgbar, verwende Minimum-Lot\")", - " return 0.10", + " return TRADING_CONFIG[\"lot_sizing\"][\"default_lot\"]", " ", " balance = account_info.balance", " risk_amount = balance * max_risk_per_trade", @@ -1175,7 +1280,7 @@ " symbol_info = mt.symbol_info(symbol)", " if not symbol_info:", " print(f\"⚠️ Keine Symbol-Info fΓΌr {symbol}, verwende Minimum-Lot\")", - " return 0.10", + " return TRADING_CONFIG[\"lot_sizing\"][\"default_lot\"]", " ", " # Pip-Wert berechnen", " point = symbol_info.point", @@ -1238,198 +1343,213 @@ } ], "source": [ - "def execute_trade_v2_adaptive(\n", - " symbol=\"XAUUSD\",\n", - " atr_mult=1.5,\n", - " base_confidence=60,\n", - " max_risk_per_trade=0.01,\n", - " risk_filter=True,\n", - " min_atr=0.0008,\n", - " use_pullback_entry=False, # DISABLED\n", - " max_positions=1,\n", - " strategy_name=\"TradingBot_V1.6\",\n", - " debug=True\n", - "):\n", - " \"\"\"\n", - " V1.6 Adaptive Complete Trade-AusfΓΌhrung:\n", - " - Position Control\n", - " - Relaxed Parameter\n", - " - Adaptive Rhythm Integration\n", - " \"\"\"\n", - " \n", - " # SCHRITT 1: POSITION CHECK\n", - " print(f\"\\nπŸ” POSITION CHECK fΓΌr {symbol} (V1.6 Adaptive Complete)\")\n", - " has_position, position_info = check_existing_positions(symbol, strategy_name)\n", - " \n", - " if has_position and position_info['count'] >= max_positions:\n", - " if debug:\n", - " print(f\"πŸ›‘ TRADE BLOCKIERT: {position_info['count']}/{max_positions} Positionen aktiv\")\n", - " for pos in position_info['details']:\n", - " profit_emoji = \"🟒\" if pos['profit'] >= 0 else \"πŸ”΄\"\n", - " print(f\" {pos['type']} @ {pos['price_open']} | {profit_emoji} {pos['profit']:.2f}\")\n", - " return None\n", - " \n", - " print(f\"βœ… Position-Check OK: {position_info['count']}/{max_positions}\")\n", - " \n", - " # SCHRITT 2: Signal Analysis\n", - " signal_info = extended_top_down_v2_adaptive(symbol)\n", - " if signal_info is None:\n", - " print(\"❌ Signal-Analyse fehlgeschlagen\")\n", - " return None\n", - " \n", - " entry_signal = signal_info[\"entry_signal\"]\n", - " confidence = signal_info[\"confidence\"]\n", - " adaptive_threshold = signal_info[\"adaptive_threshold\"]\n", - " signal_quality = signal_info[\"signal_quality\"]\n", - " market_regime = signal_info[\"market_regime\"]\n", - " \n", - " # SCHRITT 3: Get Price/ATR\n", - " m5_info = signal_info[\"trend_info\"][\"M5\"]\n", - " price = m5_info[\"price\"]\n", - " atr = m5_info[\"atr\"]\n", - " \n", - " # SCHRITT 4: Pre-checks\n", - " reason = \"\"\n", - " \n", - " if confidence < adaptive_threshold:\n", - " reason = f\"Confidence {confidence}% < threshold {adaptive_threshold}%\"\n", - " elif entry_signal == 0:\n", - " reason = f\"No entry signal\"\n", - " elif price is None or atr is None:\n", - " reason = \"Price/ATR not available\"\n", - " elif risk_filter and atr < min_atr:\n", - " reason = f\"ATR {atr:.5f} < min_atr {min_atr}\"\n", - " else:\n", - " risk_ok = check_risk_limits(symbol, max_risk_per_trade=max_risk_per_trade)\n", - " if not risk_ok:\n", - " reason = \"Risk limits exceeded\"\n", - " \n", - " # SCHRITT 5: Execute Trade\n", - " if not reason:\n", - " # Final Position Check\n", - " final_check, _ = check_existing_positions(symbol, strategy_name)\n", - " if final_check:\n", - " print(f\"πŸ›‘ Position wurde zwischen Checks erΓΆffnet!\")\n", - " return None\n", - " \n", - " # SL/TP Calculation\n", - " regime_mult = 1.0\n", - " if market_regime['regime'] == 'volatile':\n", - " regime_mult = 1.2\n", - " elif market_regime['regime'] == 'ranging':\n", - " regime_mult = 0.9\n", - " \n", - " adjusted_atr_mult = atr_mult * regime_mult\n", - " \n", - " if entry_signal == 1: # Long\n", - " stop_loss = price - adjusted_atr_mult * atr\n", - " take_profit = price + adjusted_atr_mult * atr * 2.5\n", - " else: # Short\n", - " stop_loss = price + adjusted_atr_mult * atr\n", - " take_profit = price - adjusted_atr_mult * atr * 2.5\n", - " \n", - " # Position Sizing\n", - " account_info = mt.account_info()\n", - " if account_info:\n", - " balance = account_info.balance\n", - " risk_amount = balance * max_risk_per_trade\n", - " if symbol == \"XAUUSD\":\n", - " # 🎯 ADAPTIVE POSITION SIZING\n", - " if 'adv_position_mgr' in globals() and adv_position_mgr.adaptive_sizing:\n", - " volume = adv_position_mgr.adaptive_sizing.calculate_position_size(\n", - " confidence=confidence,\n", - " balance=balance,\n", - " stop_loss_distance=adjusted_atr_mult * atr * 10000, # Convert to pips\n", - " symbol=symbol\n", - " )\n", - " else:\n", - " volume = round(min(0.2, max(0.10, risk_amount / (adjusted_atr_mult * atr * 100))),2)\n", - " else:\n", - " volume = 0.10\n", - " else:\n", - " volume = 0.10\n", - " \n", - " # Log Trade Info\n", - " print(f\"\\nπŸš€ V1.6 ADAPTIVE COMPLETE TRADE EXECUTION\")\n", - " print(f\"Direction: {'LONG' if entry_signal == 1 else 'SHORT'}\")\n", - " print(f\"Price: {price:.5f} | Volume: {volume:.2f}\")\n", - " print(f\"SL: {stop_loss:.5f} | TP: {take_profit:.5f}\")\n", - " print(f\"Confidence: {confidence}% | Quality: {signal_quality.upper()}\")\n", - " print(f\"Regime: {market_regime['regime'].upper()}\")\n", - " print(f\"Adaptive Interval: {signal_info['adaptive_interval']} min\")\n", - " print(f\"Session: {signal_info['session'].upper()}\")\n", - " \n", - " # Execute\n", - " try:\n", - " order_result = market_order(\n", - " symbol=symbol,\n", - " volume=volume,\n", - " order_type=\"buy\" if entry_signal == 1 else \"sell\",\n", - " stoploss=stop_loss,\n", - " take_profit=take_profit\n", - " )\n", - " \n", - " if order_result and order_result.retcode == mt.TRADE_RETCODE_DONE:\n", - " print(f\"βœ… Trade erfolgreich! Ticket: {order_result.order}\")\n", - " \n", - " # ==========================================\n", - " # LOG TRADE ENTRY (V1.8)\n", - " # ==========================================\n", - " try:\n", - " # Hole Position Info\n", - " positions = mt.positions_get(symbol=symbol)\n", - " if positions and infra:\n", - " position = positions[0]\n", - "\n", - " # Erstelle Trade Data\n", - " trade_data = {\n", - " 'ticket': position.ticket,\n", - " 'position_id': position.identifier,\n", - " 'symbol': symbol,\n", - " 'strategy_name': strategy_name,\n", - " 'type': 'BUY' if entry_signal == 1 else 'SELL',\n", - " 'volume': volume,\n", - " 'entry_price': position.price_open,\n", - " 'sl_price': position.sl,\n", - " 'tp_price': position.tp,\n", - " 'entry_time': datetime.now().strftime('%Y-%m-%d %H:%M:%S'),\n", - " 'session': rhythm_manager.get_current_session(),\n", - " 'regime': market_regime['regime'],\n", - " 'quality': signal_quality,\n", - " 'confidence': confidence if 'confidence' in locals() else None,\n", - " 'timeframe_alignment': signal_info.get('required_alignment', 2),\n", - " 'risk_amount': risk_amount if 'risk_amount' in locals() else None,\n", - " 'risk_pct': max_risk_per_trade\n", - " }\n", - "\n", - " # Log to Database + Send Telegram\n", - " infra.log_trade_entry(trade_data)\n", - " logger.info(\"πŸ“± Trade logged to DB + Telegram notification sent\")\n", - "\n", - " except Exception as e:\n", - " logger.error(f\"⚠️ Infrastructure logging failed: {e}\")\n", - " # ==========================================\n", - "\n", - "\n", - " # Verify & Log\n", - " new_check, new_info = check_existing_positions(symbol, strategy_name)\n", - " print(f\"πŸ“Š Positionen: {new_info['count']}\")\n", - " log_trade_performance_adaptive(signal_info, order_result)\n", - " else:\n", - " print(f\"❌ Trade failed: {order_result.comment if order_result else 'No result'}\")\n", - " \n", - " return order_result\n", - " \n", - " except Exception as e:\n", - " print(f\"❌ Execution failed: {e}\")\n", - " return None\n", - " \n", - " else:\n", - " if debug:\n", - " print(f\"\\n⏸️ TRADE SKIPPED: {reason}\")\n", - " return None\n", - "\n", - "\n", + "def execute_trade_v2_adaptive(", + " symbol=None,", + " atr_mult=None,", + " base_confidence=None,", + " max_risk_per_trade=None,", + " risk_filter=True,", + " min_atr=0.0008,", + " use_pullback_entry=False, # DISABLED", + " max_positions=None,", + " strategy_name=\"TradingBot_V1.6\",", + " debug=True", + "):", + " \"\"\"", + " V1.6 Adaptive Complete Trade-AusfΓΌhrung:", + " - Position Control", + " - Relaxed Parameter", + " - Adaptive Rhythm Integration", + " \"\"\"", + " ", + " # ========================================================================", + " # LOAD DEFAULTS FROM TRADING_CONFIG", + " # ========================================================================", + " if symbol is None:", + " symbol = TRADING_CONFIG[\"symbols\"][\"primary\"]", + " if atr_mult is None:", + " atr_mult = TRADING_CONFIG[\"atr\"][\"base_multiplier\"]", + " if base_confidence is None:", + " base_confidence = TRADING_CONFIG[\"confidence\"][\"base_threshold\"]", + " if max_risk_per_trade is None:", + " max_risk_per_trade = TRADING_CONFIG[\"risk\"][\"max_risk_per_trade\"]", + " if max_positions is None:", + " max_positions = TRADING_CONFIG[\"risk\"][\"max_positions\"]", + " ", + " ", + " # SCHRITT 1: POSITION CHECK", + " print(f\"\\nπŸ” POSITION CHECK fΓΌr {symbol} (V1.6 Adaptive Complete)\")", + " has_position, position_info = check_existing_positions(symbol, strategy_name)", + " ", + " if has_position and position_info['count'] >= max_positions:", + " if debug:", + " print(f\"πŸ›‘ TRADE BLOCKIERT: {position_info['count']}/{max_positions} Positionen aktiv\")", + " for pos in position_info['details']:", + " profit_emoji = \"🟒\" if pos['profit'] >= 0 else \"πŸ”΄\"", + " print(f\" {pos['type']} @ {pos['price_open']} | {profit_emoji} {pos['profit']:.2f}\")", + " return None", + " ", + " print(f\"βœ… Position-Check OK: {position_info['count']}/{max_positions}\")", + " ", + " # SCHRITT 2: Signal Analysis", + " signal_info = extended_top_down_v2_adaptive(symbol)", + " if signal_info is None:", + " print(\"❌ Signal-Analyse fehlgeschlagen\")", + " return None", + " ", + " entry_signal = signal_info[\"entry_signal\"]", + " confidence = signal_info[\"confidence\"]", + " adaptive_threshold = signal_info[\"adaptive_threshold\"]", + " signal_quality = signal_info[\"signal_quality\"]", + " market_regime = signal_info[\"market_regime\"]", + " ", + " # SCHRITT 3: Get Price/ATR", + " m5_info = signal_info[\"trend_info\"][\"M5\"]", + " price = m5_info[\"price\"]", + " atr = m5_info[\"atr\"]", + " ", + " # SCHRITT 4: Pre-checks", + " reason = \"\"", + " ", + " if confidence < adaptive_threshold:", + " reason = f\"Confidence {confidence}% < threshold {adaptive_threshold}%\"", + " elif entry_signal == 0:", + " reason = f\"No entry signal\"", + " elif price is None or atr is None:", + " reason = \"Price/ATR not available\"", + " elif risk_filter and atr < min_atr:", + " reason = f\"ATR {atr:.5f} < min_atr {min_atr}\"", + " else:", + " risk_ok = check_risk_limits(symbol, max_risk_per_trade=max_risk_per_trade)", + " if not risk_ok:", + " reason = \"Risk limits exceeded\"", + " ", + " # SCHRITT 5: Execute Trade", + " if not reason:", + " # Final Position Check", + " final_check, _ = check_existing_positions(symbol, strategy_name)", + " if final_check:", + " print(f\"πŸ›‘ Position wurde zwischen Checks erΓΆffnet!\")", + " return None", + " ", + " # SL/TP Calculation", + " regime_mult = 1.0", + " if market_regime['regime'] == 'volatile':", + " regime_mult = 1.2", + " elif market_regime['regime'] == 'ranging':", + " regime_mult = 0.9", + " ", + " adjusted_atr_mult = atr_mult * regime_mult", + " ", + " if entry_signal == 1: # Long", + " stop_loss = price - adjusted_atr_mult * atr", + " take_profit = price + adjusted_atr_mult * atr * 2.5", + " else: # Short", + " stop_loss = price + adjusted_atr_mult * atr", + " take_profit = price - adjusted_atr_mult * atr * 2.5", + " ", + " # Position Sizing", + " account_info = mt.account_info()", + " if account_info:", + " balance = account_info.balance", + " risk_amount = balance * max_risk_per_trade", + " if symbol == \"XAUUSD\":", + " # 🎯 ADAPTIVE POSITION SIZING", + " if 'adv_position_mgr' in globals() and adv_position_mgr.adaptive_sizing:", + " volume = adv_position_mgr.adaptive_sizing.calculate_position_size(", + " confidence=confidence,", + " balance=balance,", + " stop_loss_distance=adjusted_atr_mult * atr * 10000, # Convert to pips", + " symbol=symbol", + " )", + " else:", + " volume = round(min(TRADING_CONFIG[\"lot_sizing\"][\"max_lot\"], max(TRADING_CONFIG[\"lot_sizing\"][\"min_lot\"], risk_amount / (adjusted_atr_mult * atr * 100))),2)", + " else:", + " volume = TRADING_CONFIG[\"lot_sizing\"][\"default_lot\"]", + " else:", + " volume = TRADING_CONFIG[\"lot_sizing\"][\"default_lot\"]", + " ", + " # Log Trade Info", + " print(f\"\\nπŸš€ V1.6 ADAPTIVE COMPLETE TRADE EXECUTION\")", + " print(f\"Direction: {'LONG' if entry_signal == 1 else 'SHORT'}\")", + " print(f\"Price: {price:.5f} | Volume: {volume:.2f}\")", + " print(f\"SL: {stop_loss:.5f} | TP: {take_profit:.5f}\")", + " print(f\"Confidence: {confidence}% | Quality: {signal_quality.upper()}\")", + " print(f\"Regime: {market_regime['regime'].upper()}\")", + " print(f\"Adaptive Interval: {signal_info['adaptive_interval']} min\")", + " print(f\"Session: {signal_info['session'].upper()}\")", + " ", + " # Execute", + " try:", + " order_result = market_order(", + " symbol=symbol,", + " volume=volume,", + " order_type=\"buy\" if entry_signal == 1 else \"sell\",", + " stoploss=stop_loss,", + " take_profit=take_profit", + " )", + " ", + " if order_result and order_result.retcode == mt.TRADE_RETCODE_DONE:", + " print(f\"βœ… Trade erfolgreich! Ticket: {order_result.order}\")", + " ", + " # ==========================================", + " # LOG TRADE ENTRY (V1.8)", + " # ==========================================", + " try:", + " # Hole Position Info", + " positions = mt.positions_get(symbol=symbol)", + " if positions and infra:", + " position = positions[0]", + "", + " # Erstelle Trade Data", + " trade_data = {", + " 'ticket': position.ticket,", + " 'position_id': position.identifier,", + " 'symbol': symbol,", + " 'strategy_name': strategy_name,", + " 'type': 'BUY' if entry_signal == 1 else 'SELL',", + " 'volume': volume,", + " 'entry_price': position.price_open,", + " 'sl_price': position.sl,", + " 'tp_price': position.tp,", + " 'entry_time': datetime.now().strftime('%Y-%m-%d %H:%M:%S'),", + " 'session': rhythm_manager.get_current_session(),", + " 'regime': market_regime['regime'],", + " 'quality': signal_quality,", + " 'confidence': confidence if 'confidence' in locals() else None,", + " 'timeframe_alignment': signal_info.get('required_alignment', 2),", + " 'risk_amount': risk_amount if 'risk_amount' in locals() else None,", + " 'risk_pct': max_risk_per_trade", + " }", + "", + " # Log to Database + Send Telegram", + " infra.log_trade_entry(trade_data)", + " logger.info(\"πŸ“± Trade logged to DB + Telegram notification sent\")", + "", + " except Exception as e:", + " logger.error(f\"⚠️ Infrastructure logging failed: {e}\")", + " # ==========================================", + "", + "", + " # Verify & Log", + " new_check, new_info = check_existing_positions(symbol, strategy_name)", + " print(f\"πŸ“Š Positionen: {new_info['count']}\")", + " log_trade_performance_adaptive(signal_info, order_result)", + " else:", + " print(f\"❌ Trade failed: {order_result.comment if order_result else 'No result'}\")", + " ", + " return order_result", + " ", + " except Exception as e:", + " print(f\"❌ Execution failed: {e}\")", + " return None", + " ", + " else:", + " if debug:", + " print(f\"\\n⏸️ TRADE SKIPPED: {reason}\")", + " return None", + "", + "", "print(\"βœ… V1.6 Adaptive Complete Execute Trade defined\")" ] }, @@ -2379,33 +2499,13 @@ "name": "stderr", "output_type": "stream", "text": [ - "2026-01-14 12:05:39,951 - INFO - βœ… Trading resumed after: None\n" + "2026-01-14 12:17:45,679 - INFO - βœ… Trading resumed after: None\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ - "βœ… Command handlers registered\n", - "πŸš€ Starting Telegram Bot...\n", - "πŸ“± Send /help to see available commands\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "2026-01-14 12:05:41,193 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/sendMessage \"HTTP/1.1 200 OK\"\n", - "2026-01-14 12:05:41,228 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getMe \"HTTP/1.1 200 OK\"\n", - "2026-01-14 12:05:41,231 - INFO - Application started\n", - "2026-01-14 12:05:41,252 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/deleteWebhook \"HTTP/1.1 200 OK\"\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "βœ… Bot is running\n", "βœ… Trading force-resumed (Ranging Filter deployed)\n" ] } @@ -2492,6 +2592,11 @@ } ], "source": [ + "# ============================================================================", + "# NOTE: This config is DEPRECATED - use TRADING_CONFIG in Cell 6 instead", + "# This is kept for backward compatibility only", + "# ============================================================================", + "", "# βœ… KORRIGIERT: Zentrale Konfiguration (fehlte in ursprΓΌnglicher V1.6)", "ADAPTIVE_COMPLETE_CONFIG = {", " 'symbol': symbol,", @@ -2634,19 +2739,19 @@ "name": "stderr", "output_type": "stream", "text": [ - "2026-01-14 12:05:42,400 - INFO - Adding job tentatively -- it will be properly scheduled when the scheduler starts\n", - "2026-01-14 12:05:42,403 - INFO - Adding job tentatively -- it will be properly scheduled when the scheduler starts\n", - "2026-01-14 12:05:42,414 - INFO - Adding job tentatively -- it will be properly scheduled when the scheduler starts\n", - "2026-01-14 12:05:42,415 - INFO - Adding job tentatively -- it will be properly scheduled when the scheduler starts\n", - "2026-01-14 12:05:42,434 - INFO - Adding job tentatively -- it will be properly scheduled when the scheduler starts\n", - "2026-01-14 12:05:42,436 - INFO - Adding job tentatively -- it will be properly scheduled when the scheduler starts\n", - "2026-01-14 12:05:42,438 - INFO - Added job \"create_protected_trading_check..protected_check\" to job store \"default\"\n", - "2026-01-14 12:05:42,439 - INFO - Added job \"print_status_report\" to job store \"default\"\n", - "2026-01-14 12:05:42,440 - INFO - Added job \"TradingInfrastructure.send_daily_report\" to job store \"default\"\n", - "2026-01-14 12:05:42,441 - INFO - Added job \"TradingInfrastructure.send_weekly_report\" to job store \"default\"\n", - "2026-01-14 12:05:42,442 - INFO - Added job \"PositionMonitor.check_open_positions\" to job store \"default\"\n", - "2026-01-14 12:05:42,442 - INFO - Added job \"\" to job store \"default\"\n", - "2026-01-14 12:05:42,443 - INFO - Scheduler started\n" + "2026-01-14 12:17:47,190 - INFO - Adding job tentatively -- it will be properly scheduled when the scheduler starts\n", + "2026-01-14 12:17:47,193 - INFO - Adding job tentatively -- it will be properly scheduled when the scheduler starts\n", + "2026-01-14 12:17:47,195 - INFO - Adding job tentatively -- it will be properly scheduled when the scheduler starts\n", + "2026-01-14 12:17:47,196 - INFO - Adding job tentatively -- it will be properly scheduled when the scheduler starts\n", + "2026-01-14 12:17:47,237 - INFO - Adding job tentatively -- it will be properly scheduled when the scheduler starts\n", + "2026-01-14 12:17:47,242 - INFO - Adding job tentatively -- it will be properly scheduled when the scheduler starts\n", + "2026-01-14 12:17:47,247 - INFO - Added job \"create_protected_trading_check..protected_check\" to job store \"default\"\n", + "2026-01-14 12:17:47,249 - INFO - Added job \"print_status_report\" to job store \"default\"\n", + "2026-01-14 12:17:47,252 - INFO - Added job \"TradingInfrastructure.send_daily_report\" to job store \"default\"\n", + "2026-01-14 12:17:47,254 - INFO - Added job \"TradingInfrastructure.send_weekly_report\" to job store \"default\"\n", + "2026-01-14 12:17:47,255 - INFO - Added job \"PositionMonitor.check_open_positions\" to job store \"default\"\n", + "2026-01-14 12:17:47,257 - INFO - Added job \"\" to job store \"default\"\n", + "2026-01-14 12:17:47,258 - INFO - Scheduler started\n" ] }, { @@ -2769,13 +2874,23 @@ "\n", "πŸ“Š POSITION SUMMARY fΓΌr XAUUSD (V1.6 Adaptive Complete)\n", "============================================================\n", - "βœ… Keine aktiven Positionen - bereit fΓΌr neuen Trade\n" + "⚠️ 1 aktive Position(en) gefunden:\n", + "\n", + " Position 1:\n", + " Ticket: 668660737\n", + " Typ: BUY\n", + " Volumen: 0.01\n", + " ErΓΆffnungspreis: 4636.11\n", + " Profit: 🟒 0.58\n", + " ErΓΆffnungszeit: 2026-01-14 13:05:44\n", + "\n", + "πŸ›‘ TRADING BLOCKIERT - Maximal 1 Position erlaubt\n" ] }, { "data": { "text/plain": [ - "False" + "True" ] }, "execution_count": 34, @@ -2797,14 +2912,6 @@ "execution_count": 35, "metadata": {}, "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "2026-01-14 12:05:43,375 - INFO - πŸ”„ Rhythmus-Γ„nderung: 5m β†’ 15m\n", - "2026-01-14 12:05:43,377 - INFO - Session: london, VolatilitΓ€t: medium (ATR: 14.77)\n" - ] - }, { "name": "stdout", "output_type": "stream", @@ -2814,24 +2921,38 @@ "==================================================\n", "\n", "╔════════════════════════════════════════════════════════╗\n", - "β•‘ ADAPTIVE RHYTHM STATUS - 12:05:43 UTC β•‘\n", + "β•‘ ADAPTIVE RHYTHM STATUS - 12:17:48 UTC β•‘\n", "╠════════════════════════════════════════════════════════╣\n", "β•‘ Aktuelles Intervall: 5 Minuten β•‘\n", "β•‘ Trading Session: LONDON β•‘\n", "β•‘ VolatilitΓ€tslevel: MEDIUM β•‘\n", - "β•‘ ATR (H1): 14.77 β•‘\n", + "β•‘ ATR (H1): 14.83 β•‘\n", "╠════════════════════════════════════════════════════════╣\n", "β•‘ INTERVALL-SCHEMA: β•‘\n", "β•‘ β€’ Overlap (13-16 UTC): 5-15 Min (aktivste Phase) β•‘\n", "β•‘ β€’ London/NY: 5-30 Min (volatilitΓ€tsabh.) β•‘\n", "β•‘ β€’ Asian Session: 15-30 Min (ruhigere Phase) β•‘\n", "β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•\n", - "\n", + "\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "2026-01-14 12:17:48,502 - INFO - πŸ”„ Rhythmus-Γ„nderung: 5m β†’ 15m\n", + "2026-01-14 12:17:48,504 - INFO - Session: london, VolatilitΓ€t: medium (ATR: 14.83)\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ "\n", "Details:\n", " Optimal Interval: 15 min\n", " Session: london\n", - " ATR: 14.77\n", + " ATR: 14.83\n", " Volatility Level: medium\n" ] } @@ -2879,19 +3000,19 @@ "+------+---------+------------+---------+----------+---------+\n", "| TF | Trend | Strength | ATR | Slope | Price |\n", "|------+---------+------------+---------+----------+---------|\n", - "| D1 | uptrend | 739.82 | 82.3776 | 9.14175 | 4636.36 |\n", - "| H4 | uptrend | 464.1 | 31.7911 | 2.21313 | 4636.36 |\n", - "| H1 | uptrend | 623.53 | 14.7869 | 1.38301 | 4636.36 |\n", - "| M30 | uptrend | 650.12 | 10.0902 | 0.983969 | 4636.36 |\n", - "| M15 | uptrend | 316.29 | 6.6465 | 0.315335 | 4636.36 |\n", - "| M5 | uptrend | 546.46 | 3.2868 | 0.269419 | 4636.36 |\n", + "| D1 | uptrend | 739.83 | 82.3776 | 9.14182 | 4636.69 |\n", + "| H4 | uptrend | 464.11 | 31.7911 | 2.21321 | 4636.69 |\n", + "| H1 | uptrend | 620.84 | 14.8519 | 1.38309 | 4636.69 |\n", + "| M30 | uptrend | 646.01 | 10.1552 | 0.984047 | 4636.69 |\n", + "| M15 | uptrend | 342.8 | 6.3281 | 0.325397 | 4636.69 |\n", + "| M5 | uptrend | 535.23 | 3.1955 | 0.256551 | 4636.69 |\n", "+------+---------+------------+---------+----------+---------+\n", "\n", - "➑️ Standard-Trend: uptrend (Strength: 629.53)\n", + "➑️ Standard-Trend: uptrend (Strength: 629.54)\n", "➑️ Fast-Trend: uptrend (Required: 2/4)\n", "➑️ Top-Down-Trend: uptrend\n", "➑️ Confidence: 100.0% (Threshold: 70%)\n", - "➑️ Risk-Adjusted Strength: 218151.8 (Min: 80)\n", + "➑️ Risk-Adjusted Strength: 218695.9 (Min: 80)\n", "➑️ Signal Quality: EXCELLENT\n", "\n", "πŸš€ V1.6 Adaptive Complete: Full Features + Adaptive Rhythm\n", @@ -2960,12 +3081,13 @@ "⚑ ADAPTIVE RHYTHM:\n", " Current Interval: 15 min\n", " Trading Session: LONDON\n", - " ATR (H1): 14.77\n", + " ATR (H1): 14.83\n", " Volatility: MEDIUM\n", "\n", "πŸ›‘οΈ POSITION CONTROL:\n", - " Active Positions: 0/1\n", - " Trading Status: βœ… READY\n", + " Active Positions: 1/1\n", + " Trading Status: πŸ›‘ BLOCKED\n", + " Position 1: BUY | 🟒 0.58\n", "\n", "πŸ“Š CURRENT SIGNAL:\n", "πŸ” Analyzing XAUUSD with V1.6 ADAPTIVE COMPLETE parameters...\n", @@ -2978,19 +3100,19 @@ "+------+---------+------------+---------+----------+---------+\n", "| TF | Trend | Strength | ATR | Slope | Price |\n", "|------+---------+------------+---------+----------+---------|\n", - "| D1 | uptrend | 739.82 | 82.3776 | 9.14165 | 4635.96 |\n", - "| H4 | uptrend | 464.08 | 31.7911 | 2.21303 | 4635.96 |\n", - "| H1 | uptrend | 623.49 | 14.7869 | 1.38292 | 4635.96 |\n", - "| M30 | uptrend | 650.05 | 10.0902 | 0.983874 | 4635.96 |\n", - "| M15 | uptrend | 316.2 | 6.6465 | 0.315241 | 4635.96 |\n", - "| M5 | uptrend | 546.27 | 3.2868 | 0.269325 | 4635.96 |\n", + "| D1 | uptrend | 739.83 | 82.3776 | 9.14182 | 4636.69 |\n", + "| H4 | uptrend | 464.11 | 31.7911 | 2.21321 | 4636.69 |\n", + "| H1 | uptrend | 620.84 | 14.8519 | 1.38309 | 4636.69 |\n", + "| M30 | uptrend | 646.01 | 10.1552 | 0.984047 | 4636.69 |\n", + "| M15 | uptrend | 342.8 | 6.3281 | 0.325397 | 4636.69 |\n", + "| M5 | uptrend | 535.23 | 3.1955 | 0.256551 | 4636.69 |\n", "+------+---------+------------+---------+----------+---------+\n", "\n", - "➑️ Standard-Trend: uptrend (Strength: 629.52)\n", + "➑️ Standard-Trend: uptrend (Strength: 629.54)\n", "➑️ Fast-Trend: uptrend (Required: 2/4)\n", "➑️ Top-Down-Trend: uptrend\n", "➑️ Confidence: 100.0% (Threshold: 70%)\n", - "➑️ Risk-Adjusted Strength: 218127.9 (Min: 80)\n", + "➑️ Risk-Adjusted Strength: 218695.9 (Min: 80)\n", "➑️ Signal Quality: EXCELLENT\n", "\n", "πŸš€ V1.6 Adaptive Complete: Full Features + Adaptive Rhythm\n", @@ -2999,7 +3121,7 @@ " Threshold: 70%\n", " Quality: EXCELLENT\n", " Regime: RANGING\n", - " Would Trade: βœ… YES\n", + " Would Trade: ❌ NO\n", "\n", "πŸŽ‰ VERSION INFO:\n", " Version: V1.6 Adaptive Complete (CORRECTED)\n", @@ -3021,13 +3143,6 @@ "execution_count": 38, "metadata": {}, "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "2026-01-14 12:05:44,666 - INFO - πŸ“Š Adaptive Position Sizing:\n" - ] - }, { "name": "stdout", "output_type": "stream", @@ -3055,79 +3170,10 @@ " Reason: H4 + D1 beide trending (H4: 43.9, D1: 29.6)\n", "\n", "πŸ” POSITION CHECK fΓΌr XAUUSD (V1.6 Adaptive Complete)\n", - "βœ… Position-Check OK: 0/1\n", - "πŸ” Analyzing XAUUSD with V1.6 ADAPTIVE COMPLETE parameters...\n", + "πŸ›‘ TRADE BLOCKIERT: 1/1 Positionen aktiv\n", + " BUY @ 4636.11 | 🟒 0.58\n", "\n", - "πŸ“Š V1.6 ADAPTIVE COMPLETE Trend-Analyse fΓΌr XAUUSD\n", - "⚑ Adaptive Interval: 15 min | Session: LONDON\n", - "🎯 Market Regime: RANGING (Strength: 1%)\n", - "🎚️ Adaptive Threshold: 70% (RELAXED)\n", - "\n", - "+------+---------+------------+---------+----------+---------+\n", - "| TF | Trend | Strength | ATR | Slope | Price |\n", - "|------+---------+------------+---------+----------+---------|\n", - "| D1 | uptrend | 739.82 | 82.3776 | 9.14165 | 4635.96 |\n", - "| H4 | uptrend | 464.08 | 31.7911 | 2.21303 | 4635.96 |\n", - "| H1 | uptrend | 623.49 | 14.7869 | 1.38292 | 4635.96 |\n", - "| M30 | uptrend | 650.05 | 10.0902 | 0.983874 | 4635.96 |\n", - "| M15 | uptrend | 316.2 | 6.6465 | 0.315241 | 4635.96 |\n", - "| M5 | uptrend | 546.27 | 3.2868 | 0.269325 | 4635.96 |\n", - "+------+---------+------------+---------+----------+---------+\n", - "\n", - "➑️ Standard-Trend: uptrend (Strength: 629.52)\n", - "➑️ Fast-Trend: uptrend (Required: 2/4)\n", - "➑️ Top-Down-Trend: uptrend\n", - "➑️ Confidence: 100.0% (Threshold: 70%)\n", - "➑️ Risk-Adjusted Strength: 218127.9 (Min: 80)\n", - "➑️ Signal Quality: EXCELLENT\n", - "\n", - "πŸš€ V1.6 Adaptive Complete: Full Features + Adaptive Rhythm\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "2026-01-14 12:05:44,667 - INFO - Confidence: 100.0% (HIGH)\n", - "2026-01-14 12:05:44,668 - INFO - Base Risk: 2.0%\n", - "2026-01-14 12:05:44,669 - INFO - Multiplier: 1.5x\n", - "2026-01-14 12:05:44,670 - INFO - Adjusted Risk: 3.0%\n", - "2026-01-14 12:05:44,671 - INFO - πŸ’° Position Size: 0.01 lots\n", - "2026-01-14 12:05:44,671 - INFO - Risk Amount: $207.43\n", - "2026-01-14 12:05:44,672 - INFO - SL Distance: 44372.01 pips\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n", - "πŸš€ V1.6 ADAPTIVE COMPLETE TRADE EXECUTION\n", - "Direction: LONG\n", - "Price: 4635.96000 | Volume: 0.01\n", - "SL: 4631.52280 | TP: 4647.05300\n", - "Confidence: 100.0% | Quality: EXCELLENT\n", - "Regime: RANGING\n", - "Adaptive Interval: 15 min\n", - "Session: LONDON\n", - "βœ… Trade erfolgreich! Ticket: 668660737\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "2026-01-14 12:05:45,477 - INFO - πŸ“± Trade logged to DB + Telegram notification sent\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "πŸ“Š Positionen: 1\n", - "πŸ“Š Performance logged to trade_performance_v16_XAUUSD_202601.json\n", - "\n", - "βœ… Trade wΓΌrde ausgefΓΌhrt!\n" + "⏸️ Kein Trade - Bedingungen nicht erfΓΌllt\n" ] } ], @@ -3209,7 +3255,7 @@ "\n", "πŸ” POSITION CHECK fΓΌr XAUUSD (V1.6 Adaptive Complete)\n", "πŸ›‘ TRADE BLOCKIERT: 1/1 Positionen aktiv\n", - " BUY @ 4636.11 | πŸ”΄ -0.21\n" + " BUY @ 4636.11 | 🟒 0.58\n" ] } ], @@ -3751,203 +3797,129 @@ "text": [ "πŸ“Š ADX auf verschiedenen Timeframes:\n", "\n", - "M15 : ADX = 11.21 | Preis-Change (10 bars): +0.02%\n", - "H1 : ADX = 19.39 | Preis-Change (10 bars): +0.33%\n", - "H4 : ADX = 43.90 | Preis-Change (10 bars): +1.27%\n", - "D1 : ADX = 29.61 | Preis-Change (10 bars): +7.35%\n", + "M15 : ADX = 10.42 | Preis-Change (10 bars): -0.04%\n", + "H1 : ADX = 19.39 | Preis-Change (10 bars): +0.35%\n", + "H4 : ADX = 43.90 | Preis-Change (10 bars): +1.28%\n", + "D1 : ADX = 29.61 | Preis-Change (10 bars): +7.36%\n", "\n", - "πŸ’° Aktueller Preis: 4635.90\n" + "πŸ’° Aktueller Preis: 4636.59\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "βœ… Command handlers registered\n", + "πŸš€ Starting Telegram Bot...\n", + "πŸ“± Send /help to see available commands\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ - "2026-01-14 12:05:51,321 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", - "2026-01-14 12:06:00,357 - INFO - Running job \"create_protected_trading_check..protected_check (trigger: cron[minute='*'], next run at: 2026-01-14 12:06:00 CET)\" (scheduled at 2026-01-14 12:06:00+01:00)\n", - "2026-01-14 12:06:01,262 - INFO - ⏸️ Trading SKIP: London blocked: 12.5% win-rate, -$10/trade\n", - "2026-01-14 12:06:01,264 - INFO - Job \"create_protected_trading_check..protected_check (trigger: cron[minute='*'], next run at: 2026-01-14 12:07:00 CET)\" executed successfully\n", - "2026-01-14 12:06:01,363 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", - "2026-01-14 12:06:11,385 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", - "2026-01-14 12:06:21,409 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", - "2026-01-14 12:06:31,433 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", - "2026-01-14 12:06:41,557 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", - "2026-01-14 12:06:42,949 - INFO - Running job \"PositionMonitor.check_open_positions (trigger: interval[0:01:00], next run at: 2026-01-14 12:07:42 CET)\" (scheduled at 2026-01-14 12:06:42.434322+01:00)\n", - "2026-01-14 12:06:42,951 - INFO - Job \"PositionMonitor.check_open_positions (trigger: interval[0:01:00], next run at: 2026-01-14 12:07:42 CET)\" executed successfully\n", - "2026-01-14 12:06:43,503 - WARNING - Run time of job \" (trigger: interval[0:01:00], next run at: 2026-01-14 12:06:42 CET)\" was missed by 0:00:01.067774\n", - "2026-01-14 12:06:51,762 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", - "2026-01-14 12:07:00,003 - INFO - Running job \"create_protected_trading_check..protected_check (trigger: cron[minute='*'], next run at: 2026-01-14 12:08:00 CET)\" (scheduled at 2026-01-14 12:07:00+01:00)\n", - "2026-01-14 12:07:00,012 - INFO - ⏸️ Trading SKIP: London blocked: 12.5% win-rate, -$10/trade\n", - "2026-01-14 12:07:00,014 - INFO - Job \"create_protected_trading_check..protected_check (trigger: cron[minute='*'], next run at: 2026-01-14 12:08:00 CET)\" executed successfully\n", - "2026-01-14 12:07:01,783 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", - "2026-01-14 12:07:11,806 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", - "2026-01-14 12:07:21,829 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", - "2026-01-14 12:07:31,851 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", - "2026-01-14 12:07:41,875 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", - "2026-01-14 12:07:42,436 - INFO - Running job \"PositionMonitor.check_open_positions (trigger: interval[0:01:00], next run at: 2026-01-14 12:08:42 CET)\" (scheduled at 2026-01-14 12:07:42.434322+01:00)\n", - "2026-01-14 12:07:42,439 - INFO - Job \"PositionMonitor.check_open_positions (trigger: interval[0:01:00], next run at: 2026-01-14 12:08:42 CET)\" executed successfully\n", - "2026-01-14 12:07:42,439 - INFO - Running job \" (trigger: interval[0:01:00], next run at: 2026-01-14 12:08:42 CET)\" (scheduled at 2026-01-14 12:07:42.435323+01:00)\n", - "2026-01-14 12:07:42,441 - INFO - \n", + "2026-01-14 12:17:52,576 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/sendMessage \"HTTP/1.1 200 OK\"\n", + "2026-01-14 12:17:52,598 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getMe \"HTTP/1.1 200 OK\"\n", + "2026-01-14 12:17:52,600 - INFO - Application started\n", + "2026-01-14 12:17:52,627 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/deleteWebhook \"HTTP/1.1 200 OK\"\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "βœ… Bot is running\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "2026-01-14 12:18:00,002 - INFO - Running job \"create_protected_trading_check..protected_check (trigger: cron[minute='*'], next run at: 2026-01-14 12:18:00 CET)\" (scheduled at 2026-01-14 12:18:00+01:00)\n", + "2026-01-14 12:18:00,009 - INFO - ⏸️ Trading SKIP: London blocked: 12.5% win-rate, -$10/trade\n", + "2026-01-14 12:18:00,016 - INFO - Job \"create_protected_trading_check..protected_check (trigger: cron[minute='*'], next run at: 2026-01-14 12:19:00 CET)\" executed successfully\n", + "2026-01-14 12:18:02,693 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", + "2026-01-14 12:18:12,728 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", + "2026-01-14 12:18:22,756 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", + "2026-01-14 12:18:32,779 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", + "2026-01-14 12:18:42,802 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", + "2026-01-14 12:18:47,240 - INFO - Running job \"PositionMonitor.check_open_positions (trigger: interval[0:01:00], next run at: 2026-01-14 12:19:47 CET)\" (scheduled at 2026-01-14 12:18:47.237307+01:00)\n", + "2026-01-14 12:18:47,297 - INFO - Job \"PositionMonitor.check_open_positions (trigger: interval[0:01:00], next run at: 2026-01-14 12:19:47 CET)\" executed successfully\n", + "2026-01-14 12:18:47,440 - INFO - Running job \" (trigger: interval[0:01:00], next run at: 2026-01-14 12:19:47 CET)\" (scheduled at 2026-01-14 12:18:47.242309+01:00)\n", + "2026-01-14 12:18:47,455 - INFO - \n", "πŸ” Checking 1 position(s) for XAUUSD...\n", - "2026-01-14 12:07:42,447 - INFO - πŸ“Š Partial TP Levels:\n", - "2026-01-14 12:07:42,449 - INFO - Entry: 4636.11000\n", - "2026-01-14 12:07:42,450 - INFO - SL: 4631.52000\n", - "2026-01-14 12:07:42,450 - INFO - Risk: 4.59000\n", - "2026-01-14 12:07:42,451 - INFO - TP1 (1.5R): 4642.99500\n", - "2026-01-14 12:07:42,452 - INFO - TP2 (2.5R): 4647.58500\n", - "2026-01-14 12:07:42,452 - INFO - Job \" (trigger: interval[0:01:00], next run at: 2026-01-14 12:08:42 CET)\" executed successfully\n", - "2026-01-14 12:07:51,901 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", - "2026-01-14 12:08:00,052 - INFO - Running job \"create_protected_trading_check..protected_check (trigger: cron[minute='*'], next run at: 2026-01-14 12:09:00 CET)\" (scheduled at 2026-01-14 12:08:00+01:00)\n", - "2026-01-14 12:08:00,059 - INFO - ⏸️ Trading SKIP: London blocked: 12.5% win-rate, -$10/trade\n", - "2026-01-14 12:08:00,060 - INFO - Job \"create_protected_trading_check..protected_check (trigger: cron[minute='*'], next run at: 2026-01-14 12:09:00 CET)\" executed successfully\n", - "2026-01-14 12:08:01,924 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", - "2026-01-14 12:08:11,945 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", - "2026-01-14 12:08:21,968 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", - "2026-01-14 12:08:31,992 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", - "2026-01-14 12:08:42,021 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", - "2026-01-14 12:08:42,437 - INFO - Running job \"PositionMonitor.check_open_positions (trigger: interval[0:01:00], next run at: 2026-01-14 12:09:42 CET)\" (scheduled at 2026-01-14 12:08:42.434322+01:00)\n", - "2026-01-14 12:08:42,437 - INFO - Running job \" (trigger: interval[0:01:00], next run at: 2026-01-14 12:09:42 CET)\" (scheduled at 2026-01-14 12:08:42.435323+01:00)\n", - "2026-01-14 12:08:42,439 - INFO - Job \"PositionMonitor.check_open_positions (trigger: interval[0:01:00], next run at: 2026-01-14 12:09:42 CET)\" executed successfully\n", - "2026-01-14 12:08:42,440 - INFO - \n", + "2026-01-14 12:18:47,457 - INFO - πŸ“Š Partial TP Levels:\n", + "2026-01-14 12:18:47,461 - INFO - Entry: 4636.11000\n", + "2026-01-14 12:18:47,473 - INFO - SL: 4631.52000\n", + "2026-01-14 12:18:47,475 - INFO - Risk: 4.59000\n", + "2026-01-14 12:18:47,506 - INFO - TP1 (1.5R): 4642.99500\n", + "2026-01-14 12:18:47,509 - INFO - TP2 (2.5R): 4647.58500\n", + "2026-01-14 12:18:47,556 - INFO - Job \" (trigger: interval[0:01:00], next run at: 2026-01-14 12:19:47 CET)\" executed successfully\n", + "2026-01-14 12:18:52,825 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", + "2026-01-14 12:19:00,121 - INFO - Running job \"create_protected_trading_check..protected_check (trigger: cron[minute='*'], next run at: 2026-01-14 12:20:00 CET)\" (scheduled at 2026-01-14 12:19:00+01:00)\n", + "2026-01-14 12:19:00,127 - INFO - ⏸️ Trading SKIP: London blocked: 12.5% win-rate, -$10/trade\n", + "2026-01-14 12:19:00,173 - INFO - Job \"create_protected_trading_check..protected_check (trigger: cron[minute='*'], next run at: 2026-01-14 12:20:00 CET)\" executed successfully\n", + "2026-01-14 12:19:02,850 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", + "2026-01-14 12:19:12,870 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", + "2026-01-14 12:19:22,895 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", + "2026-01-14 12:19:32,920 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", + "2026-01-14 12:19:42,943 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", + "2026-01-14 12:19:47,239 - INFO - Running job \"PositionMonitor.check_open_positions (trigger: interval[0:01:00], next run at: 2026-01-14 12:20:47 CET)\" (scheduled at 2026-01-14 12:19:47.237307+01:00)\n", + "2026-01-14 12:19:47,250 - INFO - Job \"PositionMonitor.check_open_positions (trigger: interval[0:01:00], next run at: 2026-01-14 12:20:47 CET)\" executed successfully\n", + "2026-01-14 12:19:47,907 - INFO - Running job \" (trigger: interval[0:01:00], next run at: 2026-01-14 12:20:47 CET)\" (scheduled at 2026-01-14 12:19:47.242309+01:00)\n", + "2026-01-14 12:19:47,909 - INFO - \n", "πŸ” Checking 1 position(s) for XAUUSD...\n", - "2026-01-14 12:08:42,453 - INFO - πŸ“Š Partial TP Levels:\n", - "2026-01-14 12:08:42,454 - INFO - Entry: 4636.11000\n", - "2026-01-14 12:08:42,478 - INFO - SL: 4631.52000\n", - "2026-01-14 12:08:42,480 - INFO - Risk: 4.59000\n", - "2026-01-14 12:08:42,481 - INFO - TP1 (1.5R): 4642.99500\n", - "2026-01-14 12:08:42,483 - INFO - TP2 (2.5R): 4647.58500\n", - "2026-01-14 12:08:42,483 - INFO - Job \" (trigger: interval[0:01:00], next run at: 2026-01-14 12:09:42 CET)\" executed successfully\n", - "2026-01-14 12:08:52,044 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", - "2026-01-14 12:09:00,011 - INFO - Running job \"create_protected_trading_check..protected_check (trigger: cron[minute='*'], next run at: 2026-01-14 12:10:00 CET)\" (scheduled at 2026-01-14 12:09:00+01:00)\n", - "2026-01-14 12:09:00,093 - INFO - ⏸️ Trading SKIP: London blocked: 12.5% win-rate, -$10/trade\n", - "2026-01-14 12:09:00,094 - INFO - Job \"create_protected_trading_check..protected_check (trigger: cron[minute='*'], next run at: 2026-01-14 12:10:00 CET)\" executed successfully\n", - "2026-01-14 12:09:02,067 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", - "2026-01-14 12:09:12,089 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", - "2026-01-14 12:09:22,128 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", - "2026-01-14 12:09:32,154 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", - "2026-01-14 12:09:42,188 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", - "2026-01-14 12:09:42,667 - INFO - Running job \"PositionMonitor.check_open_positions (trigger: interval[0:01:00], next run at: 2026-01-14 12:10:42 CET)\" (scheduled at 2026-01-14 12:09:42.434322+01:00)\n", - "2026-01-14 12:09:42,669 - INFO - Job \"PositionMonitor.check_open_positions (trigger: interval[0:01:00], next run at: 2026-01-14 12:10:42 CET)\" executed successfully\n", - "2026-01-14 12:09:42,670 - INFO - Running job \" (trigger: interval[0:01:00], next run at: 2026-01-14 12:10:42 CET)\" (scheduled at 2026-01-14 12:09:42.435323+01:00)\n", - "2026-01-14 12:09:42,671 - INFO - \n", + "2026-01-14 12:19:47,910 - INFO - πŸ“Š Partial TP Levels:\n", + "2026-01-14 12:19:47,911 - INFO - Entry: 4636.11000\n", + "2026-01-14 12:19:47,911 - INFO - SL: 4631.52000\n", + "2026-01-14 12:19:47,912 - INFO - Risk: 4.59000\n", + "2026-01-14 12:19:47,913 - INFO - TP1 (1.5R): 4642.99500\n", + "2026-01-14 12:19:47,914 - INFO - TP2 (2.5R): 4647.58500\n", + "2026-01-14 12:19:47,915 - INFO - Job \" (trigger: interval[0:01:00], next run at: 2026-01-14 12:20:47 CET)\" executed successfully\n", + "2026-01-14 12:19:52,965 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", + "2026-01-14 12:20:00,385 - INFO - Running job \"create_protected_trading_check..protected_check (trigger: cron[minute='*'], next run at: 2026-01-14 12:21:00 CET)\" (scheduled at 2026-01-14 12:20:00+01:00)\n", + "2026-01-14 12:20:00,388 - INFO - ⏸️ Trading SKIP: London blocked: 12.5% win-rate, -$10/trade\n", + "2026-01-14 12:20:00,390 - INFO - Job \"create_protected_trading_check..protected_check (trigger: cron[minute='*'], next run at: 2026-01-14 12:21:00 CET)\" executed successfully\n", + "2026-01-14 12:20:02,988 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", + "2026-01-14 12:20:13,013 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", + "2026-01-14 12:20:23,036 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", + "2026-01-14 12:20:33,065 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", + "2026-01-14 12:20:43,090 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", + "2026-01-14 12:20:47,240 - INFO - Running job \"PositionMonitor.check_open_positions (trigger: interval[0:01:00], next run at: 2026-01-14 12:21:47 CET)\" (scheduled at 2026-01-14 12:20:47.237307+01:00)\n", + "2026-01-14 12:20:47,730 - INFO - Job \"PositionMonitor.check_open_positions (trigger: interval[0:01:00], next run at: 2026-01-14 12:21:47 CET)\" executed successfully\n", + "2026-01-14 12:20:47,845 - INFO - Running job \" (trigger: interval[0:01:00], next run at: 2026-01-14 12:21:47 CET)\" (scheduled at 2026-01-14 12:20:47.242309+01:00)\n", + "2026-01-14 12:20:47,847 - INFO - \n", "πŸ” Checking 1 position(s) for XAUUSD...\n", - "2026-01-14 12:09:42,672 - INFO - πŸ“Š Partial TP Levels:\n", - "2026-01-14 12:09:42,673 - INFO - Entry: 4636.11000\n", - "2026-01-14 12:09:42,674 - INFO - SL: 4631.52000\n", - "2026-01-14 12:09:42,675 - INFO - Risk: 4.59000\n", - "2026-01-14 12:09:42,675 - INFO - TP1 (1.5R): 4642.99500\n", - "2026-01-14 12:09:42,676 - INFO - TP2 (2.5R): 4647.58500\n", - "2026-01-14 12:09:42,677 - INFO - Job \" (trigger: interval[0:01:00], next run at: 2026-01-14 12:10:42 CET)\" executed successfully\n", - "2026-01-14 12:09:52,212 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", - "2026-01-14 12:10:00,054 - INFO - Running job \"create_protected_trading_check..protected_check (trigger: cron[minute='*'], next run at: 2026-01-14 12:11:00 CET)\" (scheduled at 2026-01-14 12:10:00+01:00)\n", - "2026-01-14 12:10:00,061 - INFO - ⏸️ Trading SKIP: London blocked: 12.5% win-rate, -$10/trade\n", - "2026-01-14 12:10:00,062 - INFO - Job \"create_protected_trading_check..protected_check (trigger: cron[minute='*'], next run at: 2026-01-14 12:11:00 CET)\" executed successfully\n", - "2026-01-14 12:10:02,245 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", - "2026-01-14 12:10:12,268 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", - "2026-01-14 12:10:22,295 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", - "2026-01-14 12:10:32,329 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", - "2026-01-14 12:10:42,338 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", - "2026-01-14 12:10:42,471 - INFO - Running job \"PositionMonitor.check_open_positions (trigger: interval[0:01:00], next run at: 2026-01-14 12:11:42 CET)\" (scheduled at 2026-01-14 12:10:42.434322+01:00)\n", - "2026-01-14 12:10:42,473 - INFO - Job \"PositionMonitor.check_open_positions (trigger: interval[0:01:00], next run at: 2026-01-14 12:11:42 CET)\" executed successfully\n", - "2026-01-14 12:10:42,475 - INFO - Running job \" (trigger: interval[0:01:00], next run at: 2026-01-14 12:11:42 CET)\" (scheduled at 2026-01-14 12:10:42.435323+01:00)\n", - "2026-01-14 12:10:42,477 - INFO - \n", - "πŸ” Checking 1 position(s) for XAUUSD...\n", - "2026-01-14 12:10:42,491 - INFO - πŸ“Š Partial TP Levels:\n", - "2026-01-14 12:10:42,492 - INFO - Entry: 4636.11000\n", - "2026-01-14 12:10:42,522 - INFO - SL: 4631.52000\n", - "2026-01-14 12:10:42,523 - INFO - Risk: 4.59000\n", - "2026-01-14 12:10:42,527 - INFO - TP1 (1.5R): 4642.99500\n", - "2026-01-14 12:10:42,567 - INFO - TP2 (2.5R): 4647.58500\n", - "2026-01-14 12:10:42,639 - INFO - Job \" (trigger: interval[0:01:00], next run at: 2026-01-14 12:11:42 CET)\" executed successfully\n", - "2026-01-14 12:10:52,378 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", - "2026-01-14 12:11:00,595 - INFO - Running job \"create_protected_trading_check..protected_check (trigger: cron[minute='*'], next run at: 2026-01-14 12:12:00 CET)\" (scheduled at 2026-01-14 12:11:00+01:00)\n", - "2026-01-14 12:11:00,602 - INFO - ⏸️ Trading SKIP: London blocked: 12.5% win-rate, -$10/trade\n", - "2026-01-14 12:11:00,604 - INFO - Job \"create_protected_trading_check..protected_check (trigger: cron[minute='*'], next run at: 2026-01-14 12:12:00 CET)\" executed successfully\n", - "2026-01-14 12:11:02,400 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", - "2026-01-14 12:11:12,419 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", - "2026-01-14 12:11:22,447 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", - "2026-01-14 12:11:32,469 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", - "2026-01-14 12:11:42,442 - INFO - Running job \"PositionMonitor.check_open_positions (trigger: interval[0:01:00], next run at: 2026-01-14 12:12:42 CET)\" (scheduled at 2026-01-14 12:11:42.434322+01:00)\n", - "2026-01-14 12:11:42,442 - INFO - Job \"PositionMonitor.check_open_positions (trigger: interval[0:01:00], next run at: 2026-01-14 12:12:42 CET)\" executed successfully\n", - "2026-01-14 12:11:42,442 - INFO - Running job \" (trigger: interval[0:01:00], next run at: 2026-01-14 12:12:42 CET)\" (scheduled at 2026-01-14 12:11:42.435323+01:00)\n", - "2026-01-14 12:11:42,442 - INFO - \n", - "πŸ” Checking 1 position(s) for XAUUSD...\n", - "2026-01-14 12:11:42,442 - INFO - πŸ“Š Partial TP Levels:\n", - "2026-01-14 12:11:42,442 - INFO - Entry: 4636.11000\n", - "2026-01-14 12:11:42,442 - INFO - SL: 4631.52000\n", - "2026-01-14 12:11:42,442 - INFO - Risk: 4.59000\n", - "2026-01-14 12:11:42,442 - INFO - TP1 (1.5R): 4642.99500\n", - "2026-01-14 12:11:42,442 - INFO - TP2 (2.5R): 4647.58500\n", - "2026-01-14 12:11:42,442 - INFO - Job \" (trigger: interval[0:01:00], next run at: 2026-01-14 12:12:42 CET)\" executed successfully\n", - "2026-01-14 12:11:42,520 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", - "2026-01-14 12:11:52,567 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", - "2026-01-14 12:12:00,213 - INFO - Running job \"create_protected_trading_check..protected_check (trigger: cron[minute='*'], next run at: 2026-01-14 12:13:00 CET)\" (scheduled at 2026-01-14 12:12:00+01:00)\n", - "2026-01-14 12:12:00,235 - INFO - ⏸️ Trading SKIP: London blocked: 12.5% win-rate, -$10/trade\n", - "2026-01-14 12:12:00,237 - INFO - Job \"create_protected_trading_check..protected_check (trigger: cron[minute='*'], next run at: 2026-01-14 12:13:00 CET)\" executed successfully\n", - "2026-01-14 12:12:02,587 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", - "2026-01-14 12:12:12,618 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", - "2026-01-14 12:12:22,626 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", - "2026-01-14 12:12:32,654 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", - "2026-01-14 12:12:42,685 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", - "2026-01-14 12:12:43,002 - INFO - Running job \"PositionMonitor.check_open_positions (trigger: interval[0:01:00], next run at: 2026-01-14 12:13:42 CET)\" (scheduled at 2026-01-14 12:12:42.434322+01:00)\n", - "2026-01-14 12:12:43,005 - INFO - Job \"PositionMonitor.check_open_positions (trigger: interval[0:01:00], next run at: 2026-01-14 12:13:42 CET)\" executed successfully\n", - "2026-01-14 12:12:43,004 - INFO - Running job \" (trigger: interval[0:01:00], next run at: 2026-01-14 12:13:42 CET)\" (scheduled at 2026-01-14 12:12:42.435323+01:00)\n", - "2026-01-14 12:12:43,006 - INFO - \n", - "πŸ” Checking 1 position(s) for XAUUSD...\n", - "2026-01-14 12:12:43,006 - INFO - πŸ“Š Partial TP Levels:\n", - "2026-01-14 12:12:43,006 - INFO - Entry: 4636.11000\n", - "2026-01-14 12:12:43,006 - INFO - SL: 4631.52000\n", - "2026-01-14 12:12:43,006 - INFO - Risk: 4.59000\n", - "2026-01-14 12:12:43,006 - INFO - TP1 (1.5R): 4642.99500\n", - "2026-01-14 12:12:43,006 - INFO - TP2 (2.5R): 4647.58500\n", - "2026-01-14 12:12:43,006 - INFO - Job \" (trigger: interval[0:01:00], next run at: 2026-01-14 12:13:42 CET)\" executed successfully\n", - "2026-01-14 12:12:52,712 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", - "2026-01-14 12:13:00,041 - INFO - Running job \"create_protected_trading_check..protected_check (trigger: cron[minute='*'], next run at: 2026-01-14 12:14:00 CET)\" (scheduled at 2026-01-14 12:13:00+01:00)\n", - "2026-01-14 12:13:00,041 - INFO - ⏸️ Trading SKIP: London blocked: 12.5% win-rate, -$10/trade\n", - "2026-01-14 12:13:00,041 - INFO - Job \"create_protected_trading_check..protected_check (trigger: cron[minute='*'], next run at: 2026-01-14 12:14:00 CET)\" executed successfully\n", - "2026-01-14 12:13:02,729 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", - "2026-01-14 12:13:12,760 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", - "2026-01-14 12:13:22,785 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", - "2026-01-14 12:13:32,807 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", - "2026-01-14 12:13:42,448 - INFO - Running job \"PositionMonitor.check_open_positions (trigger: interval[0:01:00], next run at: 2026-01-14 12:14:42 CET)\" (scheduled at 2026-01-14 12:13:42.434322+01:00)\n", - "2026-01-14 12:13:42,450 - INFO - Job \"PositionMonitor.check_open_positions (trigger: interval[0:01:00], next run at: 2026-01-14 12:14:42 CET)\" executed successfully\n", - "2026-01-14 12:13:42,451 - INFO - Running job \" (trigger: interval[0:01:00], next run at: 2026-01-14 12:14:42 CET)\" (scheduled at 2026-01-14 12:13:42.435323+01:00)\n", - "2026-01-14 12:13:42,461 - INFO - \n", - "πŸ” Checking 1 position(s) for XAUUSD...\n", - "2026-01-14 12:13:42,463 - INFO - πŸ“Š Partial TP Levels:\n", - "2026-01-14 12:13:42,464 - INFO - Entry: 4636.11000\n", - "2026-01-14 12:13:42,465 - INFO - SL: 4631.52000\n", - "2026-01-14 12:13:42,468 - INFO - Risk: 4.59000\n", - "2026-01-14 12:13:42,470 - INFO - TP1 (1.5R): 4642.99500\n", - "2026-01-14 12:13:42,471 - INFO - TP2 (2.5R): 4647.58500\n", - "2026-01-14 12:13:42,472 - INFO - Job \" (trigger: interval[0:01:00], next run at: 2026-01-14 12:14:42 CET)\" executed successfully\n", - "2026-01-14 12:13:42,830 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", - "2026-01-14 12:13:52,853 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", - "2026-01-14 12:14:00,334 - INFO - Running job \"create_protected_trading_check..protected_check (trigger: cron[minute='*'], next run at: 2026-01-14 12:15:00 CET)\" (scheduled at 2026-01-14 12:14:00+01:00)\n", - "2026-01-14 12:14:00,340 - INFO - ⏸️ Trading SKIP: London blocked: 12.5% win-rate, -$10/trade\n", - "2026-01-14 12:14:00,341 - INFO - Job \"create_protected_trading_check..protected_check (trigger: cron[minute='*'], next run at: 2026-01-14 12:15:00 CET)\" executed successfully\n", - "2026-01-14 12:14:02,897 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", - "2026-01-14 12:14:12,921 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", - "2026-01-14 12:14:22,943 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", - "2026-01-14 12:14:32,965 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", - "2026-01-14 12:14:42,906 - INFO - Running job \"PositionMonitor.check_open_positions (trigger: interval[0:01:00], next run at: 2026-01-14 12:15:42 CET)\" (scheduled at 2026-01-14 12:14:42.434322+01:00)\n", - "2026-01-14 12:14:42,913 - INFO - Job \"PositionMonitor.check_open_positions (trigger: interval[0:01:00], next run at: 2026-01-14 12:15:42 CET)\" executed successfully\n", - "2026-01-14 12:14:42,907 - INFO - Running job \" (trigger: interval[0:01:00], next run at: 2026-01-14 12:15:42 CET)\" (scheduled at 2026-01-14 12:14:42.435323+01:00)\n", - "2026-01-14 12:14:42,978 - INFO - \n", - "πŸ” Checking 1 position(s) for XAUUSD...\n", - "2026-01-14 12:14:42,979 - INFO - πŸ“Š Partial TP Levels:\n", - "2026-01-14 12:14:42,981 - INFO - Entry: 4636.11000\n", - "2026-01-14 12:14:42,981 - INFO - SL: 4631.52000\n", - "2026-01-14 12:14:42,982 - INFO - Risk: 4.59000\n", - "2026-01-14 12:14:42,983 - INFO - TP1 (1.5R): 4642.99500\n", - "2026-01-14 12:14:42,984 - INFO - TP2 (2.5R): 4647.58500\n", - "2026-01-14 12:14:42,985 - INFO - Job \" (trigger: interval[0:01:00], next run at: 2026-01-14 12:15:42 CET)\" executed successfully\n", - "2026-01-14 12:14:42,989 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", - "2026-01-14 12:14:53,016 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", - "2026-01-14 12:15:00,005 - INFO - Running job \"create_protected_trading_check..protected_check (trigger: cron[minute='*'], next run at: 2026-01-14 12:16:00 CET)\" (scheduled at 2026-01-14 12:15:00+01:00)\n", - "2026-01-14 12:15:00,051 - INFO - ⏸️ Trading SKIP: London blocked: 12.5% win-rate, -$10/trade\n", - "2026-01-14 12:15:00,053 - INFO - Job \"create_protected_trading_check..protected_check (trigger: cron[minute='*'], next run at: 2026-01-14 12:16:00 CET)\" executed successfully\n", - "2026-01-14 12:15:03,040 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n" + "2026-01-14 12:20:47,848 - INFO - πŸ“Š Partial TP Levels:\n", + "2026-01-14 12:20:47,849 - INFO - Entry: 4636.11000\n", + "2026-01-14 12:20:47,851 - INFO - SL: 4631.52000\n", + "2026-01-14 12:20:47,852 - INFO - Risk: 4.59000\n", + "2026-01-14 12:20:47,853 - INFO - TP1 (1.5R): 4642.99500\n", + "2026-01-14 12:20:47,854 - INFO - TP2 (2.5R): 4647.58500\n", + "2026-01-14 12:20:47,856 - INFO - Job \" (trigger: interval[0:01:00], next run at: 2026-01-14 12:21:47 CET)\" executed successfully\n", + "2026-01-14 12:20:53,115 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", + "2026-01-14 12:21:00,001 - INFO - Running job \"create_protected_trading_check..protected_check (trigger: cron[minute='*'], next run at: 2026-01-14 12:22:00 CET)\" (scheduled at 2026-01-14 12:21:00+01:00)\n", + "2026-01-14 12:21:00,006 - INFO - ⏸️ Trading SKIP: London blocked: 12.5% win-rate, -$10/trade\n", + "2026-01-14 12:21:00,008 - INFO - Job \"create_protected_trading_check..protected_check (trigger: cron[minute='*'], next run at: 2026-01-14 12:22:00 CET)\" executed successfully\n", + "2026-01-14 12:21:03,152 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", + "2026-01-14 12:21:13,177 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", + "2026-01-14 12:21:23,199 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", + "2026-01-14 12:21:33,228 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", + "2026-01-14 12:21:43,255 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", + "2026-01-14 12:21:47,560 - INFO - Running job \"PositionMonitor.check_open_positions (trigger: interval[0:01:00], next run at: 2026-01-14 12:22:47 CET)\" (scheduled at 2026-01-14 12:21:47.237307+01:00)\n", + "2026-01-14 12:21:47,665 - INFO - Job \"PositionMonitor.check_open_positions (trigger: interval[0:01:00], next run at: 2026-01-14 12:22:47 CET)\" executed successfully\n", + "2026-01-14 12:21:49,288 - WARNING - Run time of job \" (trigger: interval[0:01:00], next run at: 2026-01-14 12:21:47 CET)\" was missed by 0:00:02.046442\n", + "2026-01-14 12:21:53,279 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", + "2026-01-14 12:22:00,002 - INFO - Running job \"create_protected_trading_check..protected_check (trigger: cron[minute='*'], next run at: 2026-01-14 12:23:00 CET)\" (scheduled at 2026-01-14 12:22:00+01:00)\n", + "2026-01-14 12:22:00,019 - INFO - ⏸️ Trading SKIP: London blocked: 12.5% win-rate, -$10/trade\n", + "2026-01-14 12:22:00,022 - INFO - Job \"create_protected_trading_check..protected_check (trigger: cron[minute='*'], next run at: 2026-01-14 12:23:00 CET)\" executed successfully\n", + "2026-01-14 12:22:03,448 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", + "2026-01-14 12:22:13,474 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", + "2026-01-14 12:22:23,531 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", + "2026-01-14 12:22:33,561 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", + "2026-01-14 12:22:43,585 - INFO - HTTP Request: POST https://api.telegram.org/bot7783303065:AAHVVvwWGqmhJ2BVq8LqkLRSsicKy1CUsD8/getUpdates \"HTTP/1.1 200 OK\"\n", + "2026-01-14 12:22:48,377 - WARNING - Run time of job \"PositionMonitor.check_open_positions (trigger: interval[0:01:00], next run at: 2026-01-14 12:23:47 CET)\" was missed by 0:00:01.140674\n", + "2026-01-14 12:22:48,379 - WARNING - Run time of job \" (trigger: interval[0:01:00], next run at: 2026-01-14 12:23:47 CET)\" was missed by 0:00:01.137668\n" ] } ], diff --git a/centralize_config.py b/centralize_config.py new file mode 100644 index 0000000..0cf13df --- /dev/null +++ b/centralize_config.py @@ -0,0 +1,175 @@ +#!/usr/bin/env python3 +""" +Centralize Trading Bot Configuration +Creates a centralized configuration cell and updates all references +""" + +import json + +notebook_path = "TradingBot_V1.6_Adaptive_Complete_CORRECTED.ipynb" + +print("=" * 70) +print("πŸ”§ CENTRALIZING TRADING BOT CONFIGURATION") +print("=" * 70) +print() + +# Load notebook +with open(notebook_path, 'r', encoding='utf-8') as f: + notebook = json.load(f) + +print(f"Loaded notebook with {len(notebook['cells'])} cells") +print() + +# Create centralized config cell +config_cell_markdown = { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## πŸ“‹ CENTRALIZED TRADING CONFIGURATION\n", + "\n", + "**All trading parameters in one place for easy management**" + ] +} + +config_cell_code = { + "cell_type": "code", + "execution_count": None, + "metadata": {}, + "outputs": [], + "source": [ + "# ============================================================================\n", + "# CENTRALIZED TRADING CONFIGURATION\n", + "# ============================================================================\n", + "# All trading parameters should be configured here and referenced throughout\n", + "# the notebook to avoid scattered settings\n", + "\n", + "TRADING_CONFIG = {\n", + " # ========================================================================\n", + " # LOT SIZING & POSITION MANAGEMENT\n", + " # ========================================================================\n", + " 'lot_sizing': {\n", + " 'min_lot': 0.10, # Minimum lot size\n", + " 'max_lot': 0.20, # Maximum lot size\n", + " 'default_lot': 0.10, # Fallback lot size\n", + " 'use_adaptive': True, # Use adaptive position sizing\n", + " },\n", + " \n", + " # ========================================================================\n", + " # RISK MANAGEMENT\n", + " # ========================================================================\n", + " 'risk': {\n", + " 'max_risk_per_trade': 0.02, # 2% max risk per trade\n", + " 'max_positions': 1, # Maximum concurrent positions\n", + " 'max_daily_loss': 0.05, # 5% max daily loss\n", + " },\n", + " \n", + " # ========================================================================\n", + " # CONFIDENCE THRESHOLDS\n", + " # ========================================================================\n", + " 'confidence': {\n", + " 'base_threshold': 70, # Base confidence threshold (all sessions)\n", + " 'ny_threshold': 70, # NY session threshold (was 97, reduced for more trades)\n", + " 'asian_threshold': 70, # Asian session threshold\n", + " 'london_threshold': 70, # London session threshold\n", + " },\n", + " \n", + " # ========================================================================\n", + " # ATR & STOP LOSS\n", + " # ========================================================================\n", + " 'atr': {\n", + " 'base_multiplier': 1.5, # Base ATR multiplier for SL/TP\n", + " 'period': 14, # ATR calculation period\n", + " },\n", + " \n", + " # ========================================================================\n", + " # NEWS FILTER\n", + " # ========================================================================\n", + " 'news_filter': {\n", + " 'enabled': True, # Enable/disable news filter\n", + " 'minutes_before': 30, # Minutes before event to block\n", + " 'minutes_after': 30, # Minutes after event to block\n", + " },\n", + " \n", + " # ========================================================================\n", + " # SESSION SETTINGS\n", + " # ========================================================================\n", + " 'sessions': {\n", + " 'asian_enabled': True,\n", + " 'london_enabled': False, # Currently disabled\n", + " 'ny_enabled': True,\n", + " 'overlap_enabled': False, # Currently disabled\n", + " },\n", + " \n", + " # ========================================================================\n", + " # TRADING SYMBOLS\n", + " # ========================================================================\n", + " 'symbols': {\n", + " 'primary': 'XAUUSD', # Primary trading symbol (Gold)\n", + " 'alternative': [], # Alternative symbols (if needed)\n", + " },\n", + "}\n", + "\n", + "# ============================================================================\n", + "# HELPER FUNCTIONS\n", + "# ============================================================================\n", + "\n", + "def get_config(section, key=None):\n", + " \"\"\"Get configuration value\"\"\"\n", + " if key is None:\n", + " return TRADING_CONFIG.get(section, {})\n", + " return TRADING_CONFIG.get(section, {}).get(key)\n", + "\n", + "def update_config(section, key, value):\n", + " \"\"\"Update configuration value (runtime only, doesn't save to notebook)\"\"\"\n", + " if section not in TRADING_CONFIG:\n", + " TRADING_CONFIG[section] = {}\n", + " TRADING_CONFIG[section][key] = value\n", + " print(f\"βœ… Updated: {section}.{key} = {value}\")\n", + "\n", + "# Print current configuration\n", + "print(\"βœ… TRADING CONFIGURATION LOADED\")\n", + "print()\n", + "print(f\"πŸ“Š Lot Sizing: {TRADING_CONFIG['lot_sizing']['min_lot']} - {TRADING_CONFIG['lot_sizing']['max_lot']} lots\")\n", + "print(f\"⚠️ Max Risk: {TRADING_CONFIG['risk']['max_risk_per_trade']*100}% per trade\")\n", + "print(f\"🎯 Confidence Threshold: {TRADING_CONFIG['confidence']['base_threshold']}%\")\n", + "print(f\"πŸ›‘οΈ News Filter: {'ENABLED' if TRADING_CONFIG['news_filter']['enabled'] else 'DISABLED'}\")\n", + "print(f\"🌍 Primary Symbol: {TRADING_CONFIG['symbols']['primary']}\")" + ] +} + +# Find a good insertion point (after imports, before main logic) +# Let's insert after the first few setup cells (position 5) +insert_position = 5 + +print(f"Inserting centralized config at position {insert_position}") +print() + +# Insert the markdown and code cells +notebook['cells'].insert(insert_position, config_cell_markdown) +notebook['cells'].insert(insert_position + 1, config_cell_code) + +print(f"βœ… Added 2 new cells (markdown + config)") +print(f" Total cells now: {len(notebook['cells'])}") +print() + +# Save the modified notebook +with open(notebook_path, 'w', encoding='utf-8') as f: + json.dump(notebook, f, indent=1, ensure_ascii=False) + +print("βœ… Notebook updated successfully!") +print() +print("=" * 70) +print("πŸ“‹ NEXT STEPS:") +print("=" * 70) +print() +print("1. Open Jupyter Notebook") +print("2. Locate the new cells (should be around cell 5-6)") +print("3. Run the configuration cell to load TRADING_CONFIG") +print("4. Update Cells 23, 25, 47 to reference TRADING_CONFIG") +print(" instead of hardcoded values") +print() +print("Example usage in code:") +print(" volume = TRADING_CONFIG['lot_sizing']['default_lot']") +print(" max_risk = TRADING_CONFIG['risk']['max_risk_per_trade']") +print() +print("=" * 70) diff --git a/update_cells_to_use_config.py b/update_cells_to_use_config.py new file mode 100644 index 0000000..3cad490 --- /dev/null +++ b/update_cells_to_use_config.py @@ -0,0 +1,203 @@ +#!/usr/bin/env python3 +""" +Update Trading Cells to Use Centralized Config +Updates Cells 25, 27, and 49 (formerly 23, 25, 47) to reference TRADING_CONFIG +""" + +import json +import re + +notebook_path = "TradingBot_V1.6_Adaptive_Complete_CORRECTED.ipynb" + +print("=" * 70) +print("πŸ”„ UPDATING CELLS TO USE TRADING_CONFIG") +print("=" * 70) +print() + +# Load notebook +with open(notebook_path, 'r', encoding='utf-8') as f: + notebook = json.load(f) + +print(f"Loaded notebook with {len(notebook['cells'])} cells") +print() + +changes_made = 0 + +# ============================================================================ +# CELL 25: calculate_position_size function +# ============================================================================ +print("πŸ“ Updating Cell 25: calculate_position_size()") +print("-" * 70) + +cell_25 = notebook['cells'][25] +if cell_25['cell_type'] == 'code': + source = ''.join(cell_25['source']) + original = source + + # Update hardcoded 0.10 returns to use config + source = source.replace( + 'return 0.10', + 'return TRADING_CONFIG["lot_sizing"]["default_lot"]' + ) + + # Update function signature default parameter + source = source.replace( + 'def calculate_position_size(self, symbol, stop_loss_pips, max_risk_per_trade=0.02):', + 'def calculate_position_size(self, symbol, stop_loss_pips, max_risk_per_trade=None):' + ) + + # Add parameter default from config + if 'max_risk_per_trade=None):' in source: + # Add check at beginning of function + source = source.replace( + ' """\n Berechnet die Positionsgrâße basierend auf Risiko\n """\n', + ' """\n Berechnet die Positionsgrâße basierend auf Risiko\n """\n if max_risk_per_trade is None:\n max_risk_per_trade = TRADING_CONFIG["risk"]["max_risk_per_trade"]\n \n' + ) + + if source != original: + cell_25['source'] = source.split('\n') + changes_made += 1 + print("βœ… Updated calculate_position_size to use TRADING_CONFIG") + print(f" - return 0.10 β†’ TRADING_CONFIG['lot_sizing']['default_lot']") + print(f" - max_risk_per_trade default from config") + +# ============================================================================ +# CELL 27: execute_trade_v2_adaptive function +# ============================================================================ +print() +print("πŸ“ Updating Cell 27: execute_trade_v2_adaptive()") +print("-" * 70) + +cell_27 = notebook['cells'][27] +if cell_27['cell_type'] == 'code': + source = ''.join(cell_27['source']) + original = source + + # Update function signature defaults + source = source.replace( + 'def execute_trade_v2_adaptive(\n symbol="XAUUSD",\n atr_mult=1.5,\n base_confidence=60,\n max_risk_per_trade=0.01,', + 'def execute_trade_v2_adaptive(\n symbol=None,\n atr_mult=None,\n base_confidence=None,\n max_risk_per_trade=None,' + ) + + # Add config loading at start of function + function_start = ' """\n V1.6 Adaptive Complete Trade-AusfΓΌhrung:\n - Position Control\n - Relaxed Parameter\n - Adaptive Rhythm Integration\n """\n ' + + config_init = ''' """\n V1.6 Adaptive Complete Trade-AusfΓΌhrung:\n - Position Control\n - Relaxed Parameter\n - Adaptive Rhythm Integration\n """\n \n # ========================================================================\n # LOAD DEFAULTS FROM TRADING_CONFIG\n # ========================================================================\n if symbol is None:\n symbol = TRADING_CONFIG["symbols"]["primary"]\n if atr_mult is None:\n atr_mult = TRADING_CONFIG["atr"]["base_multiplier"]\n if base_confidence is None:\n base_confidence = TRADING_CONFIG["confidence"]["base_threshold"]\n if max_risk_per_trade is None:\n max_risk_per_trade = TRADING_CONFIG["risk"]["max_risk_per_trade"]\n if max_positions is None:\n max_positions = TRADING_CONFIG["risk"]["max_positions"]\n \n ''' + + source = source.replace(function_start, config_init) + + # Update max_positions default + source = source.replace( + ' max_positions=1,', + ' max_positions=None,' + ) + + # Update volume calculations to use config + # Line with min(0.2, max(0.10, ... + source = source.replace( + 'volume = round(min(0.2, max(0.10, risk_amount / (adjusted_atr_mult * atr * 100))),2)', + 'volume = round(min(TRADING_CONFIG["lot_sizing"]["max_lot"], max(TRADING_CONFIG["lot_sizing"]["min_lot"], risk_amount / (adjusted_atr_mult * atr * 100))),2)' + ) + + # Hardcoded volume = 0.10 fallbacks + source = source.replace( + ' volume = 0.10', + ' volume = TRADING_CONFIG["lot_sizing"]["default_lot"]' + ) + + source = source.replace( + ' volume = 0.10', + ' volume = TRADING_CONFIG["lot_sizing"]["default_lot"]' + ) + + source = source.replace( + ' else:\n volume = 0.10', + ' else:\n volume = TRADING_CONFIG["lot_sizing"]["default_lot"]' + ) + + if source != original: + cell_27['source'] = source.split('\n') + changes_made += 1 + print("βœ… Updated execute_trade_v2_adaptive to use TRADING_CONFIG") + print(f" - Function parameters now load from config") + print(f" - Volume calculations use config min/max/default") + print(f" - All hardcoded values replaced") + +# ============================================================================ +# CELL 49: ADAPTIVE_COMPLETE_CONFIG (now cell 49 after insertion) +# ============================================================================ +print() +print("πŸ“ Updating Cell 49: ADAPTIVE_COMPLETE_CONFIG") +print("-" * 70) + +# Find the config cell (search for ADAPTIVE_COMPLETE_CONFIG) +config_cell_idx = None +for i, cell in enumerate(notebook['cells']): + if cell['cell_type'] == 'code': + source = ''.join(cell.get('source', [])) + if 'ADAPTIVE_COMPLETE_CONFIG' in source and "'max_risk_per_trade':" in source: + config_cell_idx = i + break + +if config_cell_idx is not None: + print(f"Found ADAPTIVE_COMPLETE_CONFIG at cell {config_cell_idx}") + cell = notebook['cells'][config_cell_idx] + source = ''.join(cell['source']) + original = source + + # Add comment and reference to centralized config + header_comment = '''# ============================================================================ +# NOTE: This config is DEPRECATED - use TRADING_CONFIG in Cell 6 instead +# This is kept for backward compatibility only +# ============================================================================ + +''' + + # Update max_risk_per_trade to reference centralized config + source = source.replace( + "'max_risk_per_trade': 0.02, # 2% risk", + "'max_risk_per_trade': TRADING_CONFIG['risk']['max_risk_per_trade'], # From centralized config" + ) + + if not source.startswith('# ====='): + source = header_comment + source + + if source != original: + cell['source'] = source.split('\n') + changes_made += 1 + print(f"βœ… Updated ADAPTIVE_COMPLETE_CONFIG") + print(f" - Added deprecation notice") + print(f" - Linked max_risk_per_trade to TRADING_CONFIG") + +print() +print("=" * 70) +print(f"βœ… CHANGES COMPLETE: {changes_made} cells updated") +print("=" * 70) +print() + +if changes_made > 0: + # Save notebook + with open(notebook_path, 'w', encoding='utf-8') as f: + json.dump(notebook, f, indent=1, ensure_ascii=False) + + print("βœ… Notebook saved successfully!") + print() + print("πŸ“‹ NEXT STEPS:") + print("=" * 70) + print() + print("1. Open Jupyter Notebook") + print("2. Restart Kernel (Kernel β†’ Restart)") + print("3. Run cells in order:") + print(" a) Run Cell 6 (TRADING_CONFIG)") + print(" b) Run all other cells") + print("4. Verify bot uses 0.10 lot size") + print() + print("🎯 ALL SETTINGS NOW CENTRALIZED IN CELL 6!") + print() + print("To change lot size in future:") + print(" β†’ Just edit TRADING_CONFIG['lot_sizing'] in Cell 6") + print(" β†’ Restart kernel and re-run cells") + print() + print("=" * 70) +else: + print("⚠️ No changes were made")