Looking to try and code to return number of periods since when the close crosses above (or below) the supertend, and then note the last value of the supertrend prior to the close crossing it. I can see the barindex and tradeindex but don’t know how to refer to any other condition.