Position Sizer: risk based lot sizing inside MetaTrader
Calculate your position size based on the risk and account size and execute your trades with this free MetaTrader expert advisor.
At a glance
- What is it?
- Position Sizer is an EarnForex expert advisor for MT4 and MT5 that computes the number of lots to trade from your risk tolerance, account size, currency, pair and commission, and can open the trade from the same panel. The repository itself is thin and points to the vendor site for documentation and installation.
- Who is it for?
- Position Sizer suits a retail trader who trades on MetaTrader and wants position size computed from a stated risk rather than from a fixed lot value, and who wants the option to execute the trade from the calculation panel. It does not suit someone who needs an API, a test suite or a strategy backtest harness, because the repository contains only the MQL4 and MQL5 sources with no test or build tooling.
- Can I use it commercially?
- Yes. Apache-2.0 is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
- Is it still maintained?
- Yes. The repository last received commits 12 days ago.
- What is it written in?
- Mainly MQL5, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on October 24, 2026, and from our analysis. They are not legal advice.
Editorial analysis
The calculation traders usually skip
The Position Sizer expert advisor for MT4 and MT5 by EarnForex.com does one thing and does it in the trading platform itself: it calculates the number of lots to trade based on your risk tolerance, account size and currency, currency pair, commission, and other settings.
That is a small sentence describing a task that has real consequences. Most position sizing mistakes are not exotic; they come from picking a lot size by feel, from copying a size from another pair, or from forgetting that commission eats into the distance to a stop. Moving the arithmetic into an indicator panel inside the terminal makes the risk an input you set rather than an output you hope for.
The README describes the tool as feature rich and says it was designed to work with all kinds of instruments and to help with everything related to position sizing: margin, potential portfolio risk and profit, swaps, and so on. That phrase matters. The point is not a lot calculator but a panel that shows the consequences of a position in the currency of your account, including the cost of holding it overnight.
The audience is narrow by design. It is for people trading on MetaTrader 4 or MetaTrader 5 through an expert advisor, not for a backtesting framework or a portfolio analytics tool.
What actually goes into the calculation
The inputs are listed in the README and they are worth reading as a checklist, because each one corresponds to a way a naive calculation goes wrong.
Risk tolerance is the first, and it is the one the trader sets as a percentage rather than computes. Account size is the second, and it is what the calculation scales against. Currency comes third, and this is the detail that separates a serious tool from a spreadsheet: the account may be denominated in a currency other than the pair being traded, so the output has to be converted rather than assumed.
The currency pair matters because pip value depends on the pair, and commission is listed as an explicit input rather than folded silently into a spread assumption. The README also refers to other settings without enumerating them in the summary, and the example chart in the repository is captioned as showing ATR settings enabled, which indicates that volatility based sizing is part of the configuration.
So the tool takes the things a position size actually depends on: how much you are willing to lose, how big the account is, what the money is denominated in, what you are trading, and what the trade costs to enter.
The Main tab is both calculator and order ticket
The panel is described as having a Main tab, and the README says the Position Sizer EA can be used to open trades based on the calculations it does in that Main tab.
That sentence is the design decision of the whole project. A calculator that stops at the number, and a separate button elsewhere that opens a trade, splits a decision in two and invites the gap between them. Here the size on screen is the size that gets sent, which removes a transcription step from the one moment where a transcription error is expensive.
The reported figures are broader than lot size. The README names margin, potential portfolio risk and profit, and swaps among the things the tool helps with. Margin tells you whether the trade fits in your account. Portfolio risk tells you what the position does to your total exposure, which is the number that stops three correlated positions from quietly becoming one large position. Profit tells you what the target is worth in account currency. Swaps tell you what holding overnight costs, which for some strategies is larger than the spread.
The picture in the repository shows the expert advisor on a chart with ATR settings enabled, which is a reminder that the panel is drawn inside the terminal on the chart you are trading, not in a separate application.
Two platform versions live side by side
The repository layout is small and tells you the important structural fact. At the top level there are MQL4/ and MQL5/ directories, a LICENSE.md, a README.md, and a README Images/ directory holding the images the README references.
MetaTrader 4 and MetaTrader 5 are different runtimes with different APIs and different order models, and the expert advisors of that era are routinely maintained in parallel. Keeping both trees in one repository means the same feature can exist on both platforms, and a change to the sizing logic is conceptually two edits rather than two projects. The cost is the same duplication you would have anyway, and the benefit is that the two versions sit under one set of releases.
What is not in the tree is as telling as what is. There is no CI configuration, no test directory, no build script, no packaging or installer script, and no issue templates beyond what the platform provides by default. For an expert advisor that is not unusual, since the artifact you install is a set of source files that MetaTrader compiles, but it does mean there is no automated check that the MT4 and MT5 trees still agree on a formula.
The README also says that all sorts of contributions are welcome, which is an invitation to contribute to the source rather than an indication that a contribution pipeline is automated.
The documentation lives on the vendor site
The repository is deliberately short, and the README points elsewhere for the substance. A very detailed description of the expert advisor and its functions is published at the EarnForex site, and installation instructions are on the same page under an Installation heading.
That arrangement has an upside and a downside. The upside is that the reference documentation can be thorough and keep screenshots of the actual panel, which a repository README is a poor place for. The downside is that the durable record of behaviour lives outside the version control history, so a change in the code and a change in the manual are not reviewed together, and the manual has no version tag tied to a release.
For a tool that computes trade sizes, the practical consequence is that you should read the vendor documentation for the exact settings list, because the README only summarises the inputs as risk tolerance, account size, currency, pair, commission and other settings. The vendor site also hosts the MT4 and MT5 expert advisor downloads, so that is where the installable artifacts and the instructions live rather than the releases page of this repository.
Version 3.16 and the patch release rhythm
The release list shows 3.16b on 2026-09-14, 3.16c on 2026-10-08 and 3.16d on 2026-10-12, and the last push to the repository was on 2026-10-12 as well. The repository is not archived, so the work is current, and the cadence suggests active iteration on a single 3.16 line with lettered patch releases rather than numbered minor versions.
That pattern is normal for trading tools. Broker specifications change, new instrument types appear, and platform differences surface as users report them, so the fixes accumulate as d, e, f releases under one minor number. For a user it means the important question is not which minor version you have but whether your platform combination is covered by the latest letter.
The licence is Apache-2.0, with the text in LICENSE.md at the repository root. That is the permissive choice, and it is worth noting for a project where the source is public and the compiled expert advisor is distributed separately, since the Apache terms are the part you inherit if you fork and modify the calculation logic.
Where a position sizing panel is the wrong tool
Two situations make this the wrong choice. The first is if you need to size positions programmatically. This is an expert advisor with a graphical panel, and the repository exposes no library, no scripting interface and no documented way to read the computed lot size from another program. If your workflow needs a position size inside a script you wrote, you are looking at the wrong artefact.
The second is if you want to evaluate a strategy rather than place a trade. A sizing panel tells you what size a given risk implies for one instrument under current conditions. It is not a backtester, it does not tell you whether the entry logic has an edge, and it does not model a sequence of trades. Sizing and strategy quality are different questions, and this project answers the first one.
There is a third, quieter point. The alternative is not necessarily a spreadsheet or a broker's own calculator. What you are comparing against is a platform that already knows your account, and this tool sits inside the platform, which is the actual reason to prefer it: the risk percentage, the account currency and the pair are inputs in front of you rather than numbers you transcribe from a broker statement. If your broker's own tooling already does that well, the case for this project is thin. If you trade several instruments with different commission and swap profiles, having one panel that reports margin, portfolio risk and swaps in account currency is the reason to install it.
Editorial conclusion
Position Sizer suits a retail trader who trades on MetaTrader and wants position size computed from a stated risk rather than from a fixed lot value, and who wants the option to execute the trade from the calculation panel. It does not suit someone who needs an API, a test suite or a strategy backtest harness, because the repository contains only the MQL4 and MQL5 sources with no test or build tooling. Verify first which of the two platform versions you are running, since the repository keeps MQL4 and MQL5 trees side by side, and read the installation section on the EarnForex site before copying files into your terminal data folder.
Frequently asked questions
Which trading platforms does Position Sizer support?
The Position Sizer is an expert advisor for MT4 and MT5 by EarnForex.com, and the repository keeps the two platform implementations in separate MQL4/ and MQL5/ directories.
What inputs does the Position Sizer expert advisor use?
The README says it automatically calculates the number of lots to trade based on your risk tolerance, account size and currency, currency pair, commission, and other settings. It also reports margin, potential portfolio risk and profit, and swaps.
Can Position Sizer open trades for me?
Yes. The README states the Position Sizer EA can be used to open trades based on the calculations it does in the Main tab of its panel.
Where do I find the Position Sizer installation instructions and downloads?
The README points to the EarnForex site, where a detailed description of the expert advisor and its functions is published along with an Installation section holding the instructions and the MT4 and MT5 downloads.
What licence is Position Sizer released under?
The project is licensed under Apache-2.0, with the terms in the LICENSE.md file at the root of the repository.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/earnforex-positionsizer)Was this useful?