I am using the REST API with Python with just under $20k in my live account. As of right now, my trading process with Alpaca is:
- Buy stocks during regular market hours
- Submit 4% trailing stop orders at the end of regular market hours
I repeated this process for 7 trading days on my paper trading account without issue and just switched over to the live account today. Step 1 worked fine with the REST API, but now I am trying to submit trailing stops and keep getting [“alpaca_trade_api.rest.APIError: trade denied due to pattern day trading protection”].
I’m confused because (1) I am not actually selling, only submitting trailing stops on stocks, and (2) the User Protections doc mentions these same issues should have shown up during paper trading if doing so would have raised errors, which it never did.
Interestingly enough, of the 11 stocks I was trying to submit the trailing stops for (all of which I bought today during market hours), 3 were accepted–the same 3 that ended the day in the red. The other 8 that ended in the green are the specific ones that are rejecting my trailing stop orders. Not sure if this is a related issue, but thought I should include.
Day trading is opening a position (or adding to a position) and closing (or reducing) the same position within a single day. After hours trading is technically considered the same day. I’m sure that’s nothing new but wanted to state it.
If you have less than $25k in an account do not day trade. Do not even allow the possibility that your algo may day trade. There are exceptions, one can actually have 3 day trades in the current 5 day rolling window. However, the consequences can be a 90 day account suspension. That’s not negotiable and there are no ‘second chances’. You don’t want that.
So, you should probably change your trading process to be
- Buy stocks during regular market hours
- Submit 4% trailing stop orders after regular market hours
Even though you may not be intending to sell, there is the possibility, no matter how small, that the trailing stop order will trigger. This could create a day trade. The user protections are there to prevent entering that order just in case.
This should have surfaced in paper trading. More than likely, your paper trading account had more than $25k in equity. The paper account would have been able to day trade so the orders would have gone through. Ensure your paper account has about the same equity as a live account to get a good comparison.
Hope that helps. Good luck.
Hey Dan, thanks for the response. In my case, I was submitting after market hours if that wasn’t clear. I am in Pacific Time and attempted to submit the orders at 1:32pm PST (after market hours) and the three that I mentioned above were accepted, while the other eight were rejected. I tried numerous times after posting this thread to submit the trailing stops for those other eight stocks and they weren’t accepted until 10:26pm PST (my guess for this reason is EST had switched over to the next day).
I’ve attached a small screenshot of my order history. From the bottom up, DRE was a stock I had purchased at 12:45pm PST (3:45pm EST) right before market close. Then I submitted trailing stops at 1:32pm PST, one of which was for the aforementioned just purchased stocks (DRE). The three that were accepted [DRE, PLD, ADBE] were the 3 stocks I mentioned yesterday that the trailing stops were accepted for. It wasn’t until 10:26pm PST that the trailing stops for the other 8 stocks were accepted, the first of which was SYK.
I completely understand pattern day trading and intentionally decided to buy during regular market hours and set trailing stops after regular market hours as shown above. Would it be possible for you to look a little into this?
I appreciate the clarification on the paper trading error raise discrepancy, I had kept it at the $100k default balance and is likely why this error was not raised before.
@Dan_Whitnable_Alpaca any update on this? I’m running into the same issue again today. Trailing stop orders placed after market hours for stocks bought during market hours are being rejected.
The timing of a day trade is defined as trading within the full day including after market hours. However, that isn’t the exact case here.
I haven’t looked at the specific orders, but from your (very good) description I believe the day trade protections are kicking in and not allowing you to place a closing order the same ‘day’ (even though it is after hours). The protections may be a bit too restrictive and or a bit smarter. They should maybe allow one to submit an after hours order knowing that it cannot fill the same day. I believe they are just looking at the 'side 'of the order and not any parameters which would preclude it from trading today. I’ll raise this as an issue and see how it could maybe be improved.