Hello, I'm new to QuantConnect and this is my first community post. I'm working on building a strategy that needs to identify when a high high or a low low trend is identified. The system needs to be able to look back to a certain number of candles and ensure that there is enough distance between point a and point b in order for it to be considered valid. See attached. 

157910_1622729875.jpg

 

I've been doing some research and came across a python library called argrelextrema which I'm pretty sure I need to use but I can't figure out how it works exactly. I'm hoping someone can give me an example of this being implemented in a backtest.

Thanks in advance :) 

Author