my strategy is simple, just check if the 30min bar closing price is above or below both the short and long MA and enter trade accordingly. After the backtest I realize there are two problem:
1) From the backtest log, I see that the trades are not entered on 00min or 30min. So I wonder I have set this up correctly.
2) The backtest stopped since Nov 7, but my backtest test is setup to run to current time.
Thanks everyone for your help.
Alexandre Catarino
In your algorithm, the logics resides on OnData event handler that fires every minute. There, we are comparing the price thar changes every minute against the indicators that change every 30 minutes, if the conditions are met, a trade is placed.
In order to fix that, we need to move the logics into a event handler that fires every 30 minutes. Please checkout the attached project.
By default, forex data comes from FXCM. It is outdated, but we are working on updating it this week. Please use Oanda data instead:
Symbol symbol = QuantConnect.Symbol .Create("USDJPY", SecurityType.Forex, Market.Oanda); AddForex(symbol, Resolution.Minute);
Alexandre Catarino
Please use this pattern for selecting the market:
var forex = AddForex("USDJPY", Resolution.Minute, Market.Oanda); symbol = forex.Symbol;
instead of Symbol.Create method, since it can create the wrong Symbol object for securities with complex mappings. It is not the case for forex, but we should prefer patterns that are safer across all security types.
Jim chan
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!