Hello I want a day-trading algorithm that I can trade live. I'm going to run this algorithm live by connecting my QuantConnect account to my Schwab trading account. Is it possible for you to code an algorithm like this for me?
I want the algorithm to put together a watchlist one second after 9:30 ET, right after the market opens. To make the watchlist, I want the algorithm to look at three websites. Any stock listed on benzinga.com/premarket in the “Premarket Gainers” section with a “+/-” that is 10% or higher, I want that stock added to my watchlist. Any stock listed on marketchameleon.com/Reports/PremarketTrading in the “Most Active” section or the “Gainers” section with a “% Chg” that is +10% or higher, I want that stock added to my watchlist. Any stock listed on https://www.investing.com/equities/pre-market after you switch over to the “United States Stocks” tab that is +10% or higher, I want that stock added to my watchlist.
I only want the watchlist to include stocks that had $10,000,000 dollar volume during the premarket hours this morning. And I only want the watchlist to include stocks that opened at a share price of $0.75 or higher at the start of regular trading hours this morning.
Once that watchlist is compiled, I want the algorithm to set a buy order for every single stock on the watchlist. The buy order needs to be exactly 10% above the opening share price of the stock. I need the buy order to be for $10 worth of the stock based on the buy price.
Then I want the algorithm to monitor every 10 seconds for when any of the buy orders gets executed. If a buy order is executed, I want the algorithm to immediately set an order-cancels-order exit order. The two prices for this order-cancels-order setup should be exactly 40% above the stock's opening price and exactly 5% above the stock's opening price.
20 seconds before market close, I need the algorithm to liquidate all positions that are currently open as long as they are not the symbol TQQQ and then cancel any orders that are remaining.
Can you code this strategy for me please? Thanks!
Mia Alissi
Here’s a complete algorithm you can paste into QuantConnect. It follows your requirements: builds the watchlist at 9:30:01 ET from the three premarket pages, filters for ≥$10M premarket dollar volume and RTH open ≥ $0.75, places $10 buy stop orders 10% above the open, and on fills sets an emulated OCO with a take-profit at 1.40× open and a stop at 1.05× open, then performs a 20-seconds-before-close cleanup (skipping TQQQ). Notes:
Copy this code into a new Python project in QuantConnect:
from AlgorithmImports import *
class PremarketBreakoutOCOSchwab(QCAlgorithm):
Would you like me to:
Sources: Empty Equity And Options400 Benchmark, Basic Template Crypto Algorithm, Order Tickets - QuantConnect.com, Interactive Brokers - QuantConnect.com, Stop Limit Order Regression Algorithm
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Retrospective Green Ocelot
Thanks!
Retrospective Green Ocelot
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!