# XAUUSD calculator

The dashboard calculator is an MT5/XAUUSD sizing and margin helper. It is not an order-entry ticket and it does not require an exact entry price.

## Inputs

- Approx XAUUSD price: used only for margin estimates. Use live XAUUSD or type a nearby price.
- Stop ticks and target ticks: relative distances from the notional entry. One calculator tick is `0.01` XAUUSD.
- Lot size to test: the MT5 lot size used for the input-lot margin estimate.
- Leverage: account leverage as a number. `200` means 1:200 leverage.
- Target reward: optional desired reward/profit amount on the MT5 hedge account.

Direction is not required. The calculator is measuring distance, lot size, margin, spread, and commission. It does not submit an order.

**Important MT5 hedge reminder:** enter the MT5/XAUUSD hedge stop and target distances, which are reversed relative to the NT GC/MGC trade. For example, if the NT stop is below entry on a long GC/MGC trade, the mirrored MT5 hedge stop is on the opposite side. Do not enter the NT stop/target distances as though they were MT5 stop/target distances without reversing the hedge relationship.

## Target risk from R:R

When Target reward is supplied, Target risk is auto-calculated from the stop/target R:R:

```text
Target risk = Target reward × Stop ticks ÷ Target ticks
```

Example: stop `200`, target `400`, target reward `$100` gives target risk `$50`.

## Suggested lot sizes

The calculator uses broker-provided symbol info where available:

- contract size
- volume minimum
- volume maximum
- volume step
- live bid/ask spread

It shows two suggestions:

- **Rounded down** to the broker volume step.
- **Rounded up** to the broker volume step.

Each suggestion shows:

- lot size
- margin estimate
- risk and reward before fees
- risk and reward after spread/commission assumptions

Each suggestion has its own Apply button. Applying a suggested lot only copies that value into the dashboard settings box. You must still click **Save settings** to persist it.

## Tick reminder

One calculator tick is `0.01` XAUUSD price units.

GC/MGC ticks are `0.10`, so:

```text
200 XAUUSD ticks = 2.00 XAUUSD = 20 GC/MGC ticks
510 XAUUSD ticks = 5.10 XAUUSD = 51 GC/MGC ticks
```

## Margin formula

The calculator margin fallback is:

```text
margin = approx_price × contract_size × lot_size ÷ leverage
```

At XAUUSD `4800`, contract size `100`, lot size `0.01`, and leverage `200`:

```text
4800 × 100 × 0.01 ÷ 200 = 24
```

So the estimated margin is about `$24`.

## Spread and commission

Spread mode is read from dashboard settings:

- `auto`: use live MT5 bid/ask spread.
- `manual`: use Manual spread ticks.
- `off`: ignore spread in the sizing calculation.

Commission is included when **Commission enabled** is true. The calculator uses **Commission round turn / lot** from settings.

## Separation from order conversion

The calculator is intentionally XAUUSD-first for MT5 lot sizing and margin. The bridge order-conversion logic still uses the separate basis rule:

```text
basis = XAUUSD/MT5 price - GC/MGC/NT price
converted MT5 price = NT price + basis
```
