tradeUpdate(TRADE*, int NewLots, var NewStop, var NewTP, int NewLifeTime)

Resizes or updates parameters of a particular open or pending trade.


Updates pool trades to the current open virtual trades in virtual hedging mode. Automatically performed after any trade with Hedge = 4, or once per bar with Hedge = 5. Must be called by script with Hedge = 6.


TRADE* Pointer to the trade to be updated, or 0 to update pool trades to the current open virtual trades.
NewLots New number of lots, or 0 for not resizing. For reducing the trade size, partial closing must be supported by the broker; for increasing the trade size, virtual hedging must be enabled.
NewStop New stop loss limit, or 0 for no change.
NewTP New profit target, or 0 for no change.
NewLifeTime New life time in number of bars, or 0 for no change.


0 when the operation failed, otherwise nonzero.



function double_all_trades()
  if(Hedge < 4) return;
  tradeUpdatePool(); // adapt pool trades

See also:

exitTrade, enterTrade, Lots, Stop, LifeTime, TMF, Fill, Hedge

► latest version online