time older than by days

mohd alqallaf  

i am confused how to calculate if "OTime=2022.05.20 22:00" is older than 3 days by TimeCurrent()

i tried 


((TimeCurrent()-OTime)-(2*86400))+TimeCurrent()

or

(TimeCurrent()-OTime)+(TimeCurrent()-(2*86400))

forgot about my calculations its totally fail i just want to use 'if  expression' date(OTime) is older/greater than 3  days  by TimeCurrent()

Dominik Egert  
One solution:

(TimeCurrent () - OTime) > (86400 * 3)


Sorry for missing the code button again. I am on mobile.
William Roeder  
Dominik Christian Egert #:
One solution:
(TimeCurrent () - OTime) > (86400 * 3)

Don't hard code numbers. Write self-documenting code. You should be able to read the code out loud and have it makes sense.

mohd alqallaf: i am confused how to calculate if "OTime" is older than 3 days
oTime < TimeCurrent() - 3 * PeriodSeconds(PERIOD_D1) // oTime is older than 3 days ago.
The question is ambiguous. Do you mean 3 days or 3 trading days.
iBarShift(_Symbol, PERIOD_D1, oTime) > 3 // oTime is older than 3 trading days ago.
Reason: