Quickchannel issue

 

I'm using QuickChannel from FX Blue (formerly mt4i.com) to share messages between experts in two different brokers.  It works fine; all messages sent from robot 1 are received by robot2 and vice versa.

As you can see below, logic is implemented on OnTick() function. My purpose is to read new quotes on each new tick and send them to the twin expert. Both experts do exactly the same; all they have is a cross channel pattern to exchange messages.

My problem is that I have much more messages than ticks, thousands of messages!!! When I remove the message system the OnTick() just runs when a new tick arrives.

 

Anyone knows how can I have the messages sent just when a new tick arrives from one side or another?

Regards

Bernabe 

void OnTick()
{
check();

last = (Ask-Bid) *MathPow(10,Digits);

if (last > max) max = last;
if (last < min) min = last;
ct++;
tot = tot + last;
aver = tot / ct;

string text = StringConcatenate("Time |", TimeToStr(ltime,TIME_SECONDS), "| last |", last, "| max |", max, "| min |", min, "| aver |", aver, "| ct |", ct, " last2 ", last2, " aver2 ", aver2, " lastT ", last+last2, " averT ", aver+aver2, "\n" );
string text2 = StringConcatenate("** obj ", obj," acuret ",CalculAcu(), " acutot ", acutot," OrderProfit() ",OrderProfit()," nLots ", OrderLots(), " acuLots ", acuLots," UnitP ", UnitP, " MN ", MagicNumber, "\n ", " OrderOpenPrice ", OrderOpenPrice(), " Top y Bottom ",TopEntry, " ", BottomEntry, " cmdN ", cmdN, " canalRx ", canalRx, " strRx ", strRx);
Comment(text2);

SendCmd(canalTx, OP_SPREAD, cmdN+1, text);
strRx = ReceiveCmd(canalRx);
string result = StringSplit(strRx,"|", 1);
if (StringToInteger(result) < 99)
doCommand(strRx);
if(Time[0] != ltime)
{
Print(text);
ltime = Time[0];
tot = 0;
ct = 0;
max = 0;
min = 99999;
}
}
 

How many messages do you see?

How do you count messages? 

How many ticks do you see?

How do you count ticks? 

 

Since ticks to each robot will be different with different timings, you need each to read all messages sent, not your current one per tick.

I know nothing about Quickchannel, but is ReceiveCmd a non-blocking call? How do you know when there is no more messages to read?

 

Supposing you passed a window handle to the other party, then the other party can trigger the OnTick any time.

To identify whether the tick is real, i.e. whether it comes from the local terminal, look for Volume[0] changes. 

Reason: