You’ll have to actually understand at least a little what the percentage means.
Thoughts on optimizing gain
The script changes gain until the percentage mentioned is in the range of 1% to 5%, so seems like your current gain meets that goal.
It’s all a compromise, there is no one best setting.