Detecting Account Property Changes in a MetaTrader Trading Library
Summary
This article extends a MetaTrader library to detect changes in trading account properties. Rather than building a separate account-event class, it places comparison logic in the account collection, checking current properties against stored prior values and sending an event when a configured change is found. It organizes account event codes alongside existing trading event codes and defines flags for changes such as leverage, trading permissions, balance, equity, profit and margin.
The article describes integrating the detection methods into the library and demonstrates them with an Expert Advisor and terminal logs. Examples include detecting changes in whether trading is allowed and reacting when equity crosses a configured threshold by closing a profitable position. These are software demonstrations, not evidence of a robust risk-control policy or strategy performance. Event detection depends on the selected properties and thresholds, and the article concerns MetaTrader implementation rather than a general account monitoring framework.
Key ideas
- Account changes can be detected by comparing current properties with a previously stored snapshot.
- The article places account event tracking in the account collection because it monitors only the connected account.
- Event flags cover account settings and threshold changes in financial properties such as equity and margin.
- Detected events can be sent to the control program for handling.
- A tester demonstration reacts to an equity threshold, but does not establish that the response is a sound risk policy.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.