Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
HELP! Very specific question for order entry

My problem is, I want to trade ONLY the first sma cross of the day IF it occurs in the first hour. I place a limit order and give it 5 minutes to fill before cancelling the order. Regardless of whether I have shares or not, I do not want to place another order on a second cross in the first hour.

Examples..

1) Price crosses sma at 9:45am, I place a limit order and get a partial fill, if it crosses again before 10:30am and I have shares already, it does not buy more.

2) Price crossess sma at 9:45am, I place a limit order and NONE are filled, if it crosses again before 10:30am, it checks and sees that I have no shares, and then places an order.... I still don't want to place another order but I don't know how to do this.

Basically, I want to buy ONLY at the FIRST sma cross of the day if it occurs before 10:30am.

Thank you!