Page 1 of 1

EL error

Posted: Sep 12 2010
by NiC72
The indicator is very small but I can not work .. Any suggestions?

/NiC

Code: Select all

Input: Period(Numeric);
AMA_Q = IFF(CurrentBar <= Period, Close, AMA_Q[1] + Power(((AbsValue(Close - Close[Period]) /
Summation(AbsValue(Close - Close[1]),period) * .6022) + .0645),2) * (Close - AMA_Q[1]))

Re: EL error

Posted: Sep 12 2010
by TJ
The indicator is very small but I can not work .. Any suggestions?

/NiC

Code: Select all

Input: Period(Numeric);
AMA_Q = IFF(CurrentBar <= Period, Close, AMA_Q[1] + Power(((AbsValue(Close - Close[Period]) /
Summation(AbsValue(Close - Close[1]),period) * .6022) + .0645),2) * (Close - AMA_Q[1]))

this is a function.

Re: EL error

Posted: Sep 12 2010
by sptrader
The indicator is very small but I can not work .. Any suggestions?

/NiC

Code: Select all

Input: Period(Numeric);
AMA_Q = IFF(CurrentBar <= Period, Close, AMA_Q[1] + Power(((AbsValue(Close - Close[Period]) /
Summation(AbsValue(Close - Close[1]),period) * .6022) + .0645),2) * (Close - AMA_Q[1]))

**********
Once you save the function above - you can plot the function on a chart with this indicator -

Input:Len(10);
Plot1(ama_q(len),"ama_q");

Re: EL error

Posted: Sep 13 2010
by NiC72
My fault, I apologize.
I have it like a function. But it becomes wrong when I call the function.
Get some "invalid floating point"

/ NiC

Re: EL error

Posted: Sep 13 2010
by TJ
1. make sure your denominator does not equal to zero. (don't be lazy, add a conditional check.)

2. make sure you compile your function with storage as series.

Re: EL error

Posted: Sep 13 2010
by NiC72
Thanks TJ,
You were right (as usual). I did a check and it worked.
My minutes data is bad :-/

Re: EL error

Posted: Sep 13 2010
by TJ
I usually add this denominator check:

Code: Select all

if denominator <> 0 then
value1 = numerator / denominator
else
value1 = 0;

Re: EL error

Posted: Sep 13 2010
by NiC72
Thanks, it will be useful.