Position
class
The Position object holds data related to position.
Properties
Account Account | Gives access to all information of the account that opened the position. |
Amount double | Value of the position in lots. |
CloseOrderId string | ID of closing order (if postion was closed). |
ClosePrice double | Closing position price (for closed positions). |
CloseTime DateTime | Time when position was closed (for closed positions). |
Comment string | Returns comment for the selected position. |
CurrentPrice double | The market price obtainable from your broker. |
Exp1 double | Returns amount of base instrument part on which your position is open. Fixing when position was open. |
Exp1Close double | Returns amount of base instrument part on which your position is open. |
Exp2 double | Returns amount of counter instrument part on which your position is open. Fixing when position was open. The Exposure calculated using the amount and cross price. |
Exp2Close double | Returns amount of counter instrument part on which your position is open. For open position recalculating occurs after every new quote. If position close - return exposition fixing when position was close. The Exposure calculated using the amount and cross price. |
GroupId long | The ID of the position group. This group created when position opened by the MAM account. |
Id string | A unique number that the trading system assigns to each position. |
Instrument Instrument | Represents the information of instrument for position. |
IsGroupPart bool | Return true when position was sent by MAM account. |
MagicNumber int | Returns a magic number of chosen position. |
OpenOrderId string | Order number that opened a position. Unique number that the trading system assigns to each order. If a position opens based on an order, the position's OpenOrderId property will return the same number. |
OpenPrice double | Price at which the position was opened. |
OpenTime DateTime | Date and time the position was opened. |
Side Operation | Operation with which the position was opened (BUY or SELL). |
StopLossOrder Order | Provide acess to Stop Loss order of the current position or null if it isn't exist. |
TakeProfitOrder Order | Provide acess to Take Profit order of the current order or null if it isn't exist. |
Methods
Close () Return: bool | Close position. |
Close (double amount) Return: bool | Close part of the position. |
Close (double amount, double price, int marketRange) Return: bool | Close position with price change control |
CloseAsync (Action<bool> callback) Return: bool | Close position asynchronously. |
CloseAsync (double amount, Action<bool> callback) Return: bool | Close part of the position asynchronously. |
CloseAsync (double amount, double price, int marketRange, Action<bool> callback) Return: bool | Close position with price change control asynchronously |
GetCommission (Currency currency) Return: double | Commission amount for the position. |
GetExposition (Currency currency) Return: double | Returns amount of counter instrument part on which your position is open. For open position recalculating occurs after every new quote. If position close - return exposition fixing when position was close. The Exposure calculated using the amount and cross price. |
GetProfitExp2 () Return: double | Profit/loss calculated based on the current broker's price in counter currency. |
GetProfitGross (Currency currency) Return: double | Profit/loss (without swaps or commissions) all calculated based on the current broker's price. For open position it shows the profit/loss you would make if you close the position at the current price. If position closed, this parameter show profit/loss what trader have after closing this position. |
GetProfitNet (Currency currency) Return: double | Profit/loss calculated based on the current broker's price. For open position it shows the profit/loss you would make if you close the position at the current price. If position closed, this parameter show profit/loss what trader have after closing this position. |
GetSwaps (Currency currency) Return: double | Amounts collected/paid out by your broker when a position is rolled over to a new value date. |
GetUsedMargin (Currency currency) Return: double | Initial margin for opened position. |
RemoveStopLoss () Return: bool | Removes current stop-loss order |
RemoveStopLossAsync (Action<bool> callback) Return: bool | Removes current stop-loss order asynchronously |
RemoveTakeProfit () Return: bool | Removes current take-profit order |
RemoveTakeProfitAsync (Action<bool> callback) Return: bool | Removes current take-profit order asynchronously |
Rollback () Return: bool | Rollback position. This operation is allowed only for accounts with MasterPosition function and |
SetStopLoss (double slPrice) Return: bool | Sets a new (modifies existed) stop-loss order |
SetStopLossAsync (double slPrice, Action<bool> callback) Return: bool | Sets a new (modifies existed) stop-loss order asynchronously |
SetStopLossTrail (double slPrice) Return: bool | Sets a new (modifies existed) stop-loss order with trailing |
SetStopLossTrailAsync (double slPrice, Action<bool> callback) Return: bool | Sets a new (modifies existed) stop-loss order with trailing asynchronously |
SetTakeProfit (double tpPrice) Return: bool | Sets a new (modifies existed) take-profit order |
SetTakeProfitAsync (double tpPrice, Action<bool> callback) Return: bool | Sets a new (modifies existed) take-profit order asynchronously |