# Calculate Forex Position and Margin requirements

Posted on 25. March 2019 in [ softwaredev, trading ]If you go for manual forex trading you need to calculate the correct position size. The position size and margin requirement depends on your risk and money management and needs to be calculated for every trade again.

Let’s have a look at the formulas to calculate the risk, position size, pip value and margin.

## Account Risk

First we need to have a look at our account size, how much we can risk and how far our stop loss is for the next trade.

Variable | Value |
---|---|

Account denomination | EUR |

Account balance | 10,000.00 |

Risk in % | 2 |

Stop Loss in Pips | 12 |

## Instrument

Let’s have a look at the instrument we want to trade. In our first example we use EUR/USD. Note that the base of the instrument is equal to the account denomination. **EUR**/USD == EUR.

Variable | Value |
---|---|

Instrument | EUR/USD |

Contract Size | 100,000 |

Point | 0.0001 |

Exchange Rate Ask EUR/USD | 1.1201 |

## Formulas

### Risk

The formula for the risk in account denomination is common:

That is **200 EUR** risk for the next trade.

### Pip Value

Ok, now we need to calculate the pip value:

The pip value is **8.9277** EUR.

### Lot & Units

As we know that we want to risk 200 Euro for a 12 pip stop loss we now can calculate the lot size:

The Lot size is **1.86684**. Or if you want to have that value in units you need to multiply it by the contract size value.

### Margin Requirement

To get the required margin for your trade you need the margin ratio and the margin exchange rate.

Variable | Value |
---|---|

Margin Ratio | 30:1 |

Margin Exchange Rate EUR/EUR | 1.0000 |

The required margin for this trade is **6,222.80** EUR.

## Base currency != Account denomination

But what if the base of the currency pair does not equal to your account denomination like in **GBP**/JPY. Don’t worry, it’s simple.

The only thing we need is the Ask price of EUR/JPY as our exchange rate and put that in the formula for the pip value. Also note that the point size is 0.01 for JPY pairs.

Variable | Value |
---|---|

Instrument | GBP/JPY |

Contract Size | 100,000 |

Point | 0.01 |

Exchange Rate Ask EUR/JPY | 126.525 |

### Pip Value

The pip value equals to **7.9035 EUR**.

### Lot & Units

The lot size is **2.10877**. In units this is **210877**.

### Margin Requirement

Variable | Value |
---|---|

Margin Ratio | 30 |

Margin Exchange Rate ASK GBP/EUR | 1.32389 |

The margin requirement for the GBP/JPY trade is **9,305.93** Euro.

## Is there an app?

That is a lot of math for one trade and as the markets are fast in lower timeframes I don’t want to do the math in my head. So I decided to put in some work and developed a small application for this. I call it **FX Calculator** and it is a macOS app.

Or you can download the source code of FX Calculator on github and compile it yourself.