Thanks for replying. Are you able to explain how the code gets the lookback period as 141 bars? Thanks