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.
- For implementing a complete broker interface instead of only a buy/sell function, a broker plugin can be written.
- All trade variables f.i. for determining the asset and algo are available in the order function.
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);
Brokers, enterShort/Long, exitShort/Long, msg, login, API, broker plugin, user supplied functions