Sorry i'm a newbie ...
I have a small problem, which is probably very easy to solve:

How can I query past values, here the indicator value KAMA from before n candles correctly and then use it again?
My state of knowledge: I define a series (here: vars kama = KAMA(Price,10) and can then address a certain point in time n (shift or candles in the past) with series[n] (here: kama[n]).

The following part of my script:
Code:
vars Price = series(priceClose());
vars kama = KAMA(Price,10);
var close_kama(int n)
 {
	return  kama[n] / priceClose(n);
 }

vars cycle = DominantPeriod(Price,100);
var cycle_multi = 2;
var close_res(int n)
{
	return priceClose(n) / HH(cycle[n]*cycle_multi,n+1);
}

var close_sup(int n)
{
	return priceClose(n) / LL(cycle[n]*cycle_multi,1);
}


causes the following error:
Code:
Error 111: Crash in function: close_kama() at bar 0



What am I doing wrong?
Everything?
grin