//+------------------------------------------------------------------+ //| RTReqBroker.mq4 | //| Copyright 2017, Li Ding | //| dingmaotu@126.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2017, Li Ding" #property link "dingmaotu@126.com" #property version "1.00" #property strict #property show_inputs //+------------------------------------------------------------------+ //| This example comes from the "Load Balancing Pattern" | //| The original example creates threads for workers and spawn them | //| in the broker main thread. MetaTrader Terminal does not support | //| thread creation. So we split the broker and worker code to two | //| scripts. Since we splitted the code, we need to wait all workers | //| connect. | //| This is the broker part. | //+------------------------------------------------------------------+ #include input int InpNumberWorkers=5; //+------------------------------------------------------------------+ //| Custom routing Router to Mama (ROUTER to REQ) (adapted from C++) | //| Olivier Chamoux | //+------------------------------------------------------------------+ void OnStart() { Context context("rtreq"); Socket broker(context,ZMQ_ROUTER); broker.bind("inproc://rtreq"); string identities[]; ArrayResize(identities,InpNumberWorkers); // Wait until InpNumberWorkers workers connected for(int i=0; i