The basic premise is, I want to write a python script that trades options using EMAs (it doesn't matter the EMA)? I would like for the script to buy calls when the short EMA crosses above the long EMA, and RSI is above 54.
I would like the script to buy puts when the 13 EMA crosses under the 48 EMA, and RSI is below 46. All options should have a trailing 10% stoploss, and positions should only use 10% of holdings.
I have worked all of the exceptions out of the script, but no purchases are being made. I'm currently only testing this on single options, but may select an options universe in the future. Any help would be greatly appreciated.
Nico Xenox
Hey Courtney Lomax,
please try to debug your code before asking for help. I had to rewrite your whole code before it was able to invest in the market. I changed the majority now the only thing you have to check is the num_contracts and why it only invests one time (might be because of the if statements you have set up).
I added a chart that shows ema, buys/sells and rsi.
Also be careful, OptionChainPrivoder is not the same as just accessing the keys from the option Chains
Happy coding ;)
Best,
Nico
Courtney Lomax
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!