Margin Audit for Prop Firm Traders

What it does

This product is free.

Margin Audit is a read-only MetaTrader 5 script. It never opens, modifies or closes orders. It uses no DLL files and no WebRequest. The only file it writes is a comma-separated report.

The script reads the account's deal history, rebuilds the positions that were open each time a position was opened or increased, adds up their margin, and compares the combined usage with a limit you set (for example 80 percent of balance).

Some prop trading firms measure margin usage this way: they add the margin of every position that was open at the same moment, even if the overlap lasted only a few minutes. MetaTrader does not show that combined figure on its own. This script reports it as an estimate so you can review your own history.

The result is an estimate, not an official ruling, and it does not approve or guarantee a payout. The product is not affiliated with, endorsed by, or approved by any firm.

How to use it

After you install it from the Market, open Navigator, open Scripts, and drag MarginAudit onto any chart. Set the date range, leverages and limit to match the rules published by your firm, then click OK. Read the Experts log, the chart comment, and the report file written to MQL5\Files.

Inputs

StartDate - start of the audit window. 0 means 30 days before now.
EndDate - end of the audit window. 0 means now.
LevMetals - leverage for metals such as XAU and XAG. Default 20.
LevFX - leverage for currency pairs. Default 30.
LevIndices - leverage for index contracts. Default 20.
LevOther - leverage for everything else. Default 10.
UseAccountLeverage - if true, use the account leverage for every symbol instead of the four values above.
Denominator - BALANCE_AT_OPEN uses the balance at that moment, rebuilt from history. START_BALANCE uses a fixed value. CUSTOM uses CustomDenominator.
StartBalance - value used by START_BALANCE. 0 means the rebuilt balance at StartDate.
CustomDenominator - value used by CUSTOM. Default 10000.
LimitPct - margin usage limit in percent. A moment is marked BREACH only when usage is strictly above this value. Default 80.
RunSelfTest - if true, the built-in self-test runs before the audit. Default true.

How to read the output

The Experts log prints one block for every opening in the date range, with each open position, the combined margin, the combined percent, and PASS or BREACH.

A chart comment shows the peak combined percent, the time of the peak, the number of breaches, and the overall result. Look at the peak combined percent and the breach count first.

A report file is written to MQL5\Files\MarginAudit_<login>_<YYYYMMDD>.csv. It has one row per open position per moment. Filter the Status column for BREACH to see which overlapping positions caused each event.

Built-in self-test

When RunSelfTest is true, the script first computes a known example with the same margin function used by the audit (contract size 100, leverage 20, balance 9917.85):

XAUUSD 0.10 lot at 3590.31 = 1795.155 margin = 18.10 percent
XAUUSD 0.40 lot at 3574.38 = 7148.76 margin = 72.08 percent
Combined = 8943.92 = 90.18 percent

The Experts log should then print SELF-TEST PASS.

Limitations

Firms differ. Some divide by equity instead of balance, some use the initial account size, some count margin per asset class or per symbol, and some use the broker's live margin (current price, tiered or hedged margin) rather than the open price. Set Denominator and the leverage inputs to match your firm's published rules, and treat the result as an estimate.

Equity is not rebuilt. Floating profit and loss at each moment is not known from deal history, so there is no equity denominator. Use CUSTOM if your firm uses a fixed account size.

Moments are measured at openings only. With BALANCE_AT_OPEN, a losing close can lower the balance while other positions stay open. That moment is not re-evaluated until the next opening.

Hedged positions are counted in full. No hedged-margin reduction is applied.

Currency conversion is approximate. It uses the M1 close of the conversion pair. If that bar is missing, the nearest bar or the current price is used, and those moments are flagged in the report.

If a traded symbol no longer exists at the broker, the script assumes a typical contract size and prints a warning. Asset-class detection is based on the symbol name, path and calculation mode; check the AssetClass column in the report.

History depth matters. Positions whose opening deals are older than the history the terminal provides cannot be rebuilt, except currently open ones.

제작자의 제품 더 보기
MarginMeterFunded shows margin usage the way a funded or evaluation account rule counts it: the margin of every position open at the same moment, divided by the firm's denominator, compared with a cap. That is not the same as the terminal's margin level. Presets cover common formulas — 80% of equity or 70% of balance for all positions, or 20% of start balance per asset class — plus a custom rule. A leverage map by class can follow an evaluation or funded phase. The panel shows live and per-class
필터:
리뷰 없음
리뷰 답변