Forex Profit Calculator
calculate_profitProfit or loss of one Forex or gold trade from its open and close prices, in pips and in the account currency, before and after spread, commission and swap. Same calculation as the Forex Profit Calculator page at https://forexdemo.com/forex-profit-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
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"open": "<open>",
"close": "<close>"
},
"name": "calculate_profit"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| open | Yes | Open price. | |
| pair | No | Currency pair or gold (XAU/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 neither currency of the pair is the account currency. | |
| side | No | buy (long) or sell (short). | buy |
| size | No | Trade size, counted in sizeUnit. | |
| stop | No | Optional stop-loss price. | |
| swap | No | Optional overnight swap for all nights held, in the account currency. A charge has a minus sign, such as -12.50. | |
| close | Yes | Close price, or the price you expect. | |
| spread | No | Optional spread, in spreadUnit. | |
| target | No | Optional take-profit price. | |
| balance | No | Optional account balance, to show the result as a percentage. | |
| currency | No | The currency the trading account is held in. | USD |
| sizeUnit | No | How the size is given: standard (100,000 units), mini (10,000), micro (1,000), nano (100) lots, or units. | standard |
| commission | No | Optional commission per standard lot, in the account currency. | |
| spreadUnit | No | Unit of spread: pips, or points as MetaTrader shows it. | pips |
| commissionBasis | No | side: charged when opening and again when closing. round: once per round trip. | side |