Exiting Trades held for multiple days blocked due to Patter Day Trader (PDT) protection

I have a multi-day (not day trading) long-short strategy in paper trading with less than $25k.

I entered the market last week and held until now. Now that it has provided returns the algo is trying to exit completely to lock in those returns, but being blocked due to PDT.

Error: trade denied due to pattern day trading protection.

By my reading of the PDT, this doesn’t make sense.


The rules adopt the term “pattern day trader,” which includes any margin customer that day trades (buys then sells or sells short then buys the same security on the same day) four or more times in five business days…
(emphasis added)

Each security was bought (or sold short) last week, and is now being sold (or bought) to exit. So this should not flag PDT.

What am I missing?

I have had a similar issue, I tried to place sell orders to be executed tomorrow for stocks purchased during the day, which should not cause an issue as the sell orders won’t be executed in the same day. I have not had this issue on other platforms, can anyone answer this?

Turns out I had a bug in my code and was indeed submitting multiple orders for the same security on the same day when trying to exit. Switching to close_all_positions() fixed my issue.