Questions from Beginners MQL5 MT5 MetaTrader 5 - page 393

 
Nauris:
CopyTime - bar open time, but what about the bar close time?

There is no separate function for this. You cannot accept the fact that the previous bar close time is the open time of the current bar in the conditions of your task?

 
Vitalii Ananev:
The opening time of the current bar will also be the closing time of the previous bar.
Are you sure?
 
Hello. Is it possible to calculate the current loss in pips, taking into account the volumes (e.g. martingale)?
 
Tapochun:

There is no separate function for this. You cannot accept the fact that the previous bar close time is the open time of the current bar in the conditions of your problem?

We need to find the conditions that the first tick has come after the weekend. What is the best way to do it?
 
Nauris:
We need to find the conditions that the first tick has come after the weekend. What is the best way to do it?

Do you want to catch a gap?) This should be done by the number of the day of the week. Using the MqlDatetime structure.

I.e. check if there is a new day and this day number = 1.

 
Tapochun:

Do you want to catch a gap?) This should be done by the number of the day of the week. Using the MqlDatetime structure.

I.e. check that a new day is formed and this day number = 1.

Yes hep! :) Your variant is not very good, because there is a broker which opens on Sunday too.
But I think I found it, I will take the penultimate candle CopyOpen (15m) and compare with the opening of the last candle CopyOpen, if more than 24 H, it means it is day off.
 
Nauris:
Yes hep! :) your option is not good, because there is a broker that opens on Sunday too.
But I think I've got it, I will take the penultimate candle CopyOpen (15m) and compare with the opening of the last candle CopyOpen, if more than 24 H, it means it is weekend.
Can be invariant, i.e. the number of weekday, in which the market opens, is taken in an external variable, and knowing this parameter, just change it if necessary. If you are just interested in large GEPs, you can use this indicator or similar ones in kodobase.
 
Tapochun:
You can make it invariant, i.e. the number of day of the week, when the market opens, into an external variable and, knowing this parameter, simply change it if necessary. If you are just interested in large GEPs, you can use this indicator or similar ones in kodobase.

Thank you!
 
Nauris:

Thank you!
You're welcome!
 
I don't understand something about datetime. If datetime is time as the number of seconds elapsed since January 01, 1970, why do I see in the log not seconds but 2015.01.02 08:00:00. And how do I do it in seconds elapsed since January 01, 1970?
Reason: