Toorich app sync

## What It Does

2RICH.CAPITAL APP SYNC is a lightweight MetaTrader 5 Expert Advisor that acts as a push client, automatically syncing live positions and closed trade history from a trader's MT5 terminal to their personal journal on the 2RICH Capital website. Rather than requiring manual CSV exports or imports, the EA connects once with a secure API key and connection token, then reports account and trade data to the platform on a recurring interval.

## Core Features

- Multi-user architecture: each trader's connection is tied to a unique hashed API key and connection token, so multiple accounts can sync independently to the same backend.
- Automated interval sync: the EA runs on a background timer (originally every 300 seconds) and posts a JSON payload without requiring the terminal to stay in focus.
- Live and historical coverage: each sync sends both open positions (live_trades) and closed deals from account history (closed_trades), along with account snapshot data like balance, equity, margin, and server.
- Journal routing: trades sync into whichever of the user's up to 5 journals is selected on the account settings page, so a single MT5 account can feed a chosen journal rather than a fixed default.
- Dollar P&L calculation: for closed trades, the EA-fed backend computes net profit (profit plus swap and commission) and writes it as a rounded dollar value into the journal's profit_loss field.
- Debug logging: an optional debug mode logs the exact HTTP request and response in the MT5 Journal tab, making it straightforward to diagnose connectivity or payload issues.

## Technical Summary

The EA communicates with the 2rich.capital application. On the receiving end, the endpoint upserts open positions into a live-trades table and inserts or updates closed trades into the journal's trade history table, keyed by the MT5 position/ticket identifier to avoid duplicates.
Filtro:
Nessuna recensione
Rispondi alla recensione