I am having a weird issue.. Here are the appropriate code snippets:
Variables Declaired:
Code: Select all
LastSwingHiDate(DateTime),
LastSwingHiTime(DateTime),
LastSwingHiDateTimeComplete(DateTime),
Code: Select all
if barstatus = 2 then begin
LastSwingHiPrice = ( lastHi ) ;
lastSwingHiBar = ( lastHiBar);
LastSwingHiDateTimeComplete = (Date[CurrentBar - lastHiBar]) + ( Time[CurrentBar - lastHiBar]);
LastSwingHiDate= (Date[CurrentBar - lastHiBar]);
LastSwingHiTime= (Time[CurrentBar - lastHiBar]);
end;
Code: Select all
print (
" Date: " + formatdate("dd-MM-yy", el_datetodatetime(LastSwingHiDateTimeComplete)) +
" Time: " + FormatTime("HH:mm", el_timetodatetime(LastSwingHiDateTimeComplete)) +
" T: " + FormatTime("HH:mm", el_timetodatetime(LastSwingHiTime)) +
" D: " + formatdate("dd-MM-yy", el_datetodatetime(LastSwingHiDate)) +
" Bar : " + (NumToStr(lastSwingHiBar,0)) +
" Price " + (NumToStr(LastSwingHiPrice,2))
);
Results:
Date: 28-09-14 Time: 20:59 T: 10:30 D: 29-10-14 Bar : 1393 Price 76.33
Date: 28-09-14 Time: 20:59 T: 10:30 D: 29-10-14 Bar : 1393 Price 76.33
Date: 28-09-14 Time: 20:59 T: 10:30 D: 29-10-14 Bar : 1393 Price 76.33
Date: 28-09-14 Time: 20:59 T: 10:30 D: 29-10-14 Bar : 1393 Price 76.33
Question: Why is date and Time of value 1 less? its incorrect. It should be time value of 10:30 and date value of 29-10-14.
Thanks.