vdemydiuk / mtapi

MetaTrader API (terminal bridge)
http://mtapi4.net/
MIT License
521 stars 281 forks source link

Matlab compatibillity on DeInit() #133

Closed KptKuck closed 5 years ago

KptKuck commented 5 years ago

I am still having trouble processing a correct end of the tester in Matlab. The evaluation of the connection state always ends in a .Net exception. Apparently the status is updated too slowly.

Is it possible to introduce an event "TesterDeInit"?

About as:

(file mtapi5.mq5)

void OnDeinit(const int reason) { MtDeInitEvent* deinit = new MtDeInitEvent(status); SendMtEvent(LAST_BAR_REACHED_DEINIT); delete deinit; Sleep(1000); // necessary for correct detection deinit(); }

does anyone have similar problems?

Ps: I start the MT5 over the commandline with config and he ends himself. That may explain the problem better. Why am I doing this? I use automatic tests with several MT5 instances. Matlab opens one, performs a test and then the MT5 closes again. So I can use 4 testers in parallel.

KptKuck commented 5 years ago

On this Picture can see the issue

image

KptKuck commented 5 years ago

I have now added the event myself. Unfortunately, it does not work anyway. Because the sleep function in DeInit does not work. It is a limitation of MQL5. Look here grafik

I have to find another way to send the event. It would make sense to send it before. A few seconds is enough.

KptKuck commented 5 years ago

ive created a workaround. That works vor me, but this problem is not solved. closing this issue