Hi,
In BackTesting and Auto Trading I am building a system and have an input that I have defined to contain multiple dates, say it contains 10 different dates .
I am interested in the next day working day after each of those dates. How can I get this from the pre defined string of original dates?
Thanks
There you go:
$MyDate[1] = 20210918
$MyDate[2] = 20211010
$MyDate[3] = 20211019
$MyDate[4] = 20211107
$MyDate[5] = 20211201
$MyDate[6] = 20211217
$MyDate[7] = 20211225
$MyDate[8] = 20220108
$MyDate[9] = 20220122
$MyDate[10] = 20220206
CurDate = Date //or use OpenDate if you need the date at the opening of a bar, instead of that at the closing of a bar
NextDate = 0 //defaults to an invalid date
FOR i = 1 TO 10
IF (CurDate > $MyDate[i]) AND (CurDate[1] <= $MyDate[i]) THEN
NextDate = CurDate //NextDate will retain the valid date
Break
ENDIF
NEXT
buy at -close limit //useless action, but to comply with PRT's requirements
graph NextDate > 0 //plots TRUE logic value when a valid date is found
Thanks – I will give this a go