OnTradeTransaction: build a clear execution ledger

OnTradeTransaction: build a clear execution ledger

A trade request can produce several account events. A compact event ledger explains that sequence more clearly than a single message saying buy successful. It is especially useful for partial fills, pending-order activation and later manual changes.

Use event type and identity

OnTradeTransaction reports transaction types such as order addition and deal addition. The platform does not guarantee the arrival priority of transaction groups. Request and result details have their documented meaning for request-type transactions; do not read every field as valid for every event.

Sketch a record format

An illustrative ledger row can contain timestamp, transaction type, order ticket, deal ticket, position reference and quantity where applicable. Keep missing fields empty rather than inventing values. The record should describe observation, not trigger a second trade.

Reconcile instead of counting

One request may create several rows, so callback count is not trade count. After the sequence, compare the ledger with current positions and history. Include partial fills and cancellation in your test cases, not only immediate full fills.

Keep the handler small

Ask AI to avoid long network operations or large report rendering inside the handler. Capture the essentials, then perform heavier summaries elsewhere. Your acceptance check is that the account state and ledger agree after processing, even when the order of notifications differs.

OnTradeTransaction reference

Back to top

MQLume Bespoke

Built around your ambition.

Explore bespoke services →

Have something more specific in mind?

Ask us about advanced custom development. Share your requirements through private support or email; we will discuss the scope and quote separately.

100% committed to following up on your delivery and support requests.

Free downloads. Real source files.

FREE

Lizard [MQLume]

MQL5 / MT5Version v2.1

Free editable gold breakout project with six independently selectable cores, session filters and flexible position sizing.

US$99.00FREE
FREE

Scraper Gold [MQLume]

MQL5 / MT5Version v3.7

Free editable source with compiled EX5: four gold breakout engines with independent profiles, sizing, direction and exits.

US$95.00FREE
MQLume

More to explore. A community to share it with.

Stay close to MQLume, wherever you like to learn.

YouTube

See our EAs in action. Explore backtests, walkthroughs and practical guides.

Watch on YouTube

Telegram

Meet other EA users, share ideas and keep up with what’s new.

Join the community Follow official updates

Cart

One personal-use licence per project. Each project can be added once.

Your cart is waiting for its first passenger.

Choose an EA or source edition to get started.

Continue shopping