Posted By: qin
difference between MarginTotal, MarginVal ? - 01/26/23 03:07
Dear there, I wonder what is the difference between MarginTotal, MarginVal. I did some tests and found that they returned the same values.
Any idea?
Posted By: juanex
Re: difference between MarginTotal, MarginVal ? - 01/26/23 15:54
MarginTotal:
The current allocated margin of all open trades of the strategy, calculated through MarginCost under the assumption of a constant margin requirement of open trades. This can be different in live trading when brokers adapt the margin requirement to the market situation or asset price. A margin call is simulated in test and training mode when Capital > 0 and Equity - MarginTotal reaches zero.
MarginVal:
The current allocated margin of the account. The account is threatened by a margin call when Equity - MarginVal approaches zero. In live trading, this parameter is updated from the broker API if available; in test and training it follows MarginTotal.
P.S. both definitions of the variables can be found in the Zorro manual
Posted By: qin
Re: difference between MarginTotal, MarginVal ? - 01/26/23 23:53
I read the manual but still confused. could tell me when they return different values.
Posted By: juanex
Re: difference between MarginTotal, MarginVal ? - 01/27/23 15:40
They would return different values when you are trading with a live account, based on the margin requirements of your broker.
for example, let's say that your margin rules while testing is 25% of the initial position, while your broker's are actually 50%. It is possible that while you test you may experience some drawdowns but never a margin call, yet when you go live you can have a drawdown and then get a margin call from your broker.