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

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

tradeUpdatePool()

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.

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);
  tradeUpdatePool(); // adapt pool trades
}

See also:

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

► latest version online