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

Resizes or updates parameters of an open or pending trade.

tradeUpdate()

Updates pool trades to the current open virtual trades in virtual hedging mode. Automatically performed once per bar. 

Parameters:

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.

Returns:

0 when the operation failed, otherwise nonzero.

Remarks:

Example:

function double_all_trades()
{
  if(Hedge < 4) return;
  for(open_trades) 
    if(TradeIsVirtual))
      tradeUpdate(ThisTrade,2*TradeLots,0,0,0);
  tradeUpdate(); // adapt pool trades
}

See also:

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

► latest version online