Is there a way to count the number of days since a condition was met? Example: Trading days since a recent high.
I imagine I need to either somehow get the date the condition was met, and then do CountTradingDays, i.e.
input len = 252
Def RecentHigh = Highest(High, len);
Then get the date the high occurred
AddLabel(yes, CountTradingDays(DateOfRecentHigh, GetYYYYMMDD());
Or get the bar number that the high occurred, and subtract that from the current bar number, but I don't know how to get that either.
Any suggestions?
I imagine I need to either somehow get the date the condition was met, and then do CountTradingDays, i.e.
input len = 252
Def RecentHigh = Highest(High, len);
Then get the date the high occurred
AddLabel(yes, CountTradingDays(DateOfRecentHigh, GetYYYYMMDD());
Or get the bar number that the high occurred, and subtract that from the current bar number, but I don't know how to get that either.
Any suggestions?