# Financial Calculations & Definitions



# Spread

## 1. Definition

**Spread** is the difference between the Ask price (Buy price) and the Bid price (Sell price) of an instrument at a specific moment.

Spread represents the immediate transaction cost paid by the client when opening a position.

## 2. Formula  


[![Screenshot 2026-03-02 at 14.18.36.png](https://wiki.wi.services/uploads/images/gallery/2026-03/scaled-1680-/screenshot-2026-03-02-at-14-18-36.png)](https://wiki.wi.services/uploads/images/gallery/2026-03/screenshot-2026-03-02-at-14-18-36.png)

```
Spread = Ask - Bid
```

Where:

- **Ask** — price displayed in the Buy button
- **Bid** — price displayed in the Sell button

## 3. Example  


[![image.png](https://wiki.wi.services/uploads/images/gallery/2026-03/scaled-1680-/DoMimage.png)](https://wiki.wi.services/uploads/images/gallery/2026-03/DoMimage.png)

Spread is measured in the **instrument price unit**.

For instruments quoted against USD (e.g. USOUSD, WTI, BRENT, BTCUSD):

```
Unit = USD
```

Example:

```
Ask = 72.68
Bid = 72.36

Spread = 72.68 - 72.36 = 0.32
```

Result: **0.32 USD**

## 4. Configuration

[![Screenshot 2026-03-02 at 14.56.32.png](https://wiki.wi.services/uploads/images/gallery/2026-03/scaled-1680-/screenshot-2026-03-02-at-14-56-32.png)](https://wiki.wi.services/uploads/images/gallery/2026-03/screenshot-2026-03-02-at-14-56-32.png)

Spread is configurable per symbol in CRM.

### Location:

```
(CRM_URL)/ms/trading/configuration
```

Configuration is done **separately for each symbol**.

### Field:

**Spread**

Example (from USO/USD configuration):

- Spread = 0.32

# Static used margin

## Overview

**Static Used Margin** is an optional **fixed margin amount** that can be applied to a trading position **in addition to the standard margin**.

This value is stored **per order** and **per position** and is included in the **account’s total used margin calculation**.

If not specified, **static used margin defaults to `0`**.

---

# Business Purpose

Static used margin exists to support cases where **standard leverage-based margin alone is insufficient**.

<table id="bkmrk-purpose-description-"><thead><tr><th>Purpose</th><th>Description</th></tr></thead><tbody><tr><td>**Regulatory requirements**</td><td>Some jurisdictions require an additional fixed margin per position regardless of leverage.</td></tr><tr><td>**External risk rules**</td><td>Liquidity providers or internal risk engines may require an additional fixed margin component.</td></tr><tr><td>**Product-specific margin models**</td><td>Certain trading products may require a minimum margin per position.</td></tr><tr><td>**Operational risk control**</td><td>Allows manual or automated systems to increase margin requirements for specific trades.</td></tr></tbody></table>

---

# Impact on Client Accounts

When static used margin is applied:

- **Used margin increases**
- **Free margin decreases**
- **Margin level decreases**
- **Margin call / liquidation may trigger earlier**

This provides **additional risk protection** for the platform.

---

# Margin Calculation

### Position Used Margin Formula

```
Used Margin = Leverage Margin + Static Used Margin
```

Where:

### Leverage Margin

```
Leverage Margin = Position Value ÷ Leverage
```

Example:

<table id="bkmrk-parameter-value-posi"><thead><tr><th>Parameter</th><th>Value</th></tr></thead><tbody><tr><td>Position Value</td><td>€10,000</td></tr><tr><td>Leverage</td><td>1:10</td></tr><tr><td>Leverage Margin</td><td>€1,000</td></tr><tr><td>Static Used Margin</td><td>€200</td></tr></tbody></table>

Result:

```
Used Margin = 1000 + 200 = €1,200
```

# Defaults

<table id="bkmrk-field-default-static"><thead><tr><th>Field</th><th>Default</th></tr></thead><tbody><tr><td>static\_used\_margin</td><td>0</td></tr></tbody></table>

If not set:

```
Used Margin = Leverage Margin

```

---

# Example Scenario

A broker introduces **minimum margin per trade = €500**.

Trade parameters:

<table id="bkmrk-parameter-value-posi-1"><thead><tr><th>Parameter</th><th>Value</th></tr></thead><tbody><tr><td>Position Value</td><td>€4,000</td></tr><tr><td>Leverage</td><td>1:20</td></tr></tbody></table>

Leverage Margin:

```
4000 / 20 = €200
```

Minimum margin required = €500

Static margin applied:

```
static_used_margin = 300
```

Final used margin:

```
200 + 300 = €500
```

---

# Summary

<table id="bkmrk-attribute-descriptio"><thead><tr><th>Attribute</th><th>Description</th></tr></thead><tbody><tr><td>Type</td><td>Fixed additional margin</td></tr><tr><td>Level</td><td>Per position</td></tr><tr><td>Default</td><td>0</td></tr><tr><td>Purpose</td><td>Regulatory / risk / product margin rules</td></tr><tr><td>Effect</td><td>Increases used margin and reduces free margin</td></tr></tbody></table>

# Take profit / Stop loss - Distances and Validation

## Overview

Take Profit (**TP**) and Stop Loss (**SL**) can be set when:

- opening a **new order**
- **modifying** an existing order

When TP or SL is enabled, the platform:

1. **Automatically fills default values**
2. **Validates minimum distance** from the reference price
3. **Clears the value** if the option is disabled

The rules depend on the **symbol group**.

<table id="bkmrk-symbol-group-distanc"><thead><tr><th>Symbol group</th><th>Distance type</th></tr></thead><tbody><tr><td>**Crypto**</td><td>Percentage</td></tr><tr><td>**Other instruments** (Forex, indices, commodities, etc.)</td><td>Pips / points</td></tr></tbody></table>

---

# Symbol Groups

The system determines the rule set based on the **symbol group**.

<table id="bkmrk-group-behavior-crypt"><thead><tr><th>Group</th><th>Behavior</th></tr></thead><tbody><tr><td>**Crypto**</td><td>Percentage-based TP/SL</td></tr><tr><td>**Other groups**</td><td>Pip / point-based TP/SL</td></tr></tbody></table>

---

# Default TP / SL Values

When a user enables **Take Profit** or **Stop Loss**, the system automatically inserts a default value.

<table id="bkmrk-asset-class-side-def"><thead><tr><th>Asset class</th><th>Side</th><th>Default Take Profit</th><th>Default Stop Loss</th></tr></thead><tbody><tr><td>**Crypto**</td><td>BUY</td><td>Ask + 1%</td><td>Ask − 1%</td></tr><tr><td>**Crypto**</td><td>SELL</td><td>Bid − 1%</td><td>Bid + 1%</td></tr><tr><td>**Other instruments**</td><td>BUY</td><td>Ask + 100 pips</td><td>Ask − 100 pips</td></tr><tr><td>**Other instruments**</td><td>SELL</td><td>Bid − 100 pips</td><td>Bid + 100 pips</td></tr></tbody></table>

### Important

- Defaults are intentionally **larger than the minimum allowed distance**.
- This ensures automatically generated TP/SL values are **always valid**.

---

# Minimum Distance

TP and SL must be placed at least a **minimum distance** away from the reference price.

<table id="bkmrk-asset-class-minimum-"><thead><tr><th>Asset class</th><th>Minimum distance</th></tr></thead><tbody><tr><td>**Crypto**</td><td>**0.1%** of reference price</td></tr><tr><td>**Other instruments**</td><td>**1 pip**</td></tr></tbody></table>

The system prevents users from placing TP or SL inside this restricted zone.

---

# Validation Rules

### BUY Orders

<table id="bkmrk-rule-take-profit-mus"><thead><tr><th>Rule</th></tr></thead><tbody><tr><td>Take Profit must be **above** the reference price</td></tr><tr><td>Stop Loss must be **below** the reference price</td></tr></tbody></table>

Additionally:

- TP must be at least **minimum distance above**
- SL must be at least **minimum distance below**

---

### SELL Orders

<table id="bkmrk-rule-take-profit-mus-1"><thead><tr><th>Rule</th></tr></thead><tbody><tr><td>Take Profit must be **below** the reference price</td></tr><tr><td>Stop Loss must be **above** the reference price</td></tr></tbody></table>

Additionally:

- TP must be at least **minimum distance below**
- SL must be at least **minimum distance above**

---

# Reference Price

The **reference price** used for TP/SL calculation depends on context.

<table id="bkmrk-context-order-type-r"><thead><tr><th>Context</th><th>Order type</th><th>Reference price</th></tr></thead><tbody><tr><td>New order</td><td>MARKET</td><td>Current **Ask** for BUY, **Bid** for SELL</td></tr><tr><td>New order</td><td>LIMIT</td><td>Limit price entered in the form</td></tr><tr><td>Modify order</td><td>MARKET</td><td>Order execution price</td></tr><tr><td>Modify order</td><td>LIMIT</td><td>Updated limit price (if edited), otherwise existing order price</td></tr></tbody></table>

---

# Example Calculations

### Crypto Example

Reference price:

```
BTC = 50,000
```

<table id="bkmrk-value-result-default"><thead><tr><th>Value</th><th>Result</th></tr></thead><tbody><tr><td>Default TP</td><td>50,500</td></tr><tr><td>Default SL</td><td>49,500</td></tr><tr><td>Minimum distance</td><td>50</td></tr></tbody></table>

---

### EUR/USD Example

Reference price:

```
Ask = 1.0850
```

<table id="bkmrk-value-result-default-1"><thead><tr><th>Value</th><th>Result</th></tr></thead><tbody><tr><td>Default TP</td><td>1.0950</td></tr><tr><td>Default SL</td><td>1.0750</td></tr><tr><td>Minimum distance</td><td>0.0001</td></tr></tbody></table>

---

### USD/JPY Example

Reference price:

```
Ask = 150.25
```

<table id="bkmrk-value-result-default-2"><thead><tr><th>Value</th><th>Result</th></tr></thead><tbody><tr><td>Default TP</td><td>151.25</td></tr><tr><td>Default SL</td><td>149.25</td></tr><tr><td>Minimum distance</td><td>0.01</td></tr></tbody></table>

---

# Where These Rules Apply

## Order Form (New Orders)

When creating a new order:

- Default TP/SL values are inserted when enabled
- Validation ensures minimum distance rules are respected
- TP/SL values are cleared when disabled

---

## Modify Order

When editing an existing order:

- Default TP/SL values follow the same rules
- Reference price is based on the order price
- Validation rules remain identical

---

# Key Principles

The system follows three main principles:

1. **Automatic defaults**  
    When TP/SL is enabled, reasonable default levels are provided.
2. **Minimum distance protection**  
    TP/SL cannot be placed too close to the reference price.
3. **Consistency across workflows**  
    The same rules apply when creating and modifying orders.

---

# Summary

<table id="bkmrk-feature-crypto-other"><thead><tr><th>Feature</th><th>Crypto</th><th>Other Instruments</th></tr></thead><tbody><tr><td>Default TP</td><td>±1%</td><td>±100 pips</td></tr><tr><td>Default SL</td><td>∓1%</td><td>∓100 pips</td></tr><tr><td>Minimum distance</td><td>0.1%</td><td>1 pip</td></tr><tr><td>Reference price</td><td>Ask / Bid</td><td>Ask / Bid</td></tr></tbody></table>

Defaults are intentionally **larger than the minimum allowed distance**, ensuring automatically generated TP/SL values always pass validation.

# Trading Account Metrics

This section describes the financial and margin properties displayed in the **trading account panel**. These metrics represent the current state of a trader’s account, including capital, open position performance, and margin usage.

Displayed properties:

```
Balance
On Hold (displayed if exists)
Equity
Profit
Used Margin (displayed if exists)
Free Margin
Margin Level (displayed if Used Margin exists)
Leverage
```

---

# 1. Balance

#### Description

Balance represents the **total funds in the trading account after all closed operations**.

Balance reflects **realized results only** and does **not include floating profit or loss from open positions**.

Opening a position does **not change Balance**.

---

#### Balance Changes When

- deposit is completed
- withdrawal is completed
- trade is closed
- swap is charged
- commission is charged
- manual adjustment is made

---

#### Formula

```
Balance =
Deposits
+ Closed Profits
- Closed Losses
- Completed Withdrawals
- Commissions
- Swaps
+ Adjustments
```

Simplified:

```
Balance = Previous Balance + Realized PnL
```

---

# 2. On Hold

#### Description

On Hold represents **funds temporarily reserved for pending financial operations**, such as withdrawal requests.

These funds are excluded from the amount available for trading until the operation is completed or cancelled.

---

#### Display Rule

```
Displayed only if On Hold > 0
```

---

## Example

```
Balance = 10 000
On Hold = 3 000
```

Funds available for trading:

```
Available Balance = 7 000
```

---

# 3. Equity

#### Description

Equity represents the **current real-time value of the account**, including floating profit or loss from open positions.

Equity changes continuously as market prices move.

It is the **primary value used for margin risk calculations**.

---

#### Formula

```
Equity = (Balance − On Hold) + Profit
```

Where:

```
Profit = Floating PnL from open positions
```

---

# 4. Profit

#### Description

Profit represents the **unrealized profit or loss from open positions**.

It updates continuously based on market price changes.

Positive values represent **profit**, negative values represent **loss**.

---

# 5. Used Margin

#### Description

Used Margin represents the **total collateral required to maintain all open positions**.

Margin is not a cost and does not reduce the account balance. It represents funds temporarily reserved by the trading engine to support open positions.

---

#### Display Rule

```
Displayed only if Used Margin > 0
```

---

#### Total Used Margin

```
Used Margin = sum(margin of all open positions)
```

---

# 6. Free Margin

#### Description

Free Margin represents the **amount of funds available to open new positions**.

Free Margin decreases when:

- new positions are opened

---

#### Formula

```
Free Margin = Equity − Used Margin
```

---

# 7. Margin Level

#### Description

Margin Level represents the **ratio between equity and used margin**, expressed as a percentage.

It is the **primary indicator of account risk** and determines when margin call or stop-out conditions occur.

---

#### Display Rule

```
Displayed only if Used Margin > 0
```

---

#### Formula

```
Margin Level (%) = (Equity / Used Margin) × 100
```

---

# 8. Leverage

#### Description

Leverage defines the **maximum trading exposure relative to the trader’s capital**.

Higher leverage reduces the margin required to open positions.

---

#### Example

```
Leverage = 1:100
```

Meaning the trader can control:

```
100 units of market exposure for every 1 unit of capital
```

---

# Account Calculation Relationships

The core account metrics are calculated using the following relationships:

```
Profit = Floating PnL

Equity = (Balance − On Hold) + Profit

Used Margin = sum(position margins)

Free Margin = Equity − Used Margin

Margin Level (%) = (Equity / Used Margin) × 100

```

# Price Delta

## Overview

**Price Delta** is a mechanism to simulate controlled price movement for a symbol over a defined time interval.

The system:

- Applies a **fixed price shift (in pips)** during a selected period
- Smoothly transitions into and out of this shift
- Prevents unrealistic instant price jumps

This feature is primarily used for:

- testing trading scenarios
- simulating volatility
- validating risk, margin, and liquidation logic

---

## Core Concepts

### 1. Time Range (From / To)

Defines the **main active interval** where the full price change is applied.

- **From** — start time of full delta
- **To** — end time of full delta

During this interval:

> Price is shifted by the full configured delta

---

### 2. Price Delta (Pips)

Defines the magnitude of the price change.

- Positive → price increases
- Negative → price decreases

**Formula:**

```
Adjusted Price = Base Price ± Delta
```

---

### 3. Smooth Change Steps

Defines how many incremental steps are used to **gradually apply and remove** the delta.

- Steps are applied:
    
    
    - before the main interval
    - after the main interval
- Prevents sharp jumps in the chart

---

### 4. Step Duration

Defines how long each smoothing step lasts.

- Unit: minutes
- Total smoothing duration =
    
    ```
    steps × step_duration
    ```

---

## Full Behavior Model

The system consists of **3 phases**:

---

### 1. Pre-Smoothing Phase

- Starts before `From`
- Price gradually moves from:
    
    ```
    0 → full delta
    ```

---

### 2. Active Phase

- Between `From` and `To`
- Price remains at:
    
    ```
    full delta
    ```

---

### 3. Post-Smoothing Phase

- Starts after `To`
- Price gradually returns:
    
    ```
    full delta → 0
    ```

---

## Example — Correct Timeline

### Configuration

<table id="bkmrk-parameter-value-symb"><thead><tr><th>Parameter</th><th>Value</th></tr></thead><tbody><tr><td>Symbol</td><td>EUR/USD</td></tr><tr><td>From</td><td>10:00</td></tr><tr><td>To</td><td>11:00</td></tr><tr><td>Delta</td><td>+100 pips</td></tr><tr><td>Smooth Steps</td><td>10</td></tr><tr><td>Step Duration</td><td>10 minutes</td></tr></tbody></table>

---

### Calculations

- Smoothing duration:
    
    ```
    10 × 10 min = 100 minutes
    ```

---

### Timeline

```
08:20 → smoothing starts
10:00 → full +100 pips reached
10:00–11:00 → constant +100 pips
11:00 → smoothing down starts
12:40 → price returns to normal
```

---

### Step Behavior

#### Pre-smoothing

```
08:20 → +10 pips
08:30 → +20 pips
...
09:50 → +100 pips
10:00 → full delta active
```

---

#### Active Phase

```
10:00 → 11:00
```

Price = **+100 pips**

---

#### Post-smoothing

```
11:00 → +90 pips
11:10 → +80 pips
...
12:40 → 0 pips
```

---

## Visual Model

```
Price
  |
  |          ─────────────── (+100 pips)
  |        /                \
  |      /                    \
  |_____/                      \______
      ↑                        ↑
   smoothing              smoothing
     start                  end

```

---

## Important Rules

### 1. Delta is Absolute

- Applied relative to current/base price
- Not cumulative over time

---

### 2. Smoothing Applies on Both Sides

- `N` steps before `From`
- `N` steps after `To`

---

### 3. No Instant Application

The system does NOT support:

- immediate price override
- single candle injection

All changes must follow:

> defined timeline + smoothing

---

### 4. Time Validity

- Time must be within:
    
    ```
    00:00 – 23:59
    ```
- If smoothing goes before `00:00`:  
    → it moves to the **previous day**

---

## Edge Cases

### 1. Smoothing in the Past

If:

- smoothing start time is already in the past

Then:

- steps may be skipped or not applied correctly

---

### 2. Zero Steps

If:

```
Smooth Steps = 0
```

Then:

- instant jump at `From`
- instant revert at `To`

---

### 3. Negative Delta

Works identically:

```
Delta = -50 pips
```

Result:

- price decreases smoothly
- holds lower level
- returns gradually

# Margin call & Stop out

#### Overview

This page explains how margin call, stop out, used margin, free margin, equity, and margin level work in the trading platform.

The purpose is to make the liquidation logic clear and remove confusion around thresholds such as 120%, 100%, 10%, and 0%.

#### Core Terms

##### Balance

The amount of money currently on the client’s account, excluding unrealized profit or loss from open positions.

##### Used Margin

The amount of client funds reserved as collateral for open positions.

This is the portion of funds that is locked while the position remains open.

##### Equity

The actual current value of the account, taking into account the result of open positions.

##### Formula

Equity = Balance + PNL

##### Meaning

PNL can be positive or negative.

If PNL is negative, equity decreases.

If PNL is positive, equity increases.

##### Free Margin

The amount of funds still available to absorb losses or open new trades.

##### Formula

Free Margin = Equity - Used Margin

##### Margin Level

The main risk metric used to determine when to trigger margin call and stop out.

##### Formula

Margin Level = (Equity / Used Margin) × 100%

#### What Is Margin Call

##### Definition

Margin Call is a warning level.

It means the client is approaching liquidation and the remaining free margin is becoming too low.

##### What It Means in Practice

At this point:

- the position is still open
- the account is still active
- the client can still react

##### Typical Client Actions

After a margin call, the client can:

- deposit more funds
- reduce exposure
- close positions manually

#### What Is Stop Out

##### Definition

Stop Out is the liquidation threshold.

When margin level reaches the configured stop out percentage, the platform must forcibly close the position or positions.

The purpose of stop out is to prevent further uncontrolled losses.

#### Difference Between Margin Call and Stop Out

##### Margin Call

- early warning
- position remains open
- user still has time to act

##### Stop Out

- forced liquidation
- position is closed automatically
- triggered when account risk becomes unacceptable

#### Main Formulas

##### Equity

Equity = Balance + PNL

##### Free Margin

Free Margin = Equity - Used Margin

##### Margin Level

Margin Level = (Equity / Used Margin) × 100%

#### Example

##### Initial State

Assume:

- Balance = 100
- Used Margin = 80
- PNL = 0

Then:

- Equity = 100
- Free Margin = 20
- Margin Level = 125%

Everything is normal.

#### Example: Market Moves Against the Client

##### Updated State

Now assume:

- Balance = 100
- Used Margin = 80
- PNL = -10

Then:

- Equity = 90
- Free Margin = 10
- Margin Level = 112.5%

The account is still active.

If the configured margin call is 110%, this is already close to the warning area.

#### Example: Stop Out Point at 100%

##### Stop Out Case

Now assume:

- Balance = 100
- Used Margin = 80
- PNL = -20

Then:

- Equity = 80
- Free Margin = 0
- Margin Level = 100%

If stop out = 100%, the position must be liquidated here.

##### After Liquidation

After liquidation:

- the client loses the free margin portion
- the reserved used margin is effectively preserved in account value
- the remaining balance becomes 80

This is the logic described as the safer and more regulated model.

#### Meaning of Different Stop Out Levels

##### Stop Out at 100%

This means the system liquidates the client once losses consume the free margin, but before the full account is wiped out.

##### Practical Meaning

- the client loses the available free funds
- the reserved margin is not fully destroyed
- some money remains on the balance after liquidation

This was described as the more typical approach for regulated environments.

##### Stop Out at 0%

This means the system allows losses to continue until account equity reaches zero.

##### Practical Meaning

- the client can lose the full account
- in fast or volatile markets, execution can happen worse than expected
- this can create a risk of negative balance or broker loss, especially in A-book execution

This approach was considered risky and undesirable.

##### Stop Out Above 0% but Below 100%

This is a compromise model.

For example:

- stop out = 10%
- margin call = 30%

This still allows the client to lose almost the entire balance, but it reduces edge-case risk and usually leaves a small remainder on the account. This was proposed as a practical default if a full 100% stop out is not desired.

#### Regulatory Perspective

##### Main Point

In stricter regulated logic, the broker should not allow the client account to be fully wiped out in a way that creates negative balance exposure.

A 100% stop out better protects the remaining reserved margin.

A 0% stop out is much riskier and may be unacceptable depending on regulation and business model.

#### B-Book vs A-Book Implications

##### B-Book

In B-book, the broker internalizes client trades.

##### Practical Consequence

- the broker is less exposed to market execution slippage from external liquidity
- a 0% stop out is operationally less dangerous for the company
- but it is still risky from a product and logic perspective

##### A-Book

In A-book, the broker passes trades to external liquidity providers.

##### Practical Consequence

- a 0% stop out becomes dangerous
- in a highly volatile move, the system may try to liquidate at zero, but the market price may already be worse
- this can push the client account below zero and create direct loss for the company

Because of this, a 0% stop out is especially dangerous for A-book models.

#### Recommended Default Behavior

##### Suggested Temporary Direction

Based on the discussion, the practical temporary direction is:

- Margin Call = 30%
- Stop Out = 10%

##### Reason

- avoids pure 0% liquidation logic
- reduces negative-balance edge cases
- still allows the client to use most of the balance
- leaves at least a small remainder after liquidation in many cases

#### Final Simplified Interpretation

##### If Stop Out = 100%

The client can lose only the free margin portion.

The reserved margin effectively remains as the remaining balance after liquidation.

##### If Stop Out = 0%

The client can lose the entire account.

In volatile execution models, this may even create broker-side loss risk.

##### If Margin Call &gt; Stop Out

The client receives a warning before forced liquidation.