Figures I'd solve right after I put it up.
Code:
int Diff=Time[1]-Time[1+1]; int intSeconds=Diff%60; int intMinutes=(Diff-intSeconds)/60; Alert("Mins:",intMinutes," Secs:",intSeconds);
My only problem with this is I get a compiler warning: "possible loss of data due to type conversion" on the first line. Anyone know a fix/away around that?
nondisclosure:
Figures I'd solve right after I put it up.
Code:
My only problem with this is I get a compiler warning: "possible loss of data due to type conversion" on the first line. Anyone know a fix/away around that?
I think that it is only a warning, but can be annoying when you get a lot of them
datetime Diff=Time[1]-Time[1+1]; int intDiff = (int)Diff;
The difference between two date/times is not a date/time. 11:30 - 09:00 is not D'1970.01.01 02:30' it's 480 seconds | datetime Diff=Time[1]-Time[1+1]; |
datetime - datetime is a Long int, but we don't have 68 year timeframes. | int Diff=(int)(Time[1]-Time[1+1]); |
![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
I'm getting a headache from trying to figure this out.
Code:
Needless to say, I'm trying to get the integer value of the seconds elapsed from both times. Diff comes out correct (1/1/1970 04:00 on a 4hr chart). iDiff comes out to 0. Why? My "stroked" out brain can't figure this out.