PureBytes Links
Trading Reference Links
|
You do
not have to understand how the functions work to use them, SS stands for
SaveString on disk and RS stands for ReadString from disk. Copy the two
functions ahead of other code in your indicators (or use an include file), do
not alter them. It may actually be a good idea to use an extension like .par
or .txt The functions save/read a single string to/from disk, where a
string is any combination of characters in quotes, like "string" is a string.
You can read up on this in the AB Help. When using SS() you privide two
arguments:
<FONT face=Arial color=#0000ff
size=2>
<FONT face=Arial color=#0000ff
size=2>Filename - this is any unique descriptive name for your
parameter, it must be contained within double quotes. The funtion saves a string
so you need to convert your number parameter to a string in order to save it.
AmiBroker has a nice function for this: Numtostr( YourNumber, 1.0). So if i
want to save the RSI Period of 10 on disk I would use this
code:
<FONT face=Arial
color=#0000ff>RSIPeriodNumber = <FONT face=Arial color=#0000ff
size=2>10;
RSIPeriodString = NumToStr(
RSIPeriodNumber , 1.0<FONT
color=#0000ff>); SS( <FONT
size=2>"RSIPeriod.par", RSIPeriodString );
To
retrieve this number from another indicator or a number of indicators, you would
read back the sting from the disk and convert it back to a
number:
<FONT
face=Arial color=#0000ff>RSIPeriodString<FONT
face=Arial>2 = RS( <FONT
size=2>"RSIPeriod.par"<FONT
face=Arial>); RSIPeriodNumber2<FONT
size=2> = StrToNum<FONT
size=2>(RSIPeriodString2<FONT
color=#0000ff>);<FONT
size=2>Plot(RSI<FONT
size=2>(RSIPeriodNumber2<FONT
size=2> ),""<FONT
size=2>,1,<FONT
size=2>1);
<SPAN
class=828340823-01072004>
<SPAN
class=828340823-01072004>Hope this helps,
<SPAN
class=828340823-01072004>herman.
<FONT
face=Arial><FONT
size=2>
<FONT
face=Arial>
<FONT face=Arial color=#0000ff
size=2>
<FONT face=Tahoma
size=2>-----Original Message-----From: recce101
[mailto:ned@xxxxxxxxxxxxx]Sent: Thursday, July 01, 2004 6:42
PMTo: amibroker@xxxxxxxxxxxxxxxSubject: [amibroker] Re:
Global Parameter??Thanks, dingo. Your server-client
explanation was helpful. But I have not been able to save the added code
to my existing parameters.afl file without getting an AFL syntax error.
Where Herman hasfunction SS(FileName,String)I've
triedfunction
SS(parameters.afl,TestNumber)alsofunction
SS("parameters.afl","TestNumber")andfunction
SS(parameters.afl,"TestNumber")all with the same error. The context
menu help screens haven't been of any assistance in that regard. What
should I enter in the place of String and FileName? And I assume FileName
in the RSI and ATR files should also be parameters.afl?Obviously I
need some basic education on _javascript_, VBScript, or whatever language
this stuff is borrowed from. The help files in AmiBroker assume a level of
knowledge that I don't quite possess at present. Any suggestions on
books?I appreciate all your efforts and apologize for being such a
pain.Ned--- In amibroker@xxxxxxxxxxxxxxx, "dingo"
<dingo@xxxx> wrote:> H's code will do what you want but you need
to learn what its doing so you> can modify it. Its not that
complicated, really.> > There are 2 pieces: One
containing a param statement and the other not.> > the
one containing the param statement and the SS function is the
"server"> and the one with the RS Function goes into as many other
indicators as you> wish and are the "clients".>
> This is the way it works:> > After you change the
param in indicator with the server code it will write> the new
value out to disk via the call to the SS function.> > The
client code will go into all of the other indicators that you want>
driven by the server. When they refresh they will read the file and
will> assign the value stored in that file to the variable used in
the indicator.> > d> >
> _____ > > From: recce101
[mailto:ned@xxxx] > Sent: Thursday, July 01, 2004 3:07 PM> To:
amibroker@xxxxxxxxxxxxxxx> Subject: [amibroker] Re: Global
Parameter??> > > To better understand the issue and
responses to this point, I have > constructed three simple test files
(Dimitris' description of what > I'm trying to accomplish is exactly
correct).> > Save the file Parameters.afl in
...AmiBroker\AFL\Include:> > /* -- Parameters -- */>
> TestNumber=16;> >
TestPeriod=Param("TestPeriod",10,5,20,1);> >
Title="\\c55"> +Name()> +"\\c33
Parameters"> +"\\c55 TestNumber: ">
+WriteVal(TestNumber,1.2)> +" TestPeriod: ">
+WriteVal(TestPeriod,1.0);> > Save the file TestRSI.afl in
...AmiBroker\AFL:> > /* -- TestRSI -- */> >
#pragma nocache> #include<Parameters.afl>> >
Plot(RSI(TestPeriod),"RSI",colorBrightGreen,styleLine);> >
Title="\\c55"> +Name()> +"\\c33
TestRSI"> +"\\c55 TestNumber: ">
+WriteVal(TestNumber,1.2)> +" TestPeriod (for graph):
"> +WriteVal(TestPeriod,1.0);> > Save the file
TestATR.afl in ...AmiBroker\AFL:> > /* -- TestATR -- */>
> #pragma nocache> #include<Parameters.afl>>
> Plot(ATR(TestPeriod),"ATR",colorPink,styleLine);> >
Title="\\c55"> +Name()> +"\\c33
TestATR"> +"\\c55 TestNumber: ">
+WriteVal(TestNumber,1.2)> +" TestPeriod (for graph):
"> +WriteVal(TestPeriod,1.0);> > Now, with all three
visible on the same screen, note that the TestRSI > and TestATR
panes display the TestNumber value of 16.00 and the > graphs reflect
the default TestPeriod value of 10, all picked up from > the
Parameters.afl file.> > If the TestNumber value of 16 hard-coded
in Parameters.afl is changed > to (say) 21 and Parameters.afl is
SAVED, the TestNumber value in each > indicator pane updates to
21.00 immediately.> > But if the Parameters pane is
right-clicked and the TestPeriod slider > is moved to (say) 15,
only the TestPeriod read-out in Parameters > changes to 15. Even
re-saving Parameters.afl at this point has no > effect on the TestRSI
or TestAFL graphs, both of which remain on the > default 10.
However, if either TestRSI or TestAFL is right-clicked, a >
parameters slider appears and any changes will immediately update >
that pane, but that pane only.> > I would like to be able to
right-click just one of the panes, either > Parameters or, if it's
not really necessary for Parameters to be > displayed, either the RSI
or ATR pane, and have both graphs respond > immediately to any
TestPeriod change.> > For Herman: Thanks for the detailed
response, but I wasn't able to > follow everything you wrote and I
don't completely understand which > of your generic "example"
statements would need to be replaced by > my "actual" data. If your
code would accomplish what I'm trying to > do, and you have the time,
it would be great if you could modify my > test files accordingly so I
can copy-paste and take it from there.> > Many thanks to
everyone!> > Ned> > > > Check
AmiBroker web page at:> <A
href="">http://www.amibroker.com/>
> Check group FAQ at:> <A
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html
> > > > Yahoo! Groups
Sponsor > >
ADVERTISEMENT> > <<A
href="">http://us.ard.yahoo.com/SIG=129omg465/M=295196.4901138.6071305.3001176/D=gr>
oups/S=1705632198:HM/EXP=1088795285/A=2128215/R=0/SIG=10se96mf6/*http://comp>
anion.yahoo.com> click here >
> <<A
href="">http://us.adserver.yahoo.com/l?M=295196.4901138.6071305.3001176/D=groups/S=>
:HM/A=2128215/rand=686503035> >
> > _____ > > 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:> amibroker-unsubscribe@xxxxxxxxxxxxxxx>
<mailto:amibroker-unsubscribe@xxxxxxxxxxxxxxx?subject=Unsubscribe>
> > > * Your
use of Yahoo! Groups is subject to the Yahoo! Terms of Service>
<<A
href="">http://docs.yahoo.com/info/terms/>
.Check AmiBroker web page at:<A
href="">http://www.amibroker.com/Check
group FAQ at: <A
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Check AmiBroker web page at:
http://www.amibroker.com/
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Yahoo! Groups Sponsor
ADVERTISEMENT
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.
|