hi, i need help to change parts of some datetime value, with another variable, it's possible to do that?
- I can't get the indicator value- urgent
- How can i set an external datetime variable to the current time?
- another question about probability
mrluck1:
hi, i need help to change parts of some datetime value, with another variable, it's possible to do that?
hi, i need help to change parts of some datetime value, with another variable, it's possible to do that?
//+------------------------------------------------------------------+ //| test.mq4 | extern datetime time= D'2017.11.05 0:01:00'; int a=10; int start () { // Method 1 MqlDateTime Mtime; TimeToStruct(time, Mtime); Mtime.day = a; time = StructToTime(Mtime); Print("Method 1: time = " + TimeToString(time ,TIME_DATE|TIME_SECONDS)); // Method 2 string stime = StringFormat("2017.11.%02d 00:01:00", a); time= StringToTime(stime); Print("Method 2: stime = " + stime + ", time = " + TimeToString(time ,TIME_DATE|TIME_SECONDS)); return (0); };
I recommend Method 1. Regards.
thanks a lot for your help man, i'll use method 2 although, not used to OOP, and method 2 is easier to understand, have a nice day
mrluck1:
You are welcome. Have a nice day, too.
thanks a lot for your help man, i'll use method 2 although, not used to OOP, and method 2 is easier to understand, have a nice day
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register