Hi, i recently wrote 2 complementary EA in order to get familiar with NamePipe.
One EA send data and the other one receive.
The transfert i made accross platform. SENDER EA is on one plateform and RECEVER EA is on an other platform. Both MT5
1. Each time i delete the SENDER EA from the chart, it take really long AND at the end i got a error message on the expert tab that say "abnormal termination". Why does it take that long ? And why do i recevice an error.
2. For the recever EA its quite the same. When i try to delete it from the chart it take way too time. But here i dont get error Again why does it take that long
The code is below and the inclue file is attached .
Thanks.
Beside that if you have advice to better my code let meknow to.
Thansk again !
// SENDER EA
//--------------------------+ INCLUDE FILE#include <CNamedPipesFixed.mqh>
CNamedPipe pipe;
//---------------------------+ CRITICAL VARIABLEstring CommaSpace = ", ";
//+------------------------------------------------------------------+//| Expert initialization function |//+------------------------------------------------------------------+intOnInit()
{
//--- create timerEventSetMillisecondTimer(10);
//---return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+//| Expert deinitialization function |//+------------------------------------------------------------------+voidOnDeinit(constint reason)
{
//--- destroy timerEventKillTimer();
pipe.Disconnect();
}
//+------------------------------------------------------------------+//| Timer function |//+------------------------------------------------------------------+voidOnTimer()
{
while (!pipe.Open(1))
Sleep(5000);
Print("connected");
while(true)
{
for(int i=PositionsTotal()-1;i>=0;i--)
{
if(PositionGetTicket(i) == 0) continue;
if(PositionGetInteger(POSITION_TYPE) > 1 ) continue;
if(PositionGetString(POSITION_SYMBOL) != ChartSymbol(0)) continue;
long ticket = PositionGetInteger(POSITION_TICKET);
long type = PositionGetInteger(POSITION_TYPE) ;
double lot = PositionGetDouble(POSITION_VOLUME);
string com = PositionGetString(POSITION_COMMENT);
double PL = PositionGetDouble(POSITION_PROFIT);
string message = (string)ticket + CommaSpace + (string)type + CommaSpace +
(string)lot + CommaSpace + com + CommaSpace + (string)PL;
pipe.WriteANSI(message);
}
//pipe.Disconnect();//if(!pipe.Open())break
}
}
//+------------------------------------------------------------------+
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Hi, i recently wrote 2 complementary EA in order to get familiar with NamePipe.
One EA send data and the other one receive.
The transfert i made accross platform.
SENDER EA is on one plateform and RECEVER EA is on an other platform.
Both MT5
1. Each time i delete the SENDER EA from the chart, it take really long AND at the end i got a error message on the expert tab that say "abnormal termination".
Why does it take that long ? And why do i recevice an error.
2. For the recever EA its quite the same. When i try to delete it from the chart it take way too time. But here i dont get error
Again why does it take that long
The code is below and the inclue file is attached .
Thanks.
Beside that if you have advice to better my code let meknow to.
Thansk again !