Show all active positions displayed on the "Trade" tab. For active orders use MT5.ShowOrders() instead.

MT5.ShowPositions()

Value

Returns Data.frame \([nx8]\), with follow informations:

  • sSymbol {character}: position's symbol.

  • iCmd {int} position's type, for more see references:

    • 0: POSITION_TYPE_BUY

    • 1: POSITION_TYPE_SELL

  • fVolume {numeric}: position's volume.

  • fPrice {numeric}: position's price.

  • fStop {numeric}: position's stop loss. For stop loss not set is returned 0.

  • fGain {numeric}: position's stop gain. For stop gain not set is returned 0.

  • fProfit {numeric}: position's profit/loss. Same displayed on the "Trade" tab.

  • iTicket {int}: position's ticket. Same displayed on the MT5's "Trade" tab. Used in other functions in mt5R package.

References

https://www.mql5.com/en/docs/constants/tradingconstants/positionproperties

See also

Examples

if (FALSE) { MT5.ShowPositions() ## Returns ## sSymbol iCmd fVolume fPrice fStop fGain fProfit iTicket ## 1 CADJPY 1 0.01 81.09000 0.0000 0 0.47 766491 ## 2 CADJPY 0 0.01 81.11700 0.0000 0 -1.00 766490 ## 3 EURUSD 0 0.01 1.22592 0.0000 0 0.77 766488 ## 4 NZDUSD 0 0.10 0.71160 0.7106 0 29.50 763964 }