PureBytes Links
Trading Reference Links
|
Hello,
Built-in RSI does not accept variable periods, however it is easy to write variable-period counterpart in AFL:
function RSIV( array, periods )
{
Diff = array - Ref( array, -1 );
Up=IIf( diff > 0, diff, 0 );
Dn=IIf( diff < 0, -diff, 0 );
Ut=AMA( Up, 1/periods );
Dt=AMA( Dn, 1/periods );
return 100*(Ut/(Ut+Dt));
}
Graph0 = RSIV( C, 15 ); // periods parameter can be variable
Graph1 = RSIa( C, 15 );
Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message -----
From: "kubikconcepts" <kubikconcepts@xxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Friday, October 22, 2004 9:58 PM
Subject: [amibroker] How to dynamically adapt the RSI periods?
>
>
>
> Hello,
> I have the following code. I am new to trading systems and
> amibroker. I am trying to write a system using borrowed ideas that
> will tune itself on a period by period basis. I am running into a
> problem because the last stochrsi calculation will not work. The
> RSI takes periods which is required to be a number. However in AFL
> the periods is an array. Can anybody suggest way to work around
> this problem and have a dynamically tuned periods for the RSI?
>
> Thanks.
>
> standarddev= 60;
> periods= 14;
>
> StochRSI=(RSI(periods)-LLV(RSI(periods),periods))/(HHV(RSI
> (periods),periods)-LLV(RSI(periods),periods));
>
> rdp1=Round(Stdev(stochrsi,standarddev)/.053);
> rdv1=Round(Stdev(MA(V,periods)/1000000,standarddev));
>
> adjust1= rdv1-rdp1+11;
> adjust1=iif(adjust1<8,8,adjust1);
> adjust1=iif(adjust1>12,12,adjust1);
>
> periods=adjust1;
>
> StochRSI=(RSI(periods)-LLV(RSI(periods),periods))/(HHV(RSI
> (periods),periods)-LLV(RSI(periods),periods));
>
>
>
>
>
>
>
>
>
> Check AmiBroker web page at:
> http://www.amibroker.com/
>
> Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
> Yahoo! Groups Links
>
>
>
>
>
>
>
>
------------------------ Yahoo! Groups Sponsor --------------------~-->
$9.95 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/J8kdrA/y20IAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~->
Check AmiBroker web page at:
http://www.amibroker.com/
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> 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/
|