Hello
Basically here my idea is to generate consistent option income with a covered call.
Except it is going to be slightly speculative as I change the strike / delta of the sold call depending on a weekly check of price Vs 200 Days SMA.
When the market is deemed to be bearish it will try to over perform by selling an in the money call and when bullish it will sell an OTM call to benefit from the stocks's price rise.
Maybe I should add a contract number calculator like this:
current_price = self.Securities[self.symbol].Price
# Determine the number of shares we can afford available_cash = self.Portfolio.Cash
nbr_shares = int(available_cash / current_price) if nbr_shares < 100: self.Log("Not enough cash to buy 100 shares.") return
# Calculate number of contracts we can sell
nbr_contracts = nbr_shares // 100
Have a nice week start :)
Mia Alissi
The Python code you provided for your Covered Call with SMA Strategy seems to be logically sound. It correctly implements the logic of selling in-the-money calls when the market is bearish and out-of-the-money calls when the market is bullish, based on the comparison of the current price with the 200-day SMA.
However, there's a part of the code that seems to be incomplete. The last line of the code checks if the contract is not invested, but it doesn't specify what to do if that's the case. You might want to add the logic for that scenario.
As for the contract number calculator you proposed, it seems to be a good idea. It calculates the number of shares that can be bought with the available cash and then determines the number of contracts that can be sold based on that. Just make sure to implement this logic in the appropriate place in your algorithm.
Remember to test your algorithm thoroughly and adjust the parameters as needed to optimize its performance.
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.
AlMoJo
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!