I need help adding with my code to prevent pattern day trading. Basically, I want to implement the following on the attached code

1: Once I buy a stock, hold it for at least one day before selling (even if it meets the selling condition before one day is over)

2. If I sell a stock, wait at least one day before repurchasing the same stock (even if it meets the buying condition before one day is over after selling)

Will appreciate any help I can get