Id like to make a indicator like this photo, but i would like to see if i can make it better, where it would only pick higher lowes and lower lows. So instead of the first pic, more like the pick under it.
My two cents: put all the lows in an array and let your code check if a certain low has 'neighbours' that are higher / lower.
An example: these are the bar lows of the last 15 bars:
[ 5, 7 ,7, 4 ,5 ,6 ,6 ,7 ,6 , 11, 5, 5, 6, 7, 6]
A for-loop would check each number. When it arrives at 4, the code checks 2 neighbours on the left and finds those are higher. So this 4 is considered a possible 'DrawCandidate'. For now at least.
Because immediately afterwards the same for-loop also checks the 4's neighbours on the right. Both of those are also higher, so that 4 now becomes an 'official Low', and is used as starting coordinate for a new line.
Code continues its calculations until it arrives at the 11: all four of it's neighbours are lower, so the 11 becomes an 'official High', being used as endpoint for a line (and also as starting point for the following line)
Obviously, you would have to take into account the 'outliers', and the 'weight' (number of neighbours to check), so include those early on in your code.
you may create an indicator if you can define a formula behind the low/high points selection. It could be a simple math formula or a complicated model as a byproduct of a machine learning algorithm. the selection of the points on your desired chart is not straight forward to me. I suspect this is a hindsight result. There are some MW studies out of the box that do a decent job and might be helpful for your trading. For example: Swing Points, Zig Zag.