Position Size Calculator
calculate_position_sizeHow many lots to trade so that hitting the stop-loss loses a set percentage or amount of the account. Same calculation as the Position Size Calculator page at https://forexdemo.com/position-size-calculator.html. Every input is optional unless marked required; left-out inputs use the page's defaults, which are listed in the reply.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "calculate_position_size"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| pair | No | Currency pair, such as EUR/USD. EURUSD and eur-usd are accepted too. | EUR/USD |
| rate | No | Only needed when the account currency is not in the pair: the price of the market pair that converts it (for example the GBP/USD price for EUR/GBP in a USD account). Required when the account currency is not in the pair. | |
| risk | No | Risk per trade: a percentage (1 for 1%) or an amount, per riskMode. | |
| side | No | buy (long) or sell (short). | buy |
| stop | No | Stop-loss price (stopMode prices). | |
| entry | No | Entry price (stopMode prices). | |
| price | No | Optional pair price, for the position value. Leave it out to use the example price. | |
| spread | No | Optional spread to add to the stop distance, in costUnit (buys only, as on the page). | |
| balance | No | Account balance in the account currency. Needed when riskMode is percent. | |
| lotStep | No | The smallest size step your broker allows. | 0.01 |
| costUnit | No | Unit of spread and slippage. | pips |
| currency | No | The currency the trading account is held in. | USD |
| riskMode | No | percent: risk is a percentage of the balance. money: risk is an amount in the account currency. | percent |
| slippage | No | Optional stop slippage allowance, in costUnit. | |
| stopMode | No | pips: give the stop distance in stopPips. prices: give the entry and stop prices. | pips |
| stopPips | No | Stop-loss distance (stopMode pips). | |
| stopUnit | No | Unit of stopPips: pips or points (10 points = 1 pip). | pips |
| commission | No | Optional commission per standard lot, in the account currency. | |
| commissionBasis | No | side: charged when opening and again when closing. round: once per round trip. | side |