# Calculating cost of a trade

102
2015.08.31 00:02

Hi

I have a system that can buy several lots of the currency at different times. What i would like to know is what the total trade has cost. For example trading EURUSD and buying at 4 different spots and selling all in one shot. Is there a way of doing the calculations? i will have been paying the spread five times, right?

How can i calculate this when the position is closed?

Thanks!

17865
2015.08.31 13:06

It's not clear what is the cost? Strictly speaking there can be several different definitions of the cost, for example, required margin for the lots, possible loss (from average open price to your stoploss level).

If your understanding of the cost is a kind of "commission" or "overheads", then - yes - the cost is the total spread and swaps.

Moderator
30704
2015.08.31 13:55
dudknoen:

Hi

I have a system that can buy several lots of the currency at different times. What i would like to know is what the total trade has cost. For example trading EURUSD and buying at 4 different spots and selling all in one shot. Is there a way of doing the calculations? i will have been paying the spread five times, right?

How can i calculate this when the position is closed?

Thanks!

You will have to pay the spread 1 time, for the total traded volume.
102
2015.08.31 20:16

Its the commision that i had in mind when posting. That is, the spreads.

I calculate this when i close my position

double cpt =  SymbolInfoInteger(Symbol(),SYMBOL_SPREAD) * open_lot * value_per_point;

But dont i pay the spread when i buy into my postion as well? I buy for the bid but the values immediately after i have bought is the value from the ask? That way i have paid the spread, or im i completely lost here?

Is it possible to access that infomration after the Position is closed?

Thank you!

17865
2015.08.31 20:33

You pay the spread at the moment when you open new order/position. Every new entry deal starts with a loss equal to the spread (for corresponding lot size). Of course this is the case only if spreads are part of specification - there may be accounts without spread (but with some kind of commission). MT5 provides spread history, MT4 does not.

As I said, if you're interested in "commission" then do not forget about swaps (if your trades roll over a day boundary) - they can be negative.