Pinescript code modification

Job ID: 35664735

Budget: $10 – $11 USD

I want help making a simple modification to the open source half trend pinescript code

I want the script to cycle through altitude values 1-50 and test the last 10 buy and sell signals and see what amplitude value had the best performance (Best performance determined by the number of buy and sell signals that ended in profit) and then print it the best altitude value as a label. The script is attached
Related categories: C# Programming Coding Pine Script Trading