📦 TLL Data CacheFetch regime + skills + weights once per tick via getTllRegimeForMockTrading(), getActiveTllSkills(), getTllStrategyWeights()
⬇
🔵 Phase 1: Close & Monitor
👁️ monitorAndCloseAggressive()Check SL/TP for all open aggressive trades, close if hit
⬇
📊 analyzeClosedTrade()MFE/MAE analysis on closed trades — only if ENABLE_POST_TRADE_LEARNING=true
⬇
💾 recordTradeOutcome()Save to scorecard + brain_signal_memory — only if ENABLE_STRATEGY_SCORECARD=true
⬇
🟢 Phase 2: Evaluate New Signals
📡 Fetch SignalsFrom signals table (status='active', last 30 min, confidence ≥ 0.40 if quality gate enabled, else ≥ 0.55, limit 30)
⬇
👤 getOrCreateAggressiveAccount()Ensure aggressive mock account exists
⬇
🔢 Track Open CountCount open mock_trades (status='open'), break if ≥ MOCK_MAX_OPEN_TRADES (default 50)
⬇
🔄 Dedup by SymbolSkip if already has open trade for this symbol
⬇
⭐ evaluateSignalQuality()Score ≥ threshold, valid structure — only if ENABLE_SIGNAL_QUALITY_GATE=true. Overrides confidence with quality-adjusted value
✅ Quality OK → continue
❌ Low quality → skip
⬇
🌊 detectMarketRegime()Internal regime detection — only if ENABLE_MARKET_REGIME_FILTER=true. Blocks high_volatility and news_risk
✅ Safe regime → continue
❌ high_volatility/news_risk → skip
⬇
📊 TLL Regime SupplementAdditional TLL regime check (not a replacement for internal regime)
✅ Safe → continue
❌ high_volatility → skip
⬇
🧪 TLL Skills CheckcheckSignalAgainstTllSkills() — boost/penalty
✅ Boost ≥ -0.05 → continue
❌ Boost < -0.05 → skip
⬇
⚖️ TLL Strategy WeightSkip quarantined strategies (weight === 0)
✅ Active → continue
❌ Quarantined → skip
⬇
🕐 checkTradingWindow()Only trade during configured hours — only if ENABLE_TRADING_WINDOW_FILTER=true
✅ In window → continue
❌ Outside window → skip
⬇
📈 getDynamicThreshold()Adjust confidence threshold based on recent win rate — only if ENABLE_DYNAMIC_CONFIDENCE=true
✅ Above threshold → continue
❌ Below threshold → skip
⬇
🚀 openAggressiveTrade()Opens aggressive mock trade, increments openCount
⬇
🟣 Phase 3: TradingView TA Scan (if ENABLE_TV_TA_SCAN=true)
📡 scanTradingViewOpportunities()Fetch TA signals from TradingView — uses rotating subset of symbols (batch size × offset based on tick count)
⬇
🔬 tvAnalysisToResearchItem()Convert TV analysis to research item, store via storeResearchItem()
⬇
🚀 openAggressiveTrade()If TV signal is BUY/SELL and no existing trade, open with confidence=0.62, strategy='tv_ta_scan'
⬇
🟡 Phase 4: Daily Summary (runs at 23:00 UTC only)
📋 reportDailySummary()Query today's closed trades → calculate win rate + PnL → if win rate < 40% and ≥5 trades, dedupSendIdea() with risk recommendation
⬇
🛡️ Error RecoveryOn worker crash: dedupSendIdea() with bug report + recommendation