Hedge Locker is a server-side MetaTrader 5 plugin that allows brokers to restrict the manual closing of hedged positions based on configurable rules.
The broker can define:
- which client groups and symbols the rule applies to
- set an active schedule
- specify the minimum hedge ratio at which closing should be rejected
All rules are managed through a dedicated WebGUI, allowing brokers to apply different conditions to specific clients, instruments, and time periods without changing the MT5 setup.
Example
The broker sets a hedge ratio threshold that determines when the plugin should block the manual closing of a hedged position. The hedge ratio is calculated separately for each symbol:
min(Buy volume, Sell volume) / max(Buy volume, Sell volume) × 100%
If the calculated hedge ratio is equal to or higher than the configured threshold, the client cannot manually close either side of the hedged position. If the ratio is below the threshold, closing is allowed.
For example, with a hedge ratio threshold of 90%, a client has buy 2.00 and sell 1.90 on the same symbol. The hedge ratio is 95%, which is above the configured threshold. Therefore, an attempt to manually close either side will be rejected.
If only a buy or sell position is open, the position is not considered hedged and can be closed normally.