local_ai.py) fuses those signals with support/resistance context, trend structure and volatility filters into one final decision — complete with a human-readable narrative explaining the reasoning. Trades are either executed automatically or routed to Telegram for manual approval; approved signals are re-validated and executed with freshly recalculated ATR-based stop-loss / take-profit levels and risk-based position sizing.
lines of Python across 19 core modules — spanning broker connectivity, order execution, a licensing / cloud-settings system, an economic-news filter, and a full offline backtesting, optimization and Monte Carlo risk-validation pipeline.
| Layer | Module(s) | Responsibility |
|---|---|---|
| Orchestration | main.py | Bot lifecycle: settings sync, daily-loss circuit breaker, position tracking, main run loop. |
| Signal Generation | signals.py | Five independent strategies plus candle-pattern and multi-timeframe aggregation. |
| AI Decision Layer | local_ai.py | Weighted MTF scoring, S/R zone cache, breakout / sweep detection, SL/TP engine. |
| Multi-Timeframe Data | multi_tf.py, indicators.py | Per-timeframe indicator builds: EMA / RSI / ATR / ADX / VWAP / BOS / trend detection. |
| Execution | trading.py, approved_signals.py, risk.py | Order placement, position management, risk-based lot sizing. |
| Approval / Notifications | telegram_notify.py | Signal cards, inline approval workflow, PnL & performance reports. |
| Visualization | mtf_chart_image.py, dashboard.py | Chart rendering with S/R & signal overlays; live PyQt5 desktop UI. |
| Market Safeguards | news_filter.py | Economic calendar ingestion and news-driven trade blocking. |
| Analytics | performance.py, system_utils.py | Daily / weekly / monthly PnL, win rate, profit factor, per-symbol stats. |
| Research & Validation | backtest_engine.py, run_optimization_mtf.py, monte_carlo_engine.py | Historical MTF backtesting, parallel parameter optimization, Monte Carlo risk simulation. |
profit×2 + win_rate×5 − drawdown×10.| Strategy | How it works |
|---|---|
| Trend Pullback | Enters in the direction of the higher-timeframe trend after a pullback to EMA / structure, confirmed on a lower timeframe. |
| Breakout | Detects structural breakouts (BOS) with confirmation candles and momentum filters, single-TF and multi-TF variants. |
| Liquidity Sweep | Identifies stop-hunt wicks beyond a swing high/low followed by a reclaim back inside range. |
| Mean Reversion | Fades short-term extremes back toward VWAP / Bollinger mid-band in range conditions. |
| AI5 Multi-TF High/Low | Cross-timeframe extremes model scoring setups against recent high/low structure across the configured timeframe stack. |
| Smart Money (SMC) Confluence | Optional fair-value-gap / swing-structure module layered in as an additional confirmation input. |
Daily loss circuit breakers, spread-quality filters and news blackout windows are built in by default — risk controls are not an afterthought.
A 19,250+ line, 19-module production codebase — from broker connectivity and order execution to licensing and cloud-config, built and iterated as one cohesive system.
Every strategy passes through backtesting, parallel optimization and Monte Carlo risk simulation — with a PASS/WARNING/FAIL gate — before it ever touches live capital.
Config-driven, defensive architecture with safe local fallbacks; two-stage trade execution that re-validates live prices before an approved signal is ever sent.
of hands-on trading in gold, BTC and EUR/USD sit behind every rule this system automates — the code reflects real market experience, not just an engineering exercise.