Singuard Home Blog Contact eTrader eTrader for Businesses eTrader for Traders Broker Broker CRM Live Demo Prop Firm Prop Firm CRM Live Demo
Trader Tools

Lot Size Scripts: One Click, Correct Risk.

Drag a line where the stop goes, press a key, and the order goes out at the size that risks exactly one percent. The idea is simple. The arithmetic underneath breaks in about six different places.

By April 24, 2026 6 min read

Most traders who size by hand do it the same way: pick a number of lots that feels right for the account, then place the stop where the chart says. That is backwards, and it is the reason two trades with identical setups can lose 0.4 percent and 3 percent of the same account. The stop belongs to the chart. The size belongs to the risk.

A lot size script closes that gap by doing the calculation in the order window. You give it a risk percentage and a stop price. It returns a volume and, in most implementations, sends the order with the stop already attached. On a busy session that removes both the mental arithmetic and the temptation to round upwards.

The formula the script is running

Volume equals the risk amount divided by the product of the stop distance and the value of one price increment for one lot. Risk amount is a percentage of equity. Stop distance is entry minus stop in price terms. Increment value depends on the instrument.

Take a concrete case. Account equity 10,000 in account currency, risk 1 percent, so 100 to lose. EUR/USD, stop 25 pips away, with one pip on one standard lot worth 10 units of quote currency. 100 divided by (25 times 10) gives 0.4 lots. If the account is denominated in the quote currency, that is the answer. If it is not, the result has to be converted at the current cross rate, and that conversion is where a lot of home made scripts quietly go wrong. The underlying units are covered in lots and position sizes and the price increment itself in what a pip is.

Where the arithmetic goes wrong

Six failure points, in rough order of how often they appear.

Contract size assumptions. A script written for currency pairs applies a forex lot definition to gold or an index CFD and returns a volume that is wrong by a large multiple. The instrument specification has to be read from the symbol at runtime rather than assumed.

Account currency conversion. A euro denominated account trading USD/JPY needs two conversions, and the script must use a live rate from the terminal rather than a value cached at startup.

Symbol suffixes. Brokers name the same instrument EURUSD, EURUSD.m, EURUSD.pro or EURUSD_raw. A script that matches on an exact string fails silently or, worse, looks up the specification of a different symbol.

Lot step and minimum volume. The computed 0.437 has to be rounded to the broker's step, and rounding up rather than down means every trade risks slightly more than intended. On small accounts the minimum lot can exceed the target risk entirely, in which case the script should refuse rather than place something oversized.

Spread. On a buy, the stop is evaluated on the bid while the fill happens on the ask, so the real distance is the visible distance plus the spread. On a wide instrument this matters.

Stop level restrictions. Many symbols enforce a minimum distance between the current price and any attached stop. A script that ignores it gets an order rejected at the worst possible moment.

A script sizes the position. It does not reduce the risk of the trade. Leverage magnifies both directions and a correctly sized loss is still a loss. The value of the tool is consistency across a hundred trades, not protection on any single one.

Script, indicator or expert advisor

The three MetaTrader object types behave differently and the choice affects how the tool is used. A script runs once when you drop it on a chart and then exits, which suits a fire-and-forget order placement. An indicator draws and calculates continuously, which suits a panel showing the size that would be used if you traded now. An expert advisor stays attached and receives events, which is what you need for a hotkey driven trade panel with a draggable stop line.

Most of the popular risk panels are expert advisors for that reason, and only one can be attached per chart. Installation follows the usual path for custom indicators and add-ons, and automated trading has to be enabled for anything that places orders.

Some platforms handle this natively instead, taking a risk amount in the ticket and computing the volume from the stop you have dragged on the chart. Where that exists, as it does in the order ticket of eTrader, there is nothing to install and nothing to keep in sync with a broker's symbol naming.

Testing one before you trust it

Never take a downloaded script's arithmetic on faith. Compute one case by hand, then check the script against it. Use a round example so the error is obvious: a fixed equity, a 1 percent risk and a 100 point stop should produce a number you can verify with a calculator, and the standalone tools in position size calculators are a useful second opinion.

Then vary the inputs deliberately. A currency pair where the account currency is the quote currency. One where it is neither. Gold. An index. A pair with a symbol suffix. A stop so tight that the result falls below the minimum lot. Each of those hits a different branch, and a script that handles the first case correctly frequently fails the fourth.

Run it on a demo account for a week before it touches a live one, and check the executed volume against the intended risk after each fill rather than before. The number that matters is what appeared in the terminal, not what the panel displayed.

What a script cannot fix

It cannot decide where the stop belongs, and a stop placed to produce a comfortable lot size is worse than no automation at all. It cannot stop you overriding the number on the trade you feel strongly about, which is the trade that historically does the damage. And it cannot account for correlation: three positions each risking 1 percent on pairs that all move with the dollar is a 3 percent bet on one idea, which is the point made in risk management rules.

The honest description of the tool is narrow. It removes an arithmetic error and a moment of discretion from every order. Over a few hundred trades that is worth more than it sounds, because the errors it removes are not random: they lean towards taking more size when conviction is high, which is exactly when the size should stay the same.

"Anyone can size correctly on the trade they are calm about. The reason to automate it is the trade you are not calm about, and that is the one the script has to be installed before."

— Alex Onta, Executive Director, SINGUARD

Key Takeaways

Frequently Asked Questions

What formula does a lot size script use?

Position size equals the money you are willing to lose divided by the stop distance multiplied by the value of one price increment for one lot. The money figure comes from a percentage of account equity, the stop distance comes from your entry and stop levels, and the increment value depends on the instrument, its contract size and the account currency. The result is then rounded down to the broker's lot step.

Why does a script give a different size on gold than on a currency pair?

Contract sizes differ by instrument. A standard forex lot is defined in units of the base currency, while metals and indices use their own contract specifications, and the value of one point can differ by an order of magnitude. A script that assumes a single contract size will size metals and index CFDs incorrectly, which is why the instrument specification has to be read from the symbol rather than hard coded.

Should the spread be included in the stop distance?

For a buy order the stop is measured from the bid side while the entry happens at the ask, so the effective distance is the visible distance plus the spread. On wide spread instruments ignoring this understates the real risk. Commission is a separate cost that most scripts leave out of the risk figure entirely, so the actual loss on a stopped trade is slightly larger than the target amount.

Your Own Trading Firm, Live in 24 Hours.

SINGUARD builds the technology behind brokers and prop firms: trading platform, CRM, client portal and payment rails, one bundle, one predictable price. Book a call and see it working, or keep reading the guides.

More in Trader Tools