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;