--- In [email protected], "jeffro861" <[EMAIL PROTECTED]> wrote:
>
> How to I get RSI() to take an array as an arguement? Let's say I have
> a function that I want to use for determining the number of bars RSI()
> uses (it which changes for every bar). How do set this up?
I don't remember where I found this code but I think it does what you
want.
//period is an array
function varPeriodRSI( priceField, period )
{
Chg = priceField - Ref( priceField, -1 );
pc = Max( Chg, 0 );
nc = Max( -Chg, 0 );
pa = AMA( pc, 1/period );
na = AMA( nc, 1/period );
return 100 * pa / ( pa + na );
}