[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Re: functions to take an array as a parameter



PureBytes Links

Trading Reference Links

--- In amibroker@xxxxxxxxxxxxxxx, "jeffro861" <jeffro861@xxx> 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 );
}



Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html
 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/