I just want to share with the community this algo I created to detect triangle patterns. It's a proof of concept that detects peaks of highs and valleys for lows for a given period, and once a negative angle for highs combined with a positive angle for lows it places an order to buy.

I would appreciate any ideas to improve the identification of triangles

Please note this algo can be cpu intensive