Hey, team!

My question is in regards to withdrawing money with one's script. Let's say I want to withdraw money if my portfolio 1exceeds 1000 dollars, or withdraw money at the end of each month. Is there a way of doing so? And if so, how would one best simulate it in a backtest?

(I'm using Coinbase Pro as my broker)

Thanks In Advance!