Discussion of article "A DLL-free solution to communicate between MetaTrader 5 terminals using Named Pipes" - page 2

 
angevoyageur:
See http://forum.mql4.com/33307
Thank you for the link.
 

When I´m trying to create the NamePipe in an Expert (in function OnInit() or OnTick()), I get an "Access Violation Error". After debugging they said me, the error is in the function CreateNamedPipeW

If I create the NamePipe in a script, that works correctly.

What is the problem? 

 

Hello,

Thanks for your article. I did a similar work on my own EAs. I started to publish post on my blog :http://expertadvisor-blog.com/mirror-ea/

Mirror EA
Mirror EA
  • 2015.03.27
  • expertadvisor
  • expertadvisor-blog.com
One of my friends asked me to make a mirror account EA for him. He wanted to take advantage of bonus deposit with hedging technique. He opened two accounts. Deposit on both. The broker offer him a bonus on his deposit. Open a buy position on account A and sell position on account B at the same price. With this technique, theoretically, the...
 

very very good .

thank you .

 
Hi, is this still a working product? If not, can it be updated to work under the latest MT5 build? Right now it's throwing an 'Access Violation'
 

I also faced access violation errors when calling the methods writeTick, readTick... and so on. Find the  fixed CNamedPipes file attached

I also added the WriteDouble Method to the CNamedPipe Class:

#import "kernel32.dll"
...
int WriteFile(ulong fileHandle,double &var,int bytes,int &numOfBytes,ulong overlapped);
...
#import

...

bool CNamedPipe::WriteDouble(double data)
  {
   int data_size = sizeof(data);
//--- check parameters
   if(!data || data_size<1) return(false);

//--- send data
   int written;
   if(!WriteFile(hPipe,data,data_size,written,NULL) || written!=data_size)
      return(false);
//--- ok
   return(true);
  }


Side Note: To read/write on Client Side (e.g from another Metatrader Terminal ), I just used the standard MQL5 FilePipe Library. Examples how to use them can be downloaded here: 


https://www.mql5.com/en/articles/503

Communicating With MetaTrader 5 Using Named Pipes Without Using DLLs
Communicating With MetaTrader 5 Using Named Pipes Without Using DLLs
  • www.mql5.com
Many developers face the same problem - how to get to the trading terminal sandbox without using unsafe DLLs. One of the easiest and safest method is to use standard Named Pipes that work as normal file operations. They allow you to organize interprocessor client-server communication between programs. Take a look at practical examples in C++ and MQL5 that include server, client, data exchange between them and performance benchmark.
Files:
Reason: