Questions from Beginners MQL5 MT5 MetaTrader 5 - page 820

 

Study the maths. Confused between two pine trees...

There's this:

int OnCalculate (const int rates_total,      // размер массива price[] 
                 const int prev_calculated,  // обработано баров на предыдущем вызове 
                 const int begin,            // откуда начинаются значимые данные 
                 const double& price[]       // массив для расчета 

Questions about begin:

1. What is it? Its value = 0. Is it an index?

2. What is it essentially? What is meaningful data? What other kinds of data are there?

3. On what basis is this value calculated? And what variations are possible in principle? For example, can meaningful data not start at index 0 but at index 5?

4. Why is this parameter inserted into OnCalculate?

If I have missed where it is written in the help, please just point it out.

 

Can anyone advise how to get rid of these multi-digit values in the debug window (variables are normalised)?


 
Андрей:

Can anyone advise how to get rid of these multi-digit values in debug window (variables are normalized)?


Add a string variable, set it to DoubleToString() and watch it in the debug window.

You could put it all in a macro #ifdef _DEBUG

 
Alexey Viktorov:

Add a string variable, set it to DoubleToString() and watch it in the debug window.

You could put it all in a macro #ifdef _DEBUG

Thanks, but the question arises - these multi-digit values, do they correspond to reality or so, "light play".

The point is not that it should look nice, but which values are used for further calculations.

 
Андрей:

Thank you, but the question arises - are these multi-valued values true, or are they just "light play".

It's not about making it look nice, but about what values are used for further calculations.

These multi-digit values correspond to reality. And they sometimes spoil the picture, especially in expressions of comparison.
To be sure, it is recommended to use NormalizeDouble() with a given accuracy.
 
And no one has even bothered to say anything about the beguine. It must be something completely foreign...
 
User_mt5:
These are the multi-meaning ones. And they sometimes spoil the picture, especially in comparison expressions.
To be sure, it is recommended to use NormalizeDouble() with specified accuracy.
So these "creepers" emerge from normalized values. It seems there is something missing in this soup (MT5).
 
Андрей:
So it's these "buggers" that come out of the normalised values. There seems to be something missing in this soup (MT5).

Until now I naively believed that normalisation is the truth in the last resort.
Could you please show me a code fragment where the problem occurs. Perhaps the cause is something else.

 
User_mt5:

Until now, I naively believed that normalisation was the truth in the last resort.
Could you please show me a code fragment where the problem occurs. Perhaps the cause is something else.

Here's a snippet, though, which is enough to see the "effect".

Here is the result:

It's the same with or without normalisation.

 

Андрей:

It's the same with or without normalisation.

Yeah.

Actually, in comparison expressions (as if "on the fly") normalization works.
As far as I understand, problems arise in the process of simple calculation.
But if a number is normalized, the normalized number should be stored too.

But alas.

I wonder what the developers have to say about it.

Reason: