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
Help me out here
try multithreading but terminal crashes
I've written a C++ dll.
Here's the code
And the script
If you change the code of the dll to this
I got the number 10 on the screen in the place of the comment (it should be like this) and then I get msgbox and 2 buttons
the terminal won't crash until I press one of the buttons.
as soon as i press it, the message appears explaining why the crash occured and how to fix it...
Gentlemen, has anyone run multi-currency in opening price visualisation mode with reference to other TFs?
Here is the daily chart:
The terminal doesn't crash until I press at least one of the buttons.
As soon as I press it, a message about finding the cause of crash and how to fix it appears...
Please note that the MQL5 script is automatically unloaded after the completion of OnStart, including your DLL.
That is, you have created a thread with a modal window hanging in memory, and the stool has been knocked out from under it. After closing the modal window it goes back to nowhere.
In your case, you need to explicitly wait until all DLL threads are terminated in a normal and guaranteed manner before terminating MQL5 script.
Note that the MQL5 script is automatically unloaded after the completion of OnStart, including your DLL.
That is, there is a thread with a modal window hanging in memory, and the stool has been knocked out from under it. After the modal window is closed, it goes back to nowhere.
In your case, before terminating the MQL5 script, you need to explicitly wait for all the DLL threads to terminate normally and be guaranteed.
If there is not a single loss in a series of trades, the PROFIT FACTOR and SHARPE RATIO take some unrealistic/extreme values. Is it an error or should such moments be considered and somehow processed? How to do it properly?
EMPTY_VALUE (same as DBL_MAX)
Of course, you can apply some undefined nan, but then you can't make comparisons.
EMPTY_VALUE (same as DBL_MAX)
You can of course use some undefined nan, but then you can't do comparisons.
If there is no loss in a series of trades, the values of PROFIT FACTOR and SHARPE RATIO take some unrealistic/extreme values. Is it an error or should such moments be considered and somehow processed? How to do it properly?
Apparently there is a mistake, because the Profit Factor should not be calculated with negative values, and as in this case with absence of negative trades.
Simply, if we take formula globally (Gross Profit/Gross Loss) then in absence of negative trades we get division by zero, and when Gross Loss is higher we get number less than 1, which is also not correct for further analysis, because the difference between two positive profit factors will be many times more than difference between two conventionally negative ones.
Apparently there is an error, as the profit factor should not be calculated with negative values, and as in this case with no negative trades.
It has already been said two posts above that this is not an error, but a sign of impossibility to calculate this indicator.
Although you can do one trick, at each calculation add 1 cent to both Gross Porofit and Gross Loss.
Then the forward formula would be ((Gross Porofit+0.01)/(Gross Loss+0.01))
The formula for calculating the reciprocal value (when Gross Loss is larger)
To do -((Gross Loss+0.01)/(Gross Porofit+0.01))
Well it's clear that Gross Loss and Gross Porofit are modules.
Then the line will be symmetrical on both sides which is good for GA and there will be no non-calculable situations at all.
But it will most likely be useful not for you, but for the people who are writing their own optimization criteria.