PureBytes Links
Trading Reference Links
|
<FONT face=Arial color=#0000ff
size=2>Tomaz,
<FONT face=Arial color=#0000ff
size=2>
You
can take the night off... it's OK... :>) You know we
appreciate it, but...
<FONT face=Arial color=#0000ff
size=2>
Happy
Holidays.
<FONT face=Arial color=#0000ff
size=2>
Mr
Valley
<FONT face=Tahoma
size=2>-----Original Message-----From: Tomasz Janeczko
[mailto:amibroker@xxxxxx]Sent: Wednesday, December 24, 2003 3:58
PMTo: amibroker@xxxxxxxxxxxxxxxSubject: Re: [amibroker]
passing variables
Sid,
No, param1 statement in only in the main file. Include file
contains ONLY your function that takes an argument:
// BEGIN.. contents of the file_with_your_function.afl
...
function MyFunction( periods )
{
return AMA( C, 2/(periods+1));
}
/// END
-------------------
---------------------
Contents of the main file:
// BEGIN
#include <file_with_your_function.afl><FONT
face="Century Schoolbook, New Century Schoolbook"
size=3> <FONT
face="Century Schoolbook, New Century Schoolbook" size=2>param1 =
Optimize("param1", 5, 1, 10, 1 );<FONT
face="Century Schoolbook, New Century Schoolbook"
size=3> <FONT
face="Century Schoolbook, New Century Schoolbook" size=2>buy = C >
MyFunction( param1 );
// END
At run time param1 from MAIN file is passed BY VALUE to
'periods' argument in the function.
That way your function is written ONCE and can be used like
ANY OTHER built-in function in AFL
(like MA, ADX, etc )
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:22 PM
Subject: Re: [amibroker] passing
variables
<FONT face="Century Schoolbook, New Century Schoolbook"
size=3>Great...but I am programmatically challenged. Is the param1
statement in the included file, it looks like it would have to be
there. Could you provide a more elaborate example
please?CheersSidAt 10:11 PM 12/24/2003 +0100, you
wrote:
<FONT
face="Century Schoolbook, New Century Schoolbook" size=2>Sid,<FONT
face="Century Schoolbook, New Century Schoolbook"
size=3> <FONT
face="Century Schoolbook, New Century Schoolbook" size=2>There is
absolutely NO problem with that.<FONT
face="Century Schoolbook, New Century Schoolbook" size=3><FONT
face="Century Schoolbook, New Century Schoolbook" size=2>You can use
optimize and pass arguments to ANY function defined in external
file.<FONT face="Century Schoolbook, New Century Schoolbook"
size=3> <FONT
face="Century Schoolbook, New Century Schoolbook" size=2>#include
<file_with_your_function.afl><FONT
face="Century Schoolbook, New Century Schoolbook"
size=3> <FONT
face="Century Schoolbook, New Century Schoolbook" size=2>param1 =
Optimize("param1", 5, 1, 10, 1 );<FONT
face="Century Schoolbook, New Century Schoolbook"
size=3> <FONT
face="Century Schoolbook, New Century Schoolbook" size=2>buy = C >
MyFunction( param1 );<FONT
face="Century Schoolbook, New Century Schoolbook"
size=3> Best regards,Tomasz
Janeczkoamibroker.com
----- Original Message -----
From: Sidney Kaiser
To: <A
href="">amibroker@xxxxxxxxxxxxxxx
Sent: Wednesday, December 24, 2003 10:07 PM
Subject: RE: [amibroker] passing variables
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 all
Sid
At 03:28 PM 12/24/2003 -0500, you wrote:
Hi Sid:<FONT
face="Century Schoolbook, New Century Schoolbook" size=3>
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="Century Schoolbook, New Century Schoolbook" size=3>
Low1=<FONT
face="Courier New, Courier" color=#0000ff size=2>LLV(<FONT
face="Courier New, Courier" color=#ff0000 size=2>C,<FONT
face="Courier New, Courier" color=#ff00ff
size=2>7);<FONT
face="Century Schoolbook, New Century Schoolbook" size=3>
High1=<FONT
face="Courier New, Courier" color=#0000ff size=2>HHV(<FONT
face="Courier New, Courier" color=#ff0000 size=2>C,<FONT
face="Courier New, Courier" color=#ff00ff
size=2>7);<FONT
face="Century Schoolbook, New Century Schoolbook" size=3>
<FONT face="Courier New, Courier" color=#800000
size=2>return (<FONT face="Courier New, Courier" color=#0000ff
size=2>EMA(<FONT face="Courier New, Courier" color=#ff00ff
size=2>100*(<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(RSIPer)/<FONT face="Courier New, Courier"
color=#ff00ff size=2>2);<FONT
face="Century Schoolbook, New Century Schoolbook" size=3>
}<FONT
face="Century Schoolbook, New Century Schoolbook" size=3>
Note the naming and the
variable positions in the declaration of the StoRSI
function.<FONT
face="Century Schoolbook, New Century Schoolbook" size=3>
I plotted this in my IB
window:<FONT
face="Century Schoolbook, New Century Schoolbook" size=3>
X=StoRSI(<FONT
face="Courier New, Courier" color=#ff00ff size=2>14,<FONT
face="Courier New, Courier" color=#ff00ff
size=2>13);<FONT
face="Century Schoolbook, New Century Schoolbook" size=3>
<FONT face="Courier New, Courier" color=#0000ff
size=2>Plot(<FONT face="Courier New, Courier" color=#ff00ff
size=2>50,<FONT face="Courier New, Courier" color=#ff00ff
size=2>"",<FONT face="Courier New, Courier" color=#ff00ff
size=2>7,<FONT face="Courier New, Courier" color=#ff00ff
size=2>1);<FONT
face="Century Schoolbook, New Century Schoolbook" size=3>
<FONT face="Courier New, Courier" color=#0000ff
size=2>Plot(X,<FONT face="Courier New, Courier" color=#ff00ff
size=2>"StoRSI",<FONT face="Courier New, Courier" color=#ff00ff
size=2>5,<FONT face="Courier New, Courier" color=#ff00ff
size=2>1);<FONT
face="Century Schoolbook, New Century Schoolbook" size=3>
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>
Hope this
helps.<FONT
face="Century Schoolbook, New Century Schoolbook" size=3>
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 PM
To: AmiBroker@xxxxxxxxxxxxxxx
Subject: [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>
decided to make a
dedicated AFL file that I can include in the other files
<FONT face="Century Schoolbook, New Century Schoolbook"
size=3>
where I want to use the
function. Of course to be of any use, the <FONT
face="Century Schoolbook, New Century Schoolbook" size=3>
variables need to be
passed from the calling program to the included <FONT
face="Century Schoolbook, New Century Schoolbook" size=3>
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>
For my StochRSI fn I
would want to pass the Array (usually Close), the RSI <FONT
face="Century Schoolbook, New Century Schoolbook" size=3>
period and the smoothing
MA to the include file. Three variables in all.<FONT
face="Century Schoolbook, New Century Schoolbook" size=3>
How is this
done?<FONT
face="Century Schoolbook, New Century Schoolbook" size=3>
TIA<FONT
face="Century Schoolbook, New Century Schoolbook" size=3>
Sid<FONT
face="Century Schoolbook, New Century Schoolbook" size=3>
Send BUG REPORTS to
bugs@xxxxxxxxxxxxx<FONT
face="Century Schoolbook, New Century Schoolbook" size=3>
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>
Post AmiQuote-related
messages ONLY to: amiquote@xxxxxxxxxxxxxxx <FONT
face="Century Schoolbook, New Century Schoolbook" size=3>
(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>
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>
<A
href="">http://groups.yahoo.com/group/amibroker/<FONT
face="Century Schoolbook, New Century Schoolbook" size=3>
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>
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@xxxxxxxxxxxxx
Send 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<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>
---Outgoing 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<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/2003
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
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/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.
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.
|