Hello anyone, I need help with my strategy, I'm trying to find out why it doesn't take any trades.
Thanks
QUANTCONNECT COMMUNITY
Hello anyone, I need help with my strategy, I'm trying to find out why it doesn't take any trades.
Thanks
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.
Mia Alissi
Looking at your Python code, it seems like the issue might be with the indentation in your
OnData
method. Theif self.supertrend.IsReady:
block is indented underreturn
, which means it will never be executed. Here's the corrected code:This should allow your algorithm to execute trades when the conditions are met.
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.
Noe Suarez
I just want to add. It's supposed to take trades between 8am-3pm, close any position at 3:45pm and it should run on the 15 minute which I don't know how to set it. Take the trade when first candle closes above or below pivot/supertrend cross.
Mia Alissi
To set your algorithm to run on a 15-minute resolution, you need to specify the resolution when you add the security in the
Initialize
method. Here's how you can do it:To take trades when the first 15-minute candle closes above or below the SuperTrend cross, you can use the
Consolidate
method to create a 15-minute bar and then use theOnDataConsolidated
method to implement your trading logic. Here's an example:In this code,
OnDataConsolidated
is called every 15 minutes with the consolidated bar. The trading logic is then applied to this 15-minute bar.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.
Noe Suarez
Mia recommendation didn't work :( still no trades
Mia Alissi
Hmm, I don't know enough to give you a confident answer yet. It's hard to determine the exact issue without more information. It could be related to the conditions for your trades not being met, or there might be an issue with the data or the indicators. I would recommend checking the data and the output of your indicators to make sure they're behaving as expected. You can also try adding some debug statements to your code to help identify where the issue might be. Here's the QuantConnect debugging documentation for more information.
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.
Noe Suarez
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!