Discussion on MQL4 documentation - page 17

 
Yurixx:

Rosh, if I understand your silence correctly, there is no clear statement for which cases and for which expressions/variables normalisation is needed. If this is the case, maybe a simpler question can be answered: is normalisation of calculated values of the form

int StLs=25;
double prc = Ask + StLs*Point;

Or should I find this out on my own, in an experiment ?

I didn't think you were waiting for my answer to the question. My answer is: I don't do normalisation in such cases and the orders open normally. But there was a time when I loaded a manually made history and tried to run a tester on it - that's when I was surprised. In almost all cases, normalization should be used just in case - whether it's indicator values of your own making inserted into OrderSend() price parameters [e.g., all kinds of Pivots] or complex calculations (and not complex ones) inside the EA - in all cases, you cannot spoil anything with butter.

But really, I can't give a clear formulation, when it is absolutely unnecessary to apply price normalization in OrderSend(). In principle, a night person will get a feel for it in half a year, but there's no need to get a feel for it, just normalize it all the time.
 
Also, while checking the helper today, I found a group of functions under Data Conversions:

that provide conversion of data from one format into data of another format.

Of particular note is the NormalizeDouble() function, which ensures the required accuracy of price representation. You cannot use non-normalised prices in trading operations whose accuracy exceeds the accuracy required by the trading server by at least one digit.
 
Also NormalizeDouble

double NormalizeDouble( double value, int digits)
Rounding a floating point number to the specified precision.
The calculated StopLoss and TakeProfit values, as well as opening prices of pending orders must be normalized to the accuracy, the value of which is stored in the predefined variable Digits.
Parameters:
value - Value with floating point.
digits - A precision format, the number of digits after the decimal point (0-8).
Example:
  double var1=0.123456789;
Print(DoubleToStr(NormalizeDouble(var1,5),5));
// output: 0.12346
 
"Example:
  double var1=0.123456789;
Print(DoubleToStr(NormalizeDouble(var1,5),5));
// output: 0.12346".

These are examples I would like to see in the documentation. Everything is simple and understandable. You insert it in an Expert Advisor or an indicator and see the result at once.
 
You mean like this?
 

Rosh, please look at page 16 of the same forum, I've already written about this function and suggestions for improving the help to it.

 
Fixed so for now (will be in new build):

double NormalizeDouble( double value, int digits)
Rounding a floating point number to the specified precision.
Calculated StopLoss and TakeProfit values, as well as open prices of pending orders should be normalized to the accuracy, the value of which is stored in the predefined variable Digits.

Parameters:
value - Value with floating point.
digits - A precision format, the number of digits after the decimal point (0-8).
Example:
 double var1=0.123456789;
Print(DoubleToStr(NormalizeDouble(var1,5),8));
// output: 0.12346000



This example demonstrates clipping via NormalizeDouble() to 5 digits, while Print() simply renders (sorry for that non-Russian style) it.
 

Yes, the example became significantly more informative as soon as the numbers of characters started to differ.

 
bool SendFTP( string filename, string ftp_path=NULL)
Sends file to email address specified in Publish window. Returns FALSE if unsuccessful.
The function does not work in test mode. This function also cannot be called from the custom indicators.
The file to be sent must be located in the terminal_directory\experts\files folder or its subfolders.
Sending is not done if no FTP address and/or access password is specified in the settings.
[...]
void SendMail( string subject, string some_text)
Sends e-mail to the address specified in the settings on the Mail tab.
Sending may be prohibited in the settings, also the e-mail address may not be specified. The GetLastError() function must be called to get the error information.
[...]

Observation task: find 2 differences.
 
Apparently, you have to give up so you can throw away the right answer from behind your back? :)