Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1813

 
Tretyakov Rostyslav #:

Rostislav!

And this "current" can be permanently inserted into the mq4 code. In order not to set the required TF each time. I have not succeeded.

 
Kedrov #:

Rostislav!

And this "current" can be permanently inserted into the mq4 code. Not to set the required TF each time. It did not work for me.

This line in the beginning of code

input ENUM_TIMEFRAMES Precision=PERIOD_D1; // Precision   PERIOD_H1

Replace it with


input ENUM_TIMEFRAMES Precision=PERIOD_CURRENT; // Precision   PERIOD_H1
 
Tretyakov Rostyslav #:

This line at the beginning of the code

replace it with...


Thank you very much, Rostislav!

Everything worked!

Good luck!

 

Also, tell me how MakarFH became Rostislav.

Where is there any consonance... anything at all?

 
Maxim Kuznetsov #:

Also, tell me how MakarFH became Rostislav.

Where is there even a consonance ... something-there.

decompile)

 

Hi all. Can you advise me please:

I'm trying to calculate a crossover on a standard MACD of a signal line and a histogram. The idea is this: on each new bar we take the two previous candles and get the indicator values on each of them. If the MACD value on the second candle is greater than the signal value and the MACD value on the first candle is already below the signal and all values are above zero, it means there is a crossover upwards and vice versa.

But, at the moment of getting the value it becomes somehow huge. And only one - the signal line of the second candle. It can be 8 to what degree, 4.5, 7, etc. When the next bar appears, the value of the signal line of the second bar from the new bar can already be normal. All the others turn out to be correct. And in the data window, the value is also correct. I cannot understand why. What am I doing wrong?

PrevMACD = iMACD(_Symbol,_Period,12,26,9,PRICE_CLOSE,MODE_MAIN,1);
PrevSignalMACD = iMACD(_Symbol,_Period,12,26,9,PRICE_CLOSE,MODE_SIGNAL,1);
CtrlMACD = iMACD(_Symbol,_Period,12,26,9,PRICE_CLOSE,MODE_MAIN,2);
CtrlSignalMACD = iMACD(_Symbol,_Period,12,26,9,PRICE_CLOSE,MODE_SIGNAL,2);

Сomment(CtrlMACD+" "+CtrlSignalMACD+" "+PrevMACD+" "+PrevSignalMACD);

I have a feeling that this is about a variable double. Because the value in the data window is 0,000081, but it turns out 8,1....., the same thing I noticed with another value - in the data window 0,000071, but in the variable 7,1..... But they are all defined as double variables.

Files:
 
Maksim Efimov MACD of a signal line and a histogram. The idea is this: on each new bar we take the two previous candles and get the indicator values on each of them. If the MACD value on the second candle is greater than the signal value and the MACD value on the first candle is already below the signal and all values are above zero, it means there is a crossover upwards and vice versa.

But, at the moment of getting the value it becomes somehow huge. And only one - the signal line of the second candle. It can be 8 to what degree, 4.5, 7, etc. When the next bar appears, the value of the signal line of the second bar from the new bar can already be normal. All the others turn out to be correct. And in the data window, the value is also correct. I cannot understand why. What am I doing wrong?

I have a feeling that this is about a variable double. Because the value in the data window is 0,000081, but it turns out 8,1....., the same thing I noticed with another value - in the data window 0,000071, but in the variable 7,1..... But they are all defined as double variables.

There's not 8 in the comment, there's a continuation.

Сomment(DoubleToString(CtrlMACD)+" "+DoubleToString(CtrlSignalMACD)+" "+DoubleToString(PrevMACD)+" "+DoubleToString(PrevSignalMACD));
 
Vitaly Muzichenko #:

There's not 8 in the commentary, but there's a sequel.

Thank you. That shows it correctly. Stupid mistake, of course. But I still wonder why all the other values are displayed normally and only one is crooked.

 
Maksim Efimov #:

Thank you. That's the right way to do it. Stupid error, of course. But I still wonder why all other values are displayed normally and only one is crooked.

It is not crooked, it is correct at machine level, you see there is "e-08" at the end.

For example, the number 1e-05 is not an error but0.00001.

You need to use DoubleToString to see what we are used to and the program will work correctly anyway

Read

Все калькуляторы
  • allcalc.ru
Онлайн калькулятор для перевода чисел в экспоненциальный вид и обратно, другим языком для вычисления чисел с буквой E. На компьютере (в частности в тексте компьютерных программ) экспоненциальную запись записывают в виде MEp (пример 1e-10), где: M — мантисса, E (exponent) — буква E, означающая «*10^» («…умножить на десять в степени…»), p — порядок. Это необходимо для представлении очень больших и очень малых чисел, а также для унификации их написания. Многие пользователи калькуляторов столкнулись с вопросом: Что означает буква "E" в цифровом калькуляторе? Это Экспоненциа́льная за́пись— представление действительных чисел в виде мантиссы и порядка. Удобна для записи очень больших и очень малых чисел.
 
Vitaly Muzichenko #:

It is not crooked, it is correct at the machine level, see there is an "e-08" at the end.

For example, the number 1e-05 is not an error, it is0.00001.

To see what we are used to, you need to use DoubleToString and the program will work correctly anyway

Read

Thank you again. I will read it.

Reason: