I'm programming a strategy which checks on Monday before close of the day if some criteria are fulfilled to open an order. The problem is that I couldn't find a way to get the appropriate date and time. It's never the date of the current bar. One can get HLOC but not the time of the bar?
The problem is that I can't access the date and time of a specific bar during development and during backtest. Even if the backtest is having weeks of data with many days fulfilling the criteria NO signal would be calculated because always the last calculated bar is used for the date.
Is this simply not possible or have I overseen some functionality regarding this?
An example of the code:
Code: Select all
if DayOfWeekFromDateTime(LastCalcDateTime) = Monday then
BEGIN
Commentary("It's Monday!");
if Time > 1550 And Time < 1600 then
// During backtest the strategy never ever comes here, except I test during the time and date
Edit: Note, it's possible to get date and time after a position has been opened but date and time needs to be checked before the position is open