I suspect there may be a flaw in your logic here. There is no proper entry, exit, re-entry mechanism.
f current_price > (1.01 * average_price):
OK so far: you enter.
lif current_price > (costBasis * 1.01)
This can happen in a nano-second with an instrument of this volatility.
What happens next? The stock continues up and you simply re-enter the next day. Perhaps at a higher price.
Perhaps that is what was intended. And of course if the stock goes sharply down after your exit or overnight, well great.
But....perhaps you should think about the profit target bit. Is that what you really mean to happen? In a rising market do you want to keep enering and exiting?
No real comment from me. Just a query