Questions from Beginners MQL5 MT5 MetaTrader 5 - page 1350

 
Evgeny Dyuka #:

... Further to the previous question

Is there a capability of an exchange buffer between the Expert Advisor and the indicators open in the same chart?
I.e. the Expert Advisor puts something there, and the indicators read something from it.

Database
 
Aliaksandr Hryshyn #:
Database
Yes, this is the best option, especially if uploading to a frame
 

I have encountered a strange problem. While the EA is running, sometimes the EA is terminated due to division by zero.

C (HYDR-12.21,M2)  zero divide in 'C.mqh' (1321,60)

Here is the line 1321.

 if( B != 0 && A/B > 1.1)

How it's possible? Because in first condition " B " is not equal to zero. So in second case it can't be division by zero too. Or are the conditions checked out of order ?

 
pivomoe #:

Faced with a confusing problem.

You say correctly, the conditions are checked in order. If the first one is false, the second one is not checked.

However, your terminal is swearing at the 60th character in the string, while the division is at most 17. Perhaps it's not 'C.mqh' you're looking at.


I also like to do it like this:

if(A > B*1.1)
 
Aleksei Stepanenko #:

However, you have the terminal swearing at the 60th character in the string, and the division is at most 17.

I have changed the string for easy reading. Here's the original.

if( BestSymmaSchtrafov != 0 && IdealnaySymmaSchtrafov/BestSymmaSchtrafov > 1.1)

The division sign is exactly in the 60th position.

 

Make a "B"print in front of the condition. What will it write?


if( BestSymmaSchtrafov != 0)
   {
   printf(BestSymmaSchtrafov);
   if(IdealnaySymmaSchtrafov/BestSymmaSchtrafov > 1.1)
       {

       }
   }
 
I'll give it a try. But unfortunately it only sparks in real life. And very rarely. We have to wait...
 
pivomoe #:
I will try it. But unfortunately sparks only on real. And very rarely. We have to wait...

I'm doing as Alexei did, 2 ifs. In one ifa with logical AND also caught division by zero in the following ANDs. 2 ifas solved the problem.

 
Valeriy Yastremskiy #:

And was also catching division by zero in the following E's. Two iphs solved the problem.

Thank you.

 
I've removed everything Everything you don't like has been removed. The lockdown's still on!!!
Reason: