Hello anyone and everyone! New to this community, slowly learning the stock-trading Python commands.
I am having trouble with building a model that executes a buy of a stock after that stock has dropped. It must be according to the following logic:
1. Find Stock Ticker (we will use the ticker "STK" for this example)
2. Find open and close price of STK at each n increments (open price at start of 15 min candle vs close price at same 15 min candle). Any time resolution can be used.
3. IF (close price of stock at end of time increment < open price of stock at beginning of time increment):
Place a market buy of the stock for the dollarAmountLost*(1.05). The market buy value is a dollar amount and would need to be rounded to the nearest share
In other words, if the stock drops over a specified time period, replace the dollar amount that was lost plus 5 percent as a share equivalent. Ideally the percent can be stored as a variable so it can be adjusted.
4. Print("You have placed an order for n shares of "STK" at time that order was placed)
Any help would be appreciated!
- Jay
Jay gunjal
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!