[ARCHIVE]Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Can't go anywhere without you - 5. - page 84

 
lottamer:
Guys, does anyone have a function to determine how much time (seconds) has elapsed since the start of the day ?
It should work:

SecondsFromCurrentDay=TimeCurrent()-iTime(Symbol(),PERIOD_D1,0);// Последнее известное время тика  минус время открытия дневного бара в секундах
 
Sepulca:
It should work:


Thank you very much.

 
Can you tell me how to set the accuracy format(number of digits after the decimal point) in the script when outputting the alert to 7 digits?
 
lottamer:

????

What's not to understand?
The value of this expression is the number of seconds since the start of the day!
 
MauzerVII:
Can you tell me how to set the format of accuracy (number of digits after the decimal point) in the script when outputting the alert to 7 digits?

Alert(DoubleToStr(N,7));
 
MikeM:

Alert(DoubleToStr(N,7));


Thank you, it works.
 
MikeM:

What's unclear?
The value of this expression is the number of seconds since the beginning of the day!


TimeCurrent() % 86400 - I haven't seen this anywhere.... % - ???

I don't understand this expression. can you give me an example?

 
lottamer:


TimeCurrent() % 86400 - I haven't seen this anywhere.... % - ???

I don't understand this expression. give me an example?

https://docs.mql4.com/ru/basis/operations/math
 
ZahvatkiN:

Can you tell me how should the code look like with the following conditions: if the colour of the indicator changes from red to blue, put a pending order buystop, if on the contrary, the colour of the indicator changed from blue to red, then sellstop?

The indicator draws buffers. The blue line is one buffer and the red line is another one. Check the buffer values:
if
red buffer on the second bar has a non-empty value, and on the first bar an empty
and at the same time
blue buffer on the second bar has a non-empty value and on the first bar a non-empty value ---- we have a colour change on the first bar from red to blue.
 

It's original, but it should work too))) Residual from dividing all twenty-four hours since 1970 by the number of seconds in a day)))