Backtesting a system that trades once a day

 
I'm trying to write an EA that limits trades to once a day. However, I cannot find a function for time that will work when backtesting ( the system checks the current time, not the timeframe thats being backtested). Has anyone developed a function for this, or am I missing something obvious?
 
cwn6161:
I'm trying to write an EA that limits trades to once a day. However, I cannot find a function for time that will work when backtesting ( the system checks the current time, not the timeframe thats being backtested). Has anyone developed a function for this, or am I missing something obvious?


During Backtesting, Time is modelled !

datetime TimeLocal( )
Returns local computer time as number of seconds elapsed from 00:00 January 1, 1970.
Note: At the testing, local time is modelled and is the same as the modelled last known server time.

 

Use DayOfWeek: Example:

if (TimeStamp != DayOfWeek())
{ 
   OrderSend......;
   TimeStamp = DayOfWeek();
}

That way when it comes around the second time, TimeStamp Will be equal to Monday or Tuesday or Whatever. So then it will Not move on to OrderSend. 

 
Thanks for the help! I had tried using DayOfWeek before, but for some reason the trades weren't being limited correctly. Probably just an error in another part of the logic. Things look good now.
Reason: