While it may be overkill, I have been attempting to convert the code to a strategy and add a button to execute the trade with the associated calculated amount, but based on the current account balance.
I'm running into a few headaches.
If I get it done, I will share the update.
Thanks again!
Mike