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

RE: [amibroker] passing variables



PureBytes Links

Trading Reference Links







Hi Sid:

I added this to my function file:

function StoRSI(RSIPer,EMAPer)

{

Low1=LLV(C,7);

High1=HHV(C,7);

return (EMA(100*(C - Low1)/(High1 - Low1),EMAPer)/2) + (RSI(RSIPer)/2);

}

Note the naming and the variable positions in the declaration of the StoRSI function.

I plotted this in my IB window:

X=StoRSI(14,13);

Plot(50,"",7,1);

Plot(X,"StoRSI",5,1);

The C/O/H/L/V arrays are always available, so I only "passed" two variables, the EMA period and the RSI Period.  It gets "passed" when you write the function within your regular AFL code.  In my case, following what a lot of others do, I #include a regular (and growing) MyFunctions.AFL file.

Hope this helps.

Ken



-----Original Message-----
From: Sidney Kaiser [mailto:s9kaiser@xxxxxxxxxxx]
Sent: Wednesday, December 24, 2003 12:02 PM
To: AmiBroker@xxxxxxxxxxxxxxx
Subject: [amibroker] passing variables

I use StochRSI fairly often and rather than re-write it all the time I 

decided to make a dedicated AFL file that I can include in the other files 

where I want to use the function.  Of course to be of any use, the 

variables need to be passed from the calling program to the included 

program.  I know how to do that in TS, but I don't see how to do it in AFL.

For my StochRSI fn I would want to pass the Array (usually Close), the RSI 

period and the smoothing MA to the include file.  Three variables in all.

How is this done?

TIA

Sid

Send BUG REPORTS to bugs@xxxxxxxxxxxxx

Send SUGGESTIONS to suggest@xxxxxxxxxxxxx

-----------------------------------------

Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 

(Web page: http://groups.yahoo.com/group/amiquote/messages/)

--------------------------------------------

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/ 




Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
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 the Yahoo! Terms of Service.