Ideal solution IMHO would be for AB to have a user
configurable function library (folder containing separate function def files)
and AFL compiler just to pull in reqd. functions from library if referenced in
main code.
Using #include with long lists of functions is
workable as a sort of pseudo library but is cumbersome to
maintain.
John
----- Original Message -----
Sent: Saturday, June 04, 2005 11:12
AM
Subject: Re: [amibroker] Re: if else and
include
thanks,
yes this is about what I have been doing now,
stacking functions inside one single functions file. In my opinion it is
not an ideal situation though because one usually writes the
functions / procedures in their own file and includes them when
needed.
As I understand the situation now one needs
to decide which user defined function to use, then stack them is to a single
file and include this file in your main formula. Then all function can see
eachother and also the main formula can see the functions / procedures.
More ideal would be if all functions could be included separately inside the
main formula and that all functions could see eachother.
This is just an idea ofcourse, we are already
spoiled and it is not a big deal to stuff all the functions inside a
file.
regards, Ed
----- Original Message -----
Sent: Saturday, June 04, 2005 11:44
AM
Subject: Re: [amibroker] Re: if else
and include
Hello,
Simply put all your user-defined functions into
one file and you will be
able to include them in any of your formulas as
well as call any function
from the formula as well as from another
function.
Best regards, Tomasz
Janeczko amibroker.com
----- Original Message -----
Sent: Saturday, June 04, 2005 11:14
AM
Subject: Re: [amibroker] Re: if else
and include
hi,,
somewhat off this topic:
how do I include a function with a function?
Is this possible?
I want to call a user defined function within
another user defined function. #include does not seem to work
here.
thanks,
rgds, Ed
----- Original Message -----
Sent: Saturday, June 04, 2005 10:53
AM
Subject: Re: [amibroker] Re: if
else and include
No, #include statements don't need double
backslashes.
The only error is that the #include line
was wrapped in Stephane's code.
#include lines MUST NOT be
wrapped.
Best regards, Tomasz Janeczko amibroker.com
----- Original Message -----
Sent: Saturday, June 04, 2005
4:03 AM
Subject: RE: [amibroker] Re: if
else and include
"#include "D:\Program
Files\AmiBroker\Formulas\Custom\Rem_Long
afl.afl"
wouldnt be #include "D:\\Program
Files\\AmiBroker\\Formulas\\Custom\\Rem_Long
afl.afl"
Paul
Ho
Tomasz,
below is exactly the
code, with braces as you wrote it. but it returns an
error.
Stephane
Choice=1; #pragma
nocache
if(Choice==1) { #include "D:\Program
Files\AmiBroker\Formulas\Custom\Rem_Long
afl.afl" } else { #include "D:\Program
Files\AmiBroker\Formulas\Custom\Rem_Long
afl_Var.afl" }
Setup=Cross( MFI(3),0); BuyCond=
Ref(Setup,-1); Entryprice=O; Exitprice=Low;// or
Close Stoploss=LLV(L,3)-0.75*ATR(10)
; Stoptrail=LLV(L,3)-1.75*ATR(10); Exit=0; Pf=7; Stopprofit=(1+(Pf/100))*Entryprice;
MyAppplyStop (BuyCond,Entryprice,Exitprice,Stoploss,Stoptrail,Stopprofit,Exit);
Plot(VarGet("sellpr"),"",colorYellow,1); Plot(VarGet("Trailpr"),"",colorGreen,1); Plot(VarGet("StopLosspr"),"",colorRed,1); Plot(VarGet("Targetpr"),"",colorBlue,1);
>
Stephane, > > My idea DOES work, I ensure you, provided
you put the braces > correctly (as I shown). > >
Best regards, > Tomasz Janeczko > amibroker.com >
----- Original Message ----- > From: "Stephane Carrasset"
<s.carrasset@xxxx> > To:
<amibroker@xxxxxxxxxxxxxxx> > Sent: Thursday, June 02,
2005 10:18 PM > Subject: [amibroker] Re: if else and
include > > > > Hello, > > >
> it seems that your idea does not work... > > But the
tips given by Fred tonetti is good > > all functions in one
include and call differents functions, ex. below > >
> > stephane > > > > > >
#pragma nocache > > #include "D:\Program
Files\AmiBroker\Formulas\Custom\Rem_Long > >
afl_Var.afl" > > > >
Choice=Param("Stop",0,0,10,1); > > if(Choice==1) >
> { > > MyAppplyStop > >
(BuyCond,Entryprice,Exitprice,Stoploss,Stoptrail,Stopprofit,Exit); >
> } > > else > > { > >
MyAppplyStop_Var > >
(BuyCond,Entryprice,Exitprice,Stoploss,Stoptrail,Stopprofit,Exit); >
> } > >> > >> Since #include is
pre-processor command, files are included > >> BEFORE
execution, so both files are included anyway. > >> Later
on appropriate part (depending on condition) is executed. >
>> Also since included files may contain more than one line
you should > > use > >> { }
braces: > >> > >> if(Choice==1) >
>> { > >> #include "D:\Program
Files\AmiBroker\Formulas\Custom\Rem_Long > > afl.afl"
> >> } > >> else > >> { >
>> #include "D:\Program
Files\AmiBroker\Formulas\Custom\Rem_Long > > afl_Var.afl"
> >> } > >> > >> Also since
#include is pre-processor command and not a statement so
> > semicolon is not needed > >> >
>> > >> > >> Best regards, >
>> Tomasz Janeczko > >> amibroker.com >
>> ----- Original Message ----- > >> From:
"Stephane Carrasset" <s.carrasset@xxxx> > >> To:
<amibroker@xxxxxxxxxxxxxxx> > >> Sent: Thursday,
June 02, 2005 3:02 PM > >> Subject: [amibroker] if else
and include > >> > >> > >>
> Hello, have you a tip to switch between differents #include
??? > >> > for ex below > >> >
> >> > Choice=Param("include",0,0,10,1); >
>> > #pragma nocache > >> >
if(Choice==1) > >> > #include "D:\Program
Files\AmiBroker\Formulas\Custom\Rem_Long > > afl.afl"
; > >> > else > >> > #include
"D:\Program Files\AmiBroker\Formulas\Custom\Rem_Long >
>> > afl_Var.afl" ; > >> > > >>
> Stephane > >> > > >> > >
>> > > >> > > >> > >
>> > > >> > Please note that this group is
for discussion between users only. > >> >
> >> > To get support from AmiBroker please send an
e-mail directly to > >> > SUPPORT {at}
amibroker.com > >> > > >> > For other
support material please check also: > >> > http://www.amibroker.com/support.html >
>> > > >> > > >> > Yahoo!
Groups Links > >> > > >> > >
>> > > >> > > >> > >
>> > > >> > > >> > >
> > > > > > > > >
> > > > Please note that this group is for
discussion between users only. > > > > To get
support from AmiBroker please send an e-mail directly to >
> SUPPORT {at} amibroker.com > > > > For other
support material please check also: > > http://www.amibroker.com/support.html >
> > > > > Yahoo! Groups Links > >
> > > > > > > > >
> > > >
>
Please note that this group is
for discussion between users only.
To get support from
AmiBroker please send an e-mail directly to SUPPORT {at}
amibroker.com
For other support material please check
also: http://www.amibroker.com/support.html
Please
note that this group is for discussion between users only.
To
get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com
For other support material
please check also: http://www.amibroker.com/support.html
Please
note that this group is for discussion between users only.
To get
support from AmiBroker please send an e-mail directly to SUPPORT
{at} amibroker.com
For other support material please check
also: http://www.amibroker.com/support.html
Please
note that this group is for discussion between users only.
To get
support from AmiBroker please send an e-mail directly to SUPPORT
{at} amibroker.com
For other support material please check
also: http://www.amibroker.com/support.html
Please
note that this group is for discussion between users only.
To get
support from AmiBroker please send an e-mail directly to SUPPORT {at}
amibroker.com
For other support material please check also: http://www.amibroker.com/support.html
Please
note that this group is for discussion between users only.
To get
support from AmiBroker please send an e-mail directly to SUPPORT {at}
amibroker.com
For other support material please check also: http://www.amibroker.com/support.html
Please note that this group is for discussion between users only.
To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com
For other support material please check also:
http://www.amibroker.com/support.html
Yahoo! Groups Links
|