I have a dataset that has ohlc prices, I want to know how to calculate the log returns of the next 20 day period for all dates in the dataset. Each date in the dataset is the starting and the next 20 days is the final point.
log(close, lag(close, n=20))
The code above was suggested by GPT but I think it's wrong because it uses lag().