How sparlit/forexscalpper works
Purpose and Entry Points
EAQTS is a Python-based autonomous multi-asset trading system centered on analysis, deterministic risk controls, broker execution, persistent trade state, and operator visibility. The primary launch path is main.py; its trading integration spans connector.py and the MetaTrader 5 Expert Advisor ScalperBrainEA.mq5. Desktop and browser-facing monitoring surfaces are represented by gui.py and dashboard.html.
Application Control and Orchestration
The runtime’s coordinating layer appears to combine a central trading loop with supervised AI/agent workflows. main.py is the process entry point, while brain_agents_orchestrator.py coordinates specialized brain agents and supervisor_agent.py provides higher-level oversight/intervention. config.py supplies runtime parameters rather than allowing intelligence components to define operational boundaries.
Market Intelligence and Signal Generation
Market inputs are transformed into trading opinions through conventional indicators, predictive models, and agent reasoning. indicators.py is the technical-analysis boundary; predictive_brain.py and brain.py provide model-driven decision logic. eaqts_planes.py likely organizes the broader control/data/intelligence/risk conceptual planes described by the system specification, making it a key integration point rather than a strategy leaf module.
Risk, Safety, and Release Governance
Trade admission is expected to be governed separately from signal generation: model recommendations must pass hard risk and safety checks before execution. release_gates.py is the explicit governance/release boundary, and eaqts_planes.py likely hosts plane-level safety coordination. The design documents establish a stateful safety model—normal, defensive, halted—with circuit-breaker and reconciliation requirements; operational detail is documented in docs/CIRCUIT_BREAKER.md and docs/RUNBOOK.md.
Execution, Broker, and External Integrations
connector.py forms the principal broker/MT5 boundary, with ScalperBrainEA.mq5 implementing the terminal-side EA counterpart. The optional institutional integration layer broadens this boundary to FIX, universal brokers, execution algorithms, and a Go gateway: institutional_integrations/fix_engine.py, institutional_integrations/universal_broker_adapter.py, and institutional_integrations/go_gateway.py. This separation is material: internal decisions should become normalized orders before reaching venue-specific adapters.
State, Events, and Reconciliation
The system has explicit persistence and asynchronous coordination components. database.py owns durable application/trade state, while event_bus.py decouples publishers and consumers across market, decision, execution, and telemetry flows. Persistent reconciliation between recorded trades and broker positions is a critical safety boundary; durable state likely also supports restart recovery, auditability, and learning history.
Learning, Research, and Institutional Extensions
The repository includes an extensible advanced-analytics suite beyond the core scalp-trading path: institutional_integrations/comprehensive_suite.py, institutional_integrations/backtest_engine.py, and institutional_integrations/trade_memory_protocol.py. Additional modules cover portfolio optimization, causal/ML analysis, DRL execution, order-flow, and local/quantum-oriented model experiments. These should be treated as proposal or enrichment producers; their outputs remain downstream of deterministic risk and execution controls.
Operations and Notifications
Operators can inspect runtime behavior through gui.py, dashboard.html, and operational documentation in docs/ARCHITECTURE.md. telegram_bot.py is the alerting/remote-notification integration. The intended deployment is Python on desktop/server infrastructure, with MT5 as the material execution runtime and local database storage; institutional adapters may introduce external broker, FIX, gateway, and data-service dependencies.
Main entry points: event_bus.py Event bus · brain.py Trading brain · release_gates.py Risk release gates · eaqts_planes.py Control planes
Components 24
Trading Core
Coordinates analysis, agents, and deterministic admission.
- Process entry
main.py - Runtime configuration · Supplies operating parameters and limits.
config.py - Control planes · Coordinates intelligence, control, data, and safety planes.
eaqts_planes.py - Brain agent workflows
brain_agents_orchestrator.py - Supervisor agent · Can intervene in specialized agent workflows.
supervisor_agent.py - Technical indicators
indicators.py - Predictive model
predictive_brain.py - Trading brain
brain.py - Risk release gates · Admits or blocks recommendations before execution.
release_gates.py
Execution & State
Normalizes, executes, records, and reconciles trades.
- Event bus · Decouples market, decision, execution, and telemetry flows.
event_bus.py - Trade state store · Stores trade records for recovery, audit, and reconciliation.
database.py - MT5 connector · Principal Python broker and MT5 boundary.
connector.py - MT5 Expert Advisor
ScalperBrainEA.mq5
Institutional & Research
Optional adapters and analytics enrich decision proposals.
- FIX engine
institutional_integrations/fix_engine.py - Universal broker adapter
institutional_integrations/universal_broker_adapter.py - Go gateway
institutional_integrations/go_gateway.py - Advanced analytics suite · Produces enriched proposals outside the deterministic execution path.
institutional_integrations/comprehensive_suite.py - Backtest engine
institutional_integrations/backtest_engine.py - Trade memory protocol
institutional_integrations/trade_memory_protocol.py
Operations
Operator visibility, alerts, and safety procedures.
- Desktop monitor
gui.py - Browser dashboard
dashboard.html - Telegram alerts
telegram_bot.py - Circuit-breaker procedure · Defines normal, defensive, and halted safety operation.
docs/CIRCUIT_BREAKER.md - Operations runbook
docs/RUNBOOK.md
Connections 26
- Process entry → Runtime configuration: loads
- Process entry → Control planes: starts
- Control planes → Brain agent workflows: coordinates
- Brain agent workflows → Supervisor agent: supervised by
- Technical indicators → Trading brain: market features
- Predictive model → Trading brain: model opinion
- Brain agent workflows → Trading brain: agent reasoning
- Advanced analytics suite → Trading brain: enrichment proposals
- Backtest engine → Advanced analytics suite: research results
- Trade memory protocol → Advanced analytics suite: learning history
- Trading brain → Risk release gates: recommendation
- Control planes → Risk release gates: safety coordination
- Runtime configuration → Risk release gates: limits
- Risk release gates → MT5 connector: approved normalized order
- MT5 connector → MT5 Expert Advisor: broker commands
- FIX engine → Universal broker adapter: institutional order route
- Universal broker adapter → Go gateway: gateway route
- Event bus → Trade state store: durable events
- MT5 connector → Trade state store: trades and positions
- MT5 connector → Event bus: execution events
- Control planes → Event bus: publishes telemetry
- Event bus → Desktop monitor: runtime status
- Event bus → Browser dashboard: runtime status
- Event bus → Telegram alerts: alerts
- Circuit-breaker procedure → Risk release gates: halt policy
- Operations runbook → Trade state store: reconciliation procedure