Margin & Free Margin problem on BackTest ?

 

Hello everyone, I hope you're well.


I'm still a beginner with this fabulous Metatrader software, but I do have a small question about calculating free margin during a backtest.


For example, when I have 2 positions open at the same time, 1 long and 1 short, on an initial capital of $100 I should have a free margin of only $26,64 (using the following calculation : 100 $ - (36,68$ x 2) = 26,64$ ),  but I find that I have a larger margin than if I had only one position open.

1 position


2 position


Can someone explain to me what I've missed?

Best Reguards,
ZeroCafeine

 

This is one of those questions which is less about MetaTrader or MQL and more about general trading knowledge.

The following might help you understand ...

You should also do further research to better understand.

 
ZeroCafeine: Can someone explain to me what I've missed?

Each position uses margin.

 
ZeroCafeineFor example, when I have 2 positions open at the same time, 1 long and 1 short, on an initial capital of $100 I should have a free margin of only $26,64 (using the following calculation : 100 $ - (36,68$ x 2) = 26,64$ ),  but I find that I have a larger margin than if I had only one position open.

Margin is irrespective of trade direction, and usually also irrespective of a "hedged position" (two opposite trades), and usually both positions will have margin requirements.

Some contract specifications allow for a reduced margin requirement for a "hedged position", but that is not always the case.

 
It also depends of the broker/symbols settings, with 2 opposite positions on the same symbol, the margin can sometimes be "share" partially. See SYMBOL_MARGIN_HEDGED in the documentation.
 
ZeroCafeine: For example, when I have 2 positions open at the same time, 1 long and 1 short, on an initial capital of $100 I should have a free margin of only $26,64 (using the following calculation : 100 $ - (36,68$ x 2) = 26,64$ ),  but I find that I have a larger margin than if I had only one position open.

This is also one of the reasons why "same symbol hedging" to "recover a loss" is worse than just using a stop-loss — it consumes double the trading costs and increases the deposit load.

Using a "netting" mentality is always best to have a healthy trading attitude.

 
William Roeder #:
Each position uses margin.

Thank you very much and yes, I completely agree with you and it's quite normal that for each open position you need to use margin,

All right, if I have two open positions, then I have to use twice the margin, whatever the direction of the position,


But in my case, the margin is used as if I had a single position when in fact I have two.

 
Alain Verleyen #:
SYMBOL_MARGIN_HEDGED

Thank you very much, I'll take a look at this SYMBOL_MARGIN_HEDGED, I think I'm also going to contact my broker tomorrow to ask for an explanation 😊.

 
ZeroCafeine #: But in my case, the margin is used as if I had a single position when in fact I have two.

As I stated ... "Some contract specifications allow for a reduced margin requirement for a "hedged position", but that is not always the case."

And as Alain stated ... "It also depends of the broker/symbols settings, with 2 opposite positions on the same symbol, the margin can sometimes be "share" partially. See SYMBOL_MARGIN_HEDGED in the documentation."

 
William Roeder #:

Each position uses margin.

Thanks Fernando, I know how to calculate a margin needed a free margin on Forex with leverage, I will still take a look at your links if I can take something new, and I will return to this post if I have learned something new 🙂 

 
ZeroCafeine #: Thanks Fernando, I know how to calculate a margin needed a free margin on Forex with leverage, I will still take a look at your links if I can take something new, and I will return to this post if I have learned something new 🙂 

Look at the Contract Specifications to find out ...


Reason: