I am trying to replicate the ichimoku cloud indicators in my algorithm in order to find the most optimal position to enter and exit a trade. But I dont know how to create these:

- last 9 candles high

- current price lagging 26 candles

any recommendations or hints are greatly appreciated!