My first thought is that the variables have the same name, which is a bad habit. This is how I handle dynamic risk. If the account balance is over x%, I take the base percent and add whatever I want and store that in a local variable. If the account balance is less than X%, then I restore the local variable back to the base setting, as not to over risk.
image.png
image.png