MT5.ModifyOrder: Modify order

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/Source_MT5.R

Description

Modification of characteristics of pending orders. To modify an previously opened position use MT5.ModifyPosition() instead.

It can be used targeting only one or several orders at once. See details.

Use MT5.ShowOrders() or look at "Trade" tab, to fetch iTickets.

Usage

1
MT5.ModifyOrder(iTicket = 0, fPrice = 0, fStop = 0, fGain = 0, ...)

Arguments

iTicket

integer; order's ticket.

fPrice

numeric; target price. To no change use fPrice = 0 or omit.

fStop

numeric; target stop loss. To remove stop loss use fStop = -1. To no change use fStop = 0 or omit.

fGain

numeric; target stop gain. To remove stop gain use fGain = -1. To no change use fGain = 0 or omit.

...

data.frame; using data.frame for several orders at once. Columns name should be the same of the arguments above. See examples.

Details

It need to choose a data.frame or just one order at time to modify. Not both. An attempt using both a warning will pop up and data.frame will be used.

Value

Returns TRUE if order was successful modified, no changes and otherwise will return FALSE.

If used data.frame it will return logical vector.

Author(s)

Guilherme Kinzel, guikinzel@gmail.com

See Also

MT5.SingleOrder(), MT5.MultipleOrders(), MT5.ShowOrders(), MT5.ShowPositions(), MT5.ClosePosition(), MT5.DeleteOrder(), MT5.ModifyPosition()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## Not run: 
## Below examples of an existing buy limit order (684701334)

MT5.ModifyOrder(iTicket = 684701334, fPrice = 25.00) ## Modifying the trigger price to open a limit order
MT5.ModifyOrder(iTicket = 684701334, fStop = 24.00) ## A single modification
MT5.ModifyOrder(iTicket = 684701334, fStop = 24.00, fGain = 26.00) ## You can modify both at same time
MT5.ModifyOrder(iTicket = 684701334, fPrice = 25.00, fStop = 24.00, fGain = 26.00) ## Or everything at same time
MT5.ModifyOrder(684701334, fStop = -1) ## Remove stop, omitting iTicket

## The trader can use data.frame for multiple modifications in different orders. Columns name should be the same
## of the arguments of a single modification (check used arguments above). See example below

df_modify <- data.frame(iTicket = 687356562, fPrice = 21, fStop = 20)
df_modify <- rbind(df_modify, data.frame(iTicket = 687357112, fPrice = 18, fStop = 17))
MT5.ModifyOrder(... = df_modify) ## Modify two orders at same time


## End(Not run)

Kinzel/mt5r documentation built on March 25, 2021, 9:57 p.m.