Maximum (MaxN/Highest) based on time interval (i.e. n days ago) rather than periods (bars)
Is there a way to find the maximum value of a line based on a time period (i.e. a week / 7 calendar days) rather than a period (i.e. 5 periods/trading days)?
I have a daily trading days, and I would like to get the maximum in the last 7 calendar days and not the last 5 trading days. So the period will sometimes be less than 5 when there are holidays.
Is there a way to do this after pre-loading the OHLC data?
run-out last edited by
You could import the csv into a dataframe, use pandas to find the max over 7 calendar days, and then add in the dataframe into cerebro with an additional line showing the max figure for each day.