Download MetaTrader 5
To add comments, please log in or register
Sell products via the Market and track your sales statistics
Bernabe 2014.07.11 08:22 

I'm using QuickChannel from FX Blue (formerly 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?



void OnTick()

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

if (last > max) max = last;
if (last < min) min = last;
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);

SendCmd(canalTx, OP_SPREAD, cmdN+1, text);
strRx = ReceiveCmd(canalRx);
string result = StringSplit(strRx,"|", 1);
if (StringToInteger(result) < 99)
if(Time[0] != ltime)
ltime = Time[0];
tot = 0;
ct = 0;
max = 0;
min = 99999;
Drazen Penic
Drazen Penic 2014.07.11 10:20  

How many messages do you see?

How do you count messages? 

How many ticks do you see?

How do you count ticks? 

whroeder1 2014.07.11 14:04  

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?

Halley 2014.07.11 16:39  

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. 

To add comments, please log in or register