I want to run explore on two dates dynamically calculated (StartDate , EndDate )
to see stocks that meet the criteria
Is the method i am trying to implement is not feasible? if not what are the alternatives to achieve what i want?
// Find stocks that have gapped down in last 3 months
// Calculate EndDate as today
EndDate = Now(5);
// Calculate StartDate as 180 days ago from today
StartDate = DateTimeAdd( EndDate, -180, inDaily ); // Subtract 180 days
aGapDn = ( H < 0.95 * Ref(L, -1) ); // Identify GapDown bars
GapDate = ValueWhen(aGapDn, DateTime());
GapLow = ValueWhen(aGapDn, Ref(Low, -1));
GapHigh = ValueWhen(aGapDn, High);
latestClose = LastValue(Close);
latestDate = LastValue(DateTime());
//Filter = aGapDn AND latestClose > 0.9 * GapLow;
Filter = aGapDn AND Close > 0.9 * GapLow AND DateTime() >= StartDate AND DateTime() <= EndDate;
AddColumn(GapHigh, "GapHigh");
AddColumn(GapLow, "Gap Low");
AddColumn(Close, "Close");
AddColumn(latestClose, "latestClose");
AddColumn(GapDate, "GapDate", formatDateTime);
//AddColumn(latestClose, "Latest Close");
//AddColumn(latestDate, "Latest Date", formatDateTime);
AddColumn(StartDate, "StartDate", formatDateTime);
AddColumn(EndDate, "EndDate", formatDateTime);