PureBytes Links
Trading Reference Links
|
Sid,
There is absolutely NO problem with that.
You can use optimize and pass arguments to ANY function
defined in external file.
#include <file_with_your_function.afl>
param1 = Optimize("param1", 5, 1, 10, 1 );
buy = C > MyFunction( param1 );
Best regards,Tomasz Janeczkoamibroker.com
<BLOCKQUOTE
>
----- Original Message -----
<DIV
>From:
Sidney
Kaiser
To: <A title=amibroker@xxxxxxxxxxxxxxx
href="">amibroker@xxxxxxxxxxxxxxx
Sent: Wednesday, December 24, 2003 10:07
PM
Subject: RE: [amibroker] passing
variables
<FONT face="Century Schoolbook, New Century Schoolbook"
size=3>Clarification:What I am talking about is the ability to run
optimize on the code that is in the include file. This means the
variables are defined in the main program and the current value is passed to
the include program for the range of the optimization.Upon further
reading of the help files I am beginning to think this is NOT possible in
AB. Someone correct me if I am wrong on this.Ken, thanks for
your routine, BTW, I think what you posted is STOCH + RSI rather than
StochRSI which is the stochastic of RSI.Cheers and Merry Christmas to
allSidAt 03:28 PM 12/24/2003 -0500, you wrote:
<FONT face="Courier New, Courier"
size=2>Hi Sid:<FONT
face="Century Schoolbook, New Century Schoolbook" size=3><FONT
face="Courier New, Courier" size=2>I added this to my function
file:<FONT face="Century Schoolbook, New Century Schoolbook"
size=3><FONT face="Courier New, Courier" color=#800000
size=2>function
StoRSI(RSIPer,EMAPer)<FONT
face="Century Schoolbook, New Century Schoolbook" size=3><FONT
face="Courier New, Courier" size=2>{<FONT
face="Century Schoolbook, New Century Schoolbook" size=3><FONT
face="Courier New, Courier" size=2>Low1=<FONT
face="Courier New, Courier" color=#0000ff size=2>LLV<FONT
face="Courier New, Courier" size=2>(<FONT face="Courier New, Courier"
color=#ff0000 size=2>C<FONT face="Courier New, Courier"
size=2>,<FONT face="Courier New, Courier" color=#ff00ff
size=2>7<FONT face="Courier New, Courier"
size=2>);<FONT
face="Century Schoolbook, New Century Schoolbook" size=3><FONT
face="Courier New, Courier" size=2>High1=<FONT
face="Courier New, Courier" color=#0000ff size=2>HHV<FONT
face="Courier New, Courier" size=2>(<FONT face="Courier New, Courier"
color=#ff0000 size=2>C<FONT face="Courier New, Courier"
size=2>,<FONT face="Courier New, Courier" color=#ff00ff
size=2>7<FONT face="Courier New, Courier"
size=2>);<FONT
face="Century Schoolbook, New Century Schoolbook" size=3><FONT
face="Courier New, Courier" color=#800000 size=2>return<FONT
face="Courier New, Courier" size=2> (<FONT
face="Courier New, Courier" color=#0000ff size=2>EMA<FONT
face="Courier New, Courier" size=2>(<FONT face="Courier New, Courier"
color=#ff00ff size=2>100<FONT face="Courier New, Courier"
size=2>*(<FONT face="Courier New, Courier" color=#ff0000
size=2>C - Low1)/(High1 -
Low1),EMAPer)/<FONT face="Courier New, Courier" color=#ff00ff
size=2>2) + (<FONT
face="Courier New, Courier" color=#0000ff size=2>RSI<FONT
face="Courier New, Courier" size=2>(RSIPer)/<FONT
face="Courier New, Courier" color=#ff00ff size=2>2<FONT
face="Courier New, Courier" size=2>);<FONT
face="Century Schoolbook, New Century Schoolbook" size=3><FONT
face="Courier New, Courier" size=2>}<FONT
face="Century Schoolbook, New Century Schoolbook" size=3><FONT
face="Courier New, Courier" size=2>Note the naming and the variable
positions in the declaration of the StoRSI function.<FONT
face="Century Schoolbook, New Century Schoolbook" size=3><FONT
face="Courier New, Courier" size=2>I plotted this in my IB
window:<FONT face="Century Schoolbook, New Century Schoolbook"
size=3><FONT face="Courier New, Courier"
size=2>X=StoRSI(<FONT face="Courier New, Courier" color=#ff00ff
size=2>14,<FONT
face="Courier New, Courier" color=#ff00ff size=2>13<FONT
face="Courier New, Courier" size=2>);<FONT
face="Century Schoolbook, New Century Schoolbook" size=3><FONT
face="Courier New, Courier" color=#0000ff size=2>Plot<FONT
face="Courier New, Courier" size=2>(<FONT face="Courier New, Courier"
color=#ff00ff size=2>50<FONT face="Courier New, Courier"
size=2>,<FONT face="Courier New, Courier" color=#ff00ff
size=2>"",<FONT
face="Courier New, Courier" color=#ff00ff size=2>7<FONT
face="Courier New, Courier" size=2>,<FONT face="Courier New, Courier"
color=#ff00ff size=2>1<FONT face="Courier New, Courier"
size=2>);<FONT
face="Century Schoolbook, New Century Schoolbook" size=3><FONT
face="Courier New, Courier" color=#0000ff size=2>Plot<FONT
face="Courier New, Courier" size=2>(X,<FONT
face="Courier New, Courier" color=#ff00ff size=2>"StoRSI"<FONT
face="Courier New, Courier" size=2>,<FONT face="Courier New, Courier"
color=#ff00ff size=2>5<FONT face="Courier New, Courier"
size=2>,<FONT face="Courier New, Courier" color=#ff00ff
size=2>1<FONT face="Courier New, Courier"
size=2>);<FONT
face="Century Schoolbook, New Century Schoolbook" size=3><FONT
face="Courier New, Courier" size=2>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.<FONT
face="Century Schoolbook, New Century Schoolbook" size=3><FONT
face="Courier New, Courier" size=2>Hope this helps.<FONT
face="Century Schoolbook, New Century Schoolbook" size=3><FONT
face="Courier New, Courier" size=2>Ken<FONT
face="Century Schoolbook, New Century Schoolbook"
size=3>-----Original
Message-----From: Sidney Kaiser [<A
href="">mailto:s9kaiser@xxxxxxxxxxx]Sent:
Wednesday, December 24, 2003 12:02 PMTo:
AmiBroker@xxxxxxxxxxxxxxxSubject: [amibroker] passing
variables<FONT face="Century Schoolbook, New Century Schoolbook"
size=3>I use StochRSI
fairly often and rather than re-write it all the time I <FONT
face="Century Schoolbook, New Century Schoolbook" size=3><FONT
face="Courier New, Courier" size=2>decided to make a dedicated AFL file that
I can include in the other files <FONT
face="Century Schoolbook, New Century Schoolbook" size=3><FONT
face="Courier New, Courier" size=2>where I want to use the function.
Of course to be of any use, the <FONT
face="Century Schoolbook, New Century Schoolbook" size=3><FONT
face="Courier New, Courier" size=2>variables need to be passed from the
calling program to the included <FONT
face="Century Schoolbook, New Century Schoolbook" size=3><FONT
face="Courier New, Courier" size=2>program. I know how to do that in
TS, but I don't see how to do it in AFL.<FONT
face="Century Schoolbook, New Century Schoolbook" size=3><FONT
face="Courier New, Courier" size=2>For my StochRSI fn I would want to pass
the Array (usually Close), the RSI <FONT
face="Century Schoolbook, New Century Schoolbook" size=3><FONT
face="Courier New, Courier" size=2>period and the smoothing MA to the
include file. Three variables in all.<FONT
face="Century Schoolbook, New Century Schoolbook" size=3><FONT
face="Courier New, Courier" size=2>How is this done?<FONT
face="Century Schoolbook, New Century Schoolbook" size=3><FONT
face="Courier New, Courier" size=2>TIA<FONT
face="Century Schoolbook, New Century Schoolbook" size=3><FONT
face="Courier New, Courier" size=2>Sid<FONT
face="Century Schoolbook, New Century Schoolbook" size=3><FONT
face="Courier New, Courier" size=2>Send BUG REPORTS to
bugs@xxxxxxxxxxxxx<FONT
face="Century Schoolbook, New Century Schoolbook" size=3><FONT
face="Courier New, Courier" size=2>Send SUGGESTIONS to
suggest@xxxxxxxxxxxxx<FONT
face="Century Schoolbook, New Century Schoolbook" size=3><FONT
face="Courier New, Courier"
size=2>-----------------------------------------<FONT
face="Century Schoolbook, New Century Schoolbook" size=3><FONT
face="Courier New, Courier" size=2>Post AmiQuote-related messages ONLY to:
amiquote@xxxxxxxxxxxxxxx <FONT
face="Century Schoolbook, New Century Schoolbook" size=3><FONT
face="Courier New, Courier" size=2>(Web page: <A
href="">http://groups.yahoo.com/group/amiquote/messages/)<FONT
face="Century Schoolbook, New Century Schoolbook" size=3><FONT
face="Courier New, Courier"
size=2>--------------------------------------------<FONT
face="Century Schoolbook, New Century Schoolbook" size=3><FONT
face="Courier New, Courier" size=2>Check group FAQ at: <A
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html
<FONT face="Century Schoolbook, New Century Schoolbook"
size=3>Yahoo! Groups
Links<FONT face="Century Schoolbook, New Century Schoolbook"
size=3>To visit your
group on the web, go to:<FONT
face="Century Schoolbook, New Century Schoolbook" size=3><FONT
face="Courier New, Courier" size=2> <A
href="">http://groups.yahoo.com/group/amibroker/<FONT
face="Century Schoolbook, New Century Schoolbook" size=3><FONT
face="Courier New, Courier" size=2>To unsubscribe from this group, send an
email to:<FONT face="Century Schoolbook, New Century Schoolbook"
size=3><FONT face="Courier New, Courier"
size=2> amibroker-unsubscribe@xxxxxxxxxxxxxxx<FONT
face="Century Schoolbook, New Century Schoolbook" size=3><FONT
face="Courier New, Courier" size=2>Your use of Yahoo! Groups is subject
to:<FONT face="Century Schoolbook, New Century Schoolbook"
size=3> <A
href="">http://docs.yahoo.com/info/terms/
<FONT face="Century Schoolbook, New Century Schoolbook"
size=3>Send BUG REPORTS to bugs@xxxxxxxxxxxxxSend
SUGGESTIONS to
suggest@xxxxxxxxxxxxx-----------------------------------------Post
AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page:
<A
href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check
group FAQ at: <A
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html<FONT
face="Century Schoolbook, New Century Schoolbook" size=3>
Yahoo! Groups Links
To visit your group on the web, go to:
<A
href="">http://groups.yahoo.com/group/amibroker/
To unsubscribe from this group, send an email to:
<A
href="">amibroker-unsubscribe@xxxxxxxxxxxxxxx
Your use of Yahoo! Groups is subject to the <A
href="">Yahoo! Terms of Service.
<FONT face="Century Schoolbook, New Century Schoolbook"
size=3>---Incoming mail is certified Virus Free.Checked by AVG
anti-virus system (<A href=""
eudora="autourl">http://www.grisoft.com).Version: 6.0.551 / Virus
Database: 343 - Release Date: 12/11/2003Send
BUG REPORTS to bugs@xxxxxxxxxxxxxSend SUGGESTIONS to
suggest@xxxxxxxxxxxxx-----------------------------------------Post
AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: <A
href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check
group FAQ at: <A
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Yahoo! Groups Links
To visit your group on the web, go to:<A
href="">http://groups.yahoo.com/group/amibroker/
To unsubscribe from this group, send an email to:<A
href="">amibroker-unsubscribe@xxxxxxxxxxxxxxx
Your use of Yahoo! Groups is subject to the <A
href="">Yahoo! Terms of Service.
---Outgoing mail is certified Virus Free.Checked by AVG
anti-virus system (http://www.grisoft.com).Version: 6.0.551 / Virus
Database: 343 - Release Date: 12/11/2003
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.
|