order (int type): int

User-supplied function that is called by the trade engine every time when Zorro enters or exits a trade. Can be used to access external broker APIs, control external trade platforms by sending key strokes or mouse clicks, or just pop up a message for manually entering or exiting a trade.


type - 1 for entering, 2 for exiting a trade.


0 when the trade could not be opened or closed, 1 otherwise.



int order(int type)
  string bs = "Buy";
  if(type == 2) bs = "Sell";
  string ls = "Long";
  if(TradeIsShort) ls = "Short";
  return msg("%s %s!",bs,ls);

See also:

Brokers, enterShort/Long, exitShort/Long, msg, login, API, broker plugin, user supplied functions

► latest version online