broker (int type): int
User-supplied function that is called every time when Zorro enters or exits a trade. Can be used to access external broker APIs, control external trade programs by sending keys, 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 are available in the broker function.
int broker(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, API, broker plugin