add timer to current time mql5
datetime AddMinutesToTime(datetime currentTime, int minutesToAdd) {
// Convert the current time to a structure
MqlDateTime dt;
TimeToStruct(currentTime, dt);
// Add the specified minutes
dt.min += minutesToAdd;
if (dt.min >= 60) {
dt.hour += dt.min / 60;
dt.min %= 60;
}
// Convert the modified structure back to time
return StructToTime(dt);
}
Comments
Post a Comment