Originally Posted By: MatPed
Not sure, but try to change price[0] in price. Ema need a serie to be calculated.

Ciao


Ok. I re-code.
----------------------
function run()
{
BarPeriod = 40; // 6 hour bars
//settings parameters and indicators

var* Price = series(price());
int emaper = optimize(9, 14, 21);
int xatr = 1;
int numatr = 3;
int numback = optimize(5, 2, 6);
//weigth indicator by volatility
var EMA1 = EMA(Price, emaper);//EMA calculated with series()
vars TrendLine = ((EMA1[0] / EMA1[numback]) - 1) / (xatr * ATR(numatr));
---------------------------------------------------
Zorro 1.50.6 Trading Automaton
Made with Gamestudio by oP group 2015


TFscript compiling.........
Error in 'line 18:
subscript requires array or pointer type
< vars TrendLine = ((EMA1[0] / EMA1[numback]) - 1) / (xatr * ATR(numatr));
>.

Best
Edilson