I get a little confused when attempting to code time logic.
Okay, I have a custom indicator that I would like to be able to set how many days ago in the data that it starts. So I have an object called "AppliedDays" that I can set in the Indicator Parameters.
I used to use:
if (ToDay(Time[0]) < AppliedDays)
RemoveDrawObjects();
but that meant I had to change the parameter all the time and use a clumsy date format
I want to just put in, say 30 days and have the indicator always start 30 days ago on the chart. I assume I have to use DateTime. Can you help me with the Syntax & Logic.
Is it something like:
if (DateTime.Now - AppliedDays > DateTime)
RemoveDrawObjects();
????
Any help is appreciated. Thanks
Comment