記事"名前つきパイプを使用したMetaTrader 5端末間コミュニケーションにDLLを使用しないソリューション"についてのディスカッション - ページ 3

 
mql4/5にはマルチスレッドの可能性がないことを考慮すると、mql4/5でサーバーを作るのは、ブラウン管テレビを見て いるようなものだ(動いているように見えるが、感覚は違う。 だから、別のサーバーを書いて、mqlプログラム間のデータ転送に使ったほうがいい。
 
こんにちは。もしそうでなければ、最新のMT5ビルドで動作するようにアップデートできますか?現在、「アクセス違反」が発生しています。
 

また、writeTick、readTick...などのメソッドを呼び出す際にアクセス違反のエラーに直面しました。修正したCNamedPipesファイルを添付します

また、 CNamedPipe クラスにWriteDoubleメソッドを追加しました

#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);
//--- パラメータをチェックする
   if(!data || data_size<1) return(false);

//--- データを送信する
   int written;
   if(!WriteFile(hPipe,data,data_size,written,NULL) || written!=data_size)
      return(false);
//--- OK
   return(true);
  }


補足:クライアント側(他のメタトレーダー端末など)からの読み書きには、標準のMQL5 FilePipe Libraryを使いました。使用例はこちらからダウンロードできます:


https://www.mql5.com/ja/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.
ファイル:
 
素晴らしい作品
 
久しぶりの更新です。インジケーターをチャートに付けると「アクセス違反」のエラーが出ます。どうしようもないのでしょうか。