Errors, bugs, questions - page 3079
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Market doesn't load a screenshot. Tried from two browsers.
Me too...
Good afternoon, what could be the problem? I use dll to write to SQL Server (example from article https://www.mql5.com/ru/articles/2895 ).
If I use up to 5 threads, data is written correctly. If I use more threads, there will be an error "Unhandled exception 0xE0434352".
Good afternoon, what could be the problem? I use dll to write to SQL Server (example from article https://www.mql5.com/ru/articles/2895 ).
If I use up to 5 threads, data is written correctly. If I use more threads error "Unhandled exception 0xE0434352" appears at once.
In all functions of interface DLL we should use try catch, catch "unhandled exception" and write it into log...
It's a good idea to catch all exceptions and try all calls to the pluses. Even in MQL documentation it's clearly written - DLL's shouldn't throw exceptions, not C++.
in particular in the article conn.Close and new SqlConnection don't fall under "exception catching" and can potentially throw exceptions
The screenshot is not loading in the Marketplace. I tried it with two browsers.
Me too...
Have you tried a simple drag and drop of the picture?
Forum on trading, automated trading systems and strategy testing
Market and Math
Alexey Viktorov, 2021.08.19 21:01
Try to insert a picture by simple dragging and dropping it on the text.
I have now tried to make changes in hidden Expert Advisor and dragged the first image I saw.
Have you tried a simple drag and drop of the picture?
out of 5 pictures only one is added
This has been the case for a long time. mql strings really don't like null characters inside a string and in literals, in functions too.
The only normal way is to convert three strings to an array with a terminating zero.
I.e. this behaviour as it is now was done deliberately a few years ago. I don't know the reasons.There are enemies everywhere
In all interface DLL functions, wrap everything in try catch, catch the "unhandled exception" and log it...
It's a good idea to catch all exceptions and wrap all calls to pluses in try. Even in MQL documentation it's clearly written - DLL's shouldn't throw exceptions, not C++.
particularly conn.Close and new SqlConnection don't throw exceptions and could potentially throw one
Thanks! Checked it out, shared variable access error. The author wrote about it too.
It must be noted that the demo project has a very significant limitation: it allows to run only one Expert Advisor working with DB in one MetaTrader terminal. The matter is that all EAs use one instance of a loaded DLL. Since our class is made static, it will be the same for all running Expert Advisors. Variables will also be common. If you run several experts, they will all use the same connection and one command object for all. If several experts try to access these objects at once, problems may occur.
Q: How can I implement multi-threaded access to dll (separate instance for each function call and variables local for each call)?
I am experiencing this problem in the MT5 tester.
Working with multiple currencies, data is occasionally swapped from another currency. Check the tester. Please correct it.
The first value isSymbolInfoDouble(symbol,SYMBOL_BID);
As if it cannot receive pricesSymbolInfoDouble(EURGBP,SYMBOL_BID); and takes value from another pair which is in work. Is there any way to check if the quote is correct?
Thank you! Checked it out, shared variable access error. The author also wrote about it
It should be noted that the demo project has a very significant limitation: it allows to run only one Expert Advisor working with DB in one MetaTrader terminal. The matter is that all EAs use one instance of a loaded DLL. Since our class is made static, it will be the same for all running Expert Advisors. Variables will also be common. If you launch several experts, they will all use the same connection and one command object for all. If several experts try to access these objects at once, problems may occur.
Q: How can I implement multi-threaded access to dll (separate instance for each function call and variables local for each call)?
There is almost no way to do this in .NET. The class is made static not because the author of the article is evil, but because that's how sharp classes are imported.
I see two ways: 1) (long time to write, works fast) rewrite in C++ and don't touch .NET anymore 2) (rather mechanically, but speed will go down and there could be side-effects) thoughtfully wrap calls in Critical Section to avoid two threads accessing simultaneously
if sharping is important, another option - to rewrite the connection pooling control at DLL level to remember the mapping of EA<->connection_id and every EA works with its connection;
I can not say about .net - is it possible to get and store reference to sharp's object in some MQL structure or scalar and pass it back and forth. That is to operate as with a normal C++ pointer. If you can, then everything is simplified.