Hi,
I see that the opening range breakout video is in the US Equites section of the boot camp. However can modifications be made to it so that I can use it on forex pairs?
Thank you
QUANTCONNECT COMMUNITY
Hi,
I see that the opening range breakout video is in the US Equites section of the boot camp. However can modifications be made to it so that I can use it on forex pairs?
Thank you
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
Yes, you can modify the Opening Range Breakout strategy to work with forex pairs. Here's an example of how you can do it:
This code is similar to the original Opening Range Breakout strategy, but it has been modified to work with the EURUSD forex pair. The
AddForex
method is used to add the forex pair to the algorithm, and theSetBrokerageModel
method is used to set the brokerage model to Oanda, which supports forex trading. TheOnData
method checks if the close price of the EURUSD pair is above or below the high or low of the opening bar, and sets the holdings accordingly. TheClosePositions
method is used to liquidate the position at a specific time each day.Please note that the forex market operates 24 hours a day, so you might need to adjust the time in the
OnDataConsolidated
method to match the opening time of the forex market you are interested in.Source: QuantConnect Forum Discussion
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.
Warren chapman
This is my work so far and the code runs without any errors but does not trade
Mia Alissi
Your code seems to be correct in terms of syntax and logic. However, there are a few things you might want to check:
Time Zone: Forex trading operates 24 hours a day, so the opening time might be different depending on the time zone. Make sure the time you set in
OnDataConsolidated
andClosePositions
matches the opening and closing time of the forex market you are interested in.Data Availability: Make sure the data for the forex pair "XAUUSD" is available for the date range you set in
SetStartDate
andSetEndDate
.Trading Volume: Check if there is enough trading volume for the forex pair "XAUUSD" during the time you want to trade. If the trading volume is too low, the price might not move significantly, and the algorithm might not make any trades.
Opening Range: The opening range is defined as the highest and lowest price of a security during the first part of the trading day. In your code, you are using the 30-minute bar as the opening range. You might want to adjust this depending on the volatility of the forex pair.
If you have checked all these points and the algorithm is still not making any trades, you might want to debug your code to see if the
OnData
method is being called and if the conditions for making a trade are being met. You can use theDebug
method to print out the values of variables and see the flow of your code.Here is an example of how you can use the
Debug
method:This will print out debug messages in the algorithm logs, which you can view in the "Logs" tab in the backtest results. This can help you understand why the algorithm is not making any trades.
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.
Warren chapman
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!