I am trying to implment the wheel strategy, but I am not able to get the algo to run.

The strategy:
1- Sell OTM put option around -30 Delta.
2- If you get assigned the put, then sell a call option at the same strike as the assigned put (Share purchase price).
3-  repeat untill the call is excericed then goto step 1

I have tried diffrent code and logic, but I was mostly getting runtime errors or weird results. The code below runs without errors, but it doesn't place orders. Your help is appriciated.
I have been away from programing for awhile so I kinda hacked this code together mostly from Tutorial: Applied Options Bull Call Spread ... just an FYI :)