|
order_calc_margin
Return margin in the account currency to perform a specified trading operation.
order_calc_margin(
|
Parameters
action
[in] Order type taking values from the ORDER_TYPE enumeration. Required unnamed parameter.
symbol
[in] Financial instrument name. Required unnamed parameter.
volume
[in] Trading operation volume. Required unnamed parameter.
price
[in] Open price. Required unnamed parameter.
Return Value
Real value if successful, otherwise None. The error info can be obtained using last_error().
Note
The function allows estimating the margin necessary for a specified order type on the current account and in the current market environment without considering the current pending orders and open positions. The function is similar to OrderCalcMargin.
ID |
Description |
---|---|
ORDER_TYPE_BUY |
Market buy order |
ORDER_TYPE_SELL |
Market sell order |
ORDER_TYPE_BUY_LIMIT |
Buy Limit pending order |
ORDER_TYPE_SELL_LIMIT |
Sell Limit pending order |
ORDER_TYPE_BUY_STOP |
Buy Stop pending order |
ORDER_TYPE_SELL_STOP |
Sell Stop pending order |
ORDER_TYPE_BUY_STOP_LIMIT |
Upon reaching the order price, Buy Limit pending order is placed at StopLimit price |
ORDER_TYPE_SELL_STOP_LIMIT |
Upon reaching the order price, Sell Limit pending order is placed at StopLimit price |
ORDER_TYPE_CLOSE_BY |
Order for closing a position by an opposite one |
Example:
import MetaTrader5 as mt5
|
See also