dingmaotu / mql-zmq

ZMQ binding for the MQL language (both 32bit MT4 and 64bit MT5)
Apache License 2.0
544 stars 298 forks source link

Access Violation write to 0x000.... Error #16

Closed yasasp closed 5 years ago

yasasp commented 6 years ago

Hello Dingmaotu,

I am stating to getting more and more "Access Violation write to 0x000...." Error while testing the bridge between MT4 and Python.

i am on x64 bit window 10. Can you please advise a solution?

dingmaotu commented 6 years ago

Could you post relevant code here? I need to know what kind of ZMQ topology you are using and the format of your message.

yasasp commented 6 years ago

Thanks for your time. Below is the message message format in MT4 and relevent function,

     pos="flat";
     if (OrderType() == OP_BUY) pos="long";
     if (OrderType() == OP_SELL) pos="short";
     InformPullClient(pSocket, StringFormat("%s|%f|%f|%f|%f|%f|%f|%f|%f|%f|%f|%f|%f|%f|%f|%f", pos,Bid, Ask, TotalOpenOrders(), MyPoint(),_Digits,OrderProfit(),OrderOpenPrice(),OrderStopLoss(),OrderTakeProfit(),iadxp,iadxn,iadxm,Max_Epsolon,Min_Epsolon,Epsolon_Dec));

// Inform Client void InformPullClient(Socket &pSocket, string message) {

ZmqMsg pushReply(StringFormat("%s", message)); pSocket.send(pushReply,true); // NON-BLOCKING }

dingmaotu commented 6 years ago

OK, how do you get the error? under what condition? Do you encounter error the first time the code is run? Please give me details so I can help.

yasasp commented 6 years ago

I tried to find the correlation of the error. But it appeared to be so random. It happen both in strategy tester and live mode. some times it comes with in 2~5 minutes and some times after ten minutes.

image

dingmaotu commented 6 years ago

I think you are passing invalid values (like pointers) to zmq lib functions. But I can not pin down the exact function based on current information. Have you tried to run the EA in Debug mode and check the exact line that caused this error?

fcbeta commented 6 years ago

Hello, I have a much more trivial problem with libzmq.dll, it does not load! Mt4 and window 7 enterprise x64. Naturally I checked your installation instructions. Thanks

schermata 2018-01-05 alle 18 00 59

dingmaotu commented 6 years ago

@fcbeta hi, you need to ensure that: 1. VC2015 runtime is installed; 2. 32bit DLL is used; 3. You need to enable DLL import in your EA or global configuration.

fcbeta commented 6 years ago

Hi @dingmaotu, unfortunately, the installation is correct: from downloaded folder \mql-zmq-master\Library\MT4\ to: MQL4\Libraries\libzmq.dll to: MQL4\Libraries\libsodium.dll from downloaded folder \mql-zmq-master\Include\ to: MQL4\ Include\Mql to: MQL4\ Include \Zmq finally the Script folder. I have also removed the old version VC2008 and installed the runtime VC2015

schermata 2018-01-06 alle 19 43 23

I tried on Windows XP sp3 with the same result, but with an old libzmq 2.0.10 library it works. There must be some other addiction I do not have?

schermata 2018-01-06 alle 19 31 24

yasasp commented 6 years ago

as its weekend, cannot run the live EA with debug mode. Instead, I printing all the parameters passing on tester. See below. Most of the time error generated at in the same location in a randomly. i do not see any invalid value. image

I am planning to do the debug mode when the market is open.

dingmaotu commented 6 years ago

@fcbeta you are installing 64bit vc runtime.

dingmaotu commented 6 years ago

@yasasp I am not saying the input parameters. The parameters passed to native zmq functions might be incorrect. I am waiting for your debug results.

fcbeta commented 6 years ago

@dingmaotu, I had already installed the vc2015x64 as written, but I solved by installing also the vc2015x86 runtime. Thank you for your support. Fabio

dingmaotu commented 6 years ago

@fcbeta You are welcome.

yasasp commented 6 years ago

@dingmaotu, Those values printed on the above screen-shot are the values passes to ZMQ functions. Print functions were place just before calling the ZMQ function call...