Hello,
I am trying to backtest an algorithm I am experimenting with. Its basically an EMA cross algorithm
based on the example given and while it compiles ok, it takes no trades when backtested and
produces no results. There is a runtime error :=
Runtime Error: Must be between 0 and Count 0
Parameter name: i
0 (Open Stacktrace)
Which I am not sure what it means. There is a variable "i" in the program but it is initialized to 0.
Also, I would like help in setting up stop loss orders. I would like to know how to
setup a stop loss order for a long and a short position based on ATR.
So something like this EasyLanguage code :=
ATR = AvgTrueRange(10);
...
If Condition1 Then
Buy ("Long") Next Bar at Open Tomorrow + Trigger * ATR Stop;
Thank
Roger
Jared Broad
// Do our calculations. // this next line says each time we get a new ema value, add it to our window Avg1.Updated += (sender, args) => window.Add(args); // this next line says each time we get a new ema value, add it to our window Avg2.Updated += (sender, args) => window2.Add(args); // this next line says each time we get a new atr value, add it to our window atr.Updated += (sender, args) => atr_win.Add(args);
See this thread for lots of examples of stop, limit and market orders: https://www.quantconnect.com/forum/discussion/623/feature-ordertickets-and-updating-orders#Item_20The 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.
Roger Doss
Roger Doss
Michael Handschuh
Roger Doss
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!