Questions from Beginners MQL4 MT4 MetaTrader 4 - page 96

 

Hello, I want to get an expiry datefor futures

EXPIRATION=(datetime)SymbolInfoInteger(Symbol(),SYMBOL_EXPIRATION_TIME);

It gives out 1970 01 01 00 00

 

Hello,


Please advise, autovalidation shows a"division by zero" error in the following expression:


NormalizeDouble(STOP/MarketInfo( Symbol(),MODE_TICKVALUE)*10,0)*Point

Print of all components shows NOT zero values.

What could be the reason for the error?

 

MT4

Where can I get the current and comprehensive list of int OrderType() values ?

Help, I take it, has not been updated.


Does AccountProfit() count deposits and withdrawals?

The help doesn't really say anything about how it's counted, what's taken into account...

Even a precise definition of the term would help to understand what the developers meant and how it should be counted.

Maybe there's an overview of similar functions from the developers , the result of which is derived? I have to collect it by bits and pieces...

 
Viatcheslav Pashkov:

Hello,


Please advise, autovalidation shows a"division by zero" error in the following expression:


Print of all components shows NOT zero values.

What can be the reason for the error?


Please give me a more complete code. Types of variables. Which character. What values are taken before substitution in the expression. Where is the result of calculating this expression used next.

 
Kirill Belousov:

Give a more complete code. Types of variables. What character. What values are taken before substitution in an expression. Where is the result of calculating this expression used further.

There were only predefined variablesSymbol() andMODE_TICKVALUE)

I don't know what it is, but I solved the issue this way:

I introduced a check for zero such as: if the expression is not equal to zero, then execute.


And everything went well.

Don't know what it means...but I'll keep in mind ...that the autovalidator indicates a POSSIBLE division by zero in the INI block, not an explicit one.

 
Viatcheslav Pashkov:

Hello,


Please advise, autovalidation shows a"division by zero" error in the following expression:


Print of all components shows NOT zero values.

What could be the reason for the error?

double TICK_VALUE = MarketInfo( Symbol(),MODE_TICKVALUE);
if(TICK_VALUE ==0) return;
NormalizeDouble(STOP/TICK_VALUE *10.0)*Point
 
Vitaly Muzichenko:

How canTICK_VALUE be equal to zero ?

 
Viatcheslav Pashkov:

Howcan TICK_VALUE be equal to zero ?


until the terminal is connected to the account, most variables are zero

 
Taras Slobodyanik:

until the terminal is connected to the account, most variables are zero


Thanks, I'll keep that in mind!

 
Viatcheslav Pashkov:

There were only predefined variablesSymbol() andMODE_TICKVALUE)

I don't know what's wrong, but I solved the problem this way:

I introduced a check for zero such as : if expression is not equal to zero, then execute.


And everything went well.

I do not know what it means ... but I will keep in mind ... that the autovalidator indicates a POSSIBLE division by zero in the INI block, not an explicit one.

Reporting a division by zero is not the problem, it's the consequence.

But now it will be hard to find the problem, as you have simply removed the inconvenient message about division by 0.

What exactly are you normalising? Where are you substituting the result?

Please give your code where you further use the result of the expression you gave. I think the problem arises there.