CFDs are complex instruments and come with a high risk of losing money rapidly due to leverage. -- % of retail investor accounts lose money when trading CFDs with this provider. You should consider whether you understand how CFDs work and whether you can afford to take the high risk of losing your money.

ZeroMQ used has a indicator feed data from a EA?

I am a newby ot EA’s/ MT4.

I have a complicated EA that uses multiple trade sinarios , but also implements sets of trades , so if already in a trade, the EA can start another sequence of trades if conditions allow.
Problem is , I cant keep visual track of whats happening [30 trades opening and closing] . What I want to do is send information to the chart via a single indicator using zeromq as the ‘feed’. [I have tried plotting values via the EA directly to screen but cant keep track as bars change/move, and I don’t want to write an indicators for all my custom signals and confirmations as this will be a lot of work , plus the screen will be full of false signals not ready to be considered by the EA]

So I get a ready signal in my customea.ex4 , send a ready signal to zeromq , customind.ex4 reads zeromq plots the signal ‘ready’ on the bar.

Next I get a confirm signal in my customea.ex4 , send a confirm signal to zeromq , customind.ex4 reads zeromq and plots the ‘confirm’ on the bar.

Next I send an order in my customea.ex4 , send a order signal to zeromq , customind.ex4 reads zeromq and plots the ‘order arrow’ on the bar.

I seem to be able to read the zeromq via ZMQ_SUB , in the indicator code, but cant find how to make it robust. Opening the MT4 platform , it freezes , it maybe looking fro the ZMQ_PUB which isn’t started. So how do I make it robust.

Q1 Is this even possible or is there some limitation I am going to encounter like handles/memory/objects to many/robustness/delay/ etc.?

Q2 where do I put the connection command, How do I check the connection is ready/working. [I was thinking of only reading on every new bar , 1min timeframe , so do I connect/reconnect every minute? [ I need it not crash if the ZMQ_PUB stops.]

Dodgy print code below is of the indicator.mq4

//| plottest.mq4 |
//| Copyright 2018, MetaQuotes Software Corp. |
//| |
#property copyright “Copyright 2018, MetaQuotes Software Corp.”
#property link “
#property version “1.00”
#property strict
#property indicator_chart_window
#property indicator_buffers 1
#property indicator_plots 1
//— plot Label1
#property indicator_label1 “Label1”
#property indicator_type1 DRAW_LINE
#property indicator_color1 clrRed
#property indicator_style1 STYLE_SOLID
#property indicator_width1 1
//— indicator buffers
double Label1Buffer[];

#include <Zmq/Zmq.mqh>
Context context;
Socket subscriber(context,ZMQ_SUB);

//| Custom indicator initialization function |
int OnInit()

//— indicator buffers mapping
//| Custom indicator iteration function |
int OnCalculate(const int rates_total,
const int prev_calculated,
const datetime &time[],
const double &open[],
const double &high[],
const double &low[],
const double &close[],
const long &tick_volume[],
const long &volume[],
const int &spread[])

//— return value of prev_calculated for next call
//| Timer function |
void OnTimer()
//| ChartEvent function |
void OnChartEvent(const int id,
const long &lparam,
const double &dparam,
const string &sparam)


void Read0MQ1()

int rc = subscriber.connect(“tcp://localhost:5556”);
if (rc != -1) {

// Do 10 requests, waiting each time for a response
for(int request_nbr=0; request_nbr!=10 && !IsStopped(); request_nbr++)
// ZmqMsg request(“Hello”);
// PrintFormat(“Sending Hello %d…”,request_nbr);
// socket.send(request);

  // Get the reply.
  ZmqMsg update;
  string replystring=update.getData();
  if (replystring != "") {
  Print(replystring+"- Received on try no "+request_nbr);

//error no connection



A post was merged into an existing topic: Python, ZeroMQ & MetaTrader – Pricing, Trading & Transaction Reporting (ZMQ Series)