Fixed Money Market Order
Percentage risk is the textbook answer, but a lot of real trading is budgeted in money: a prop firm hands you a daily loss limit in dollars, a funded account has a hard drawdown number, a beginner decides the most a lesson may cost. This script takes that number and a stop distance in pips, computes the volume that makes the stop cost exactly that much or less, and places the order with its stop attached. The money value of a pip is derived from tick value and tick size: pip value per lot = tick value * (pip size / tick size) and never from naive Point arithmetic. The naive version happens to work on EURUSD and then sizes JPY crosses, gold and index CFDs wrongly - sometimes by an order of magnitude - because on those symbols the tick size is not the point and the quote currency is not the account currency. Tick value already contains the conversion into account currency, so scaling it by pip over tick is exact on every symbol the broker quotes. The computed volume is floored to the broker's lot step and never rounded up. A result below the minimum lot is a refusal, not a promotion to the minimum - promotion is precisely how a 50 dollar budget becomes a 150 dollar loss on a wide-stop trade. The refusal prints what the minimum lot would actually risk and the two legal ways out: raise the budget to a stated amount, or tighten the stop to a stated number of pips. A budget larger than the account balance is refused outright as a typo, a check a percentage input gets for free but a money input has to make explicitly. Stops are validated against the broker's stop and freeze levels, re-checked on every retry because stop levels widen during news, and snapped to the tick-size grid on the side that keeps the realised risk at or under budget. After the fill the summary reports the risk recomputed from the actual open price, so slippage is visible immediately. Notes and limitations - The stop loss is placed relative to the quote at send time, and slippage moves the fill, so the realised risk can differ from the budget by approximately the slippage. The post-fill summary reports the true figure. - Tick value is read from the broker. On symbols the terminal has not synchronised it can be zero, in which case the script refuses and asks you to open the symbol's chart first rather than sizing from garbage. - A partial fill on MQL5 leaves a smaller position with proportionally smaller risk; the journal says so when it happens. - The script sizes one trade in isolation. It does not know about the risk already open on the rest of the account, and it does not track a daily total - it budgets one trade. - Swap and commission are not part of the risk figure; it measures the stop distance only.
Script · MT5 · v1.0 · Free
About Fixed Money Market Order
Fixed Money Market Order is an expert advisor (trading robot) for MetaTrader 5. It can size trades from your balance and risk percent. It has 9 settings, such as Side, Risk money and Stop pips. MQL source code included.
Files in the download: FixedMoneyOrder.ex5, FixedMoneyOrder.mq5, FixedMoneyOrder.txt.
Trading robots can lose money. Check every setting and test on a demo account before using real funds.
Settings
| Setting | Default | What it does |
|---|---|---|
| Side | TRADE_SIDE_BUY | Direction |
| Risk money | 100.0 | Risk, account currency |
| Stop pips | 20.0 | Stop distance, pips |
| Take profit r | 0.0 | Take profit, R multiple (0 = none) |
| Magic | 0 | Magic number |
| Slippage pips | 3 | Slippage tolerance, pips |
| Max retries | 5 | Attempts before giving up |
| Retry wait ms | 500 | Pause between attempts, ms |
| Confirm first | true | Ask for confirmation first |
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 5 open File → Open Data Folder, then go to MQL5 → Experts.
- Copy the .mq5 file(s) there. Put any .mqh files in MQL5 → Include.
- Open the .mq5 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
- Drag the expert advisor from the Navigator onto a chart, check the settings, allow Algo/Auto Trading and press OK.
- Test it first on a demo account or in the Strategy Tester.
Tags: Grid · Volume · Risk & Lot Size · MT5 Script · MQL5 Source Code