vdemydiuk / mtapi

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

MTConnector failed #79

Open mhdbzr opened 6 years ago

mhdbzr commented 6 years ago

Hi, I've installed MtApi.exe on 3 VPS. I get error "cannot load MTConnector.dll" in last Mt4 platform, while two other VPS were ok. What can be wrong in last VPS? // have you any suggestion how repair this problem? The only difference I found is number of installed platforms. First two vps have two platforms, but last one has 19 installed platforms. Is it effective parameter!?

vdemydiuk commented 6 years ago

MtApi does not have any restrictions of installations on different PC. The problem can be in different environment of VPS or values of MetaTrader parameters. Have you set parameter "Allow DLL imports" in Options of MetaTrader?

mhdbzr commented 6 years ago

Yes, I checked it. (if this option is unchecked, EA alerts.) Is MTConnector first dll call? EA has 2 other dll dependencies and they don't miss. What is "different environment of VPS" ?

If DLL Import not allowed : MtApi GBPCHF,H1: [ERROR] SendMtEvent: The given key was not present in the dictionary. with an alert message.

vdemydiuk commented 6 years ago

Please contact with me via skype (dem_dw). I need to check the error online on your side.

mhdbzr commented 6 years ago

I will contact you, thank you.

vdemydiuk commented 6 years ago

We have checked this problem online and found that some dlls are not present on VPS (Windows Server 2012). I have collected some dll from my PC and attached it to this issue using link to dropbox: https://www.dropbox.com/s/636u9w4l4jqjb2i/crt-dll.zip?dl=0

I have found information described a similar problem: https://support.efolder.net/hc/en-us/articles/115010513067-Online-Backup-Manager-api-ms-win-crt-runtime-l1-1-0-dll-Error I hope it can help to fix this problem too.

sn50 commented 6 years ago

I have similar problem when trying to connect your testing application to MT4 on a VPS (Windows Server 2012 R2). The connection fails by simply stating this in status bar. Thanks to this question I checked and found some skipped updates. I'll post update how it worked.

You could consider adding more verbose message in your test app when connection fails. My use case is I'm new to MtApi and testing it with your test app. After a local success I tried moving the test app to VPS where runs live MT4 terminal. Unlike on my PC, connection fails. I think that newcomers could have similar progression and it could help more of us.

EDIT: I managed to connect in the end. Honestly I don't know what was the culprit. The other reason could be I might have accidentally used the MtApi expert copied from my local PC to the remote VPS, not the one from remotely installed directory.

EDIT2: Yes, when I use the expert file installed on local PC and copy it to the remote VPS MT4 terminal, the connection fails.

vdemydiuk commented 6 years ago

Hello. Thank you for this information. This is very major to collect all problems with the project on all systems. Unfortunately, I don't have environment with Windows Server 2012 R2 to test it so I appreciate your help. As for test application, you are right, I will try to improve it to get maximum information and descriptions of the problems.

sn50 commented 6 years ago

You're very welcome, I really like your project.

I also struggled with expert setting "Allow live trading", which I thought didn't have any impact on ability to simply connect to the terminal, but it has. In other words, it has to be allowed, or connection fails. So, as a result, I really don't know what was the real problem. Maybe there were more of them at the same time. :)

vdemydiuk commented 6 years ago

MtApi5 MQL expert has condition to check "allow live trading". I don't remember why I have added it.

if (MQL5InfoInteger(MQL5_TRADE_ALLOWED) == false) { MessageBox("Trade not allowed.", "MtApi", 0); isCrashed = true; return (1); }

I will try to test the expert without this condition and if it will work stable I will make release that will not require live trading enabled.

sn50 commented 6 years ago

Yes, that would make sense. The question is, does the API count with being able to connect but at the same time not being able to make trades? Maybe the condition should be checked in the "send order" part...

Btw. I use the MT4, not MT5.

BryanStackpole commented 3 years ago

Hi, so I have this working on my local machine but when I try use it on a windows server 19 VM it doesn't work much like the author of this ticket. I have double checked the version but no joy. Installed both mt5 and mt4 from installer and installed wix. image

Thanks

vdemydiuk commented 3 years ago

@BryanStackpole Do you still have the error?

oscarutomo commented 2 years ago

@vdemydiuk I'm facing this error as well.... My vps is using windows server 2012

knight-dev commented 2 years ago

Had the same issue on Windows Server 2016. Installed VS2022 with c++ and c# dependencies and that solved the problem.