Display Server Time on the chart in 24 HH:MM format and vertical lines at adjustable intervals?
double ldHour = TimeHour(MarketInfo(Symbol(), MODE_TIME)); double ldMin = TimeMinute(MarketInfo(Symbol(), MODE_TIME)); Comment("server time:",ldHour ,":",ldMin );for the vert lines you can use https://docs.mql4.com/objects/ObjectCreate
hth
Comment("server time:",Hour() ,":",Minute() ); //also possible
Russell:
Muchas Gracias Señor!
Here is a bit of code I wrote to display 12 Hour format with AM & PM. It also adds a 0 in front of single digit minutes and hours (1-9):
int hour = Hour(); int minute = Minute(); string zeroHour = ""; string zeroMinute = ""; string ampm = ""; if (hour < 10) zeroHour = "0"; else zeroHour = ""; if (minute < 10) zeroMinute = "0"; else zeroMinute = ""; if (hour > 12) ampm = " PM"; else ampm = " AM"; if (hour > 12) hour = hour - 12; ObjectCreate("Time", OBJ_LABEL, 0, 0, 0); ObjectSetText("Time", "Server Time: "+zeroHour+hour+":"+zeroMinute+minute+ampm, 9, "System", Orange); ObjectSet("Time", OBJPROP_CORNER, 1); ObjectSet("Time", OBJPROP_XDISTANCE, 5); ObjectSet("Time", OBJPROP_YDISTANCE, 50);
Thanks for any and all assistance.