Margin Estimations
What Is the 'GetEstimatedMargin()' Method¶
In cTrader Desktop 4.5, we have added estimated margin calculations to the Automate API. In other words, you can now use a method to check how much of your margin will be used by a new position or an order.
How Margin Estimations Work¶
To calculate the estimated margin, call the Symbol.GetEstimatedMargin()
method and pass the required arguments, namely the trade type (either buy or sell) and the order volume.
1 2 3 4 |
|
As GetEstimatedMargin()
is an interface method, you can use it with any Symbol
/ SymbolInfo
objects as shown below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
|
Note
During backtesting/optimization, the GetEstimatedMargin()
method will return the estimated margin without taking account exposure into consideration.
Last update: December 22, 2022