The outcome of this script is the percentage of the gain/loss if trades were taken on HLC crossover and sold on HLC crossunder.
It does compute a lot of stuff so it is slow, but it is faster than testing all combinations 1 by 1 😀
Good luck finding the best value for your settings. Please share in the comments which settings gave you the best result!
In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.