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.
- If an order function is defined in the script, it
replaces the trade functions of the selected broker plugin.
- 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