PureBytes Links
Trading Reference Links
|
AFL is not itself an object oriented language, though it can
manipulate objects that have been implemented in object oriented
languages.
I suspect that you will need to rework your code to comply with AFL
scripting syntax, or investigate using the COM/ActiveX support to
interact with your external objects written in C++ (or VisualBasic,
Delphi, whatever).
http://www.amibroker.com/guide/a_aflcom.html
Mike
--- In amibroker@xxxxxxxxxxxxxxx, "loveyourenemynow"
<loveyourenemynow@xxx> wrote:
>
> Thanks Mike,
>
> but my code is written in such a way that functions play the roles
of
> parameters(to avoid errors and facilitate debugging and changes),
> trying to mimic polymorphism of OO language.
> Problem is that i think functions cannot be changed at runtime
during
> backtesting , but have to be declared one and stay the same.
> These functions return different prices (O/C) with different time
> delays so I could rewrite the code and use one functions taking 2
> paramters , one for delay and the other for O/P.
>
> This what it comes to my mind now, but I would like to know why is
tht
> error produced.
> what if I declare empty functions (like virtual declaration in c++)
at
> as an empty prototype at global scope and implement and give some
> parameter dependent implementations later. Again is all about mimic
> polymorphism.
>
> Thanks
> Ly
>
> --- In amibroker@xxxxxxxxxxxxxxx, "Mike" <sfclimbers@> wrote:
> >
> > Read http://www.amibroker.com/guide/a_userfunctions.html
> >
> > Then try changing your function signature to just take a
parameter
> > and move the declaration out of the if statement.
> >
> > e.g.
> > function P1f(sys) {
> > if (sys == 1) {
> > ...
> > }
> > ...
> > }
> >
> > Alternatively, you could create different functions for each
scenario
> > and check a condition in your calling code to determine which one
to
> > call.
> >
> > e.g.
> > ...
> > if (sys == 1) {
> > P1f();
> > } else {
> > OtherP1f();
> > }
> > ...
> > function P1f() {
> > ...
> > }
> > function OtherP1f() {
> > ...
> > }
> >
> > I don't understand your scope question. But you may find the
> > documentation for local/global helpful:
> >
> > http://www.amibroker.com/guide/keyword/local.html
> > http://www.amibroker.com/guide/keyword/global.html
> >
> > Mike
> >
> > --- In amibroker@xxxxxxxxxxxxxxx, "loveyourenemynow"
> > <loveyourenemynow@> wrote:
> > >
> > > I am trying to optimize over diffeent types of systems and I
need to
> > > define function accordingly, but I get and error with this code
> > >
> > > if (sys==1){
> > > ///cc->co entry at close exit at day after open
> > > SetOption("ActivateStopsImmediately",True);
> > > SetTradeDelays(0,0,0,0);
> > > ShortPrice=C;
> > > BuyPrice=C;
> > > CoverPrice=O;
> > > SellPrice=O;
> > > function P1f() {return Ref(C,-1);}
> > > function P2f() {return Ref(C,0);}
> > > ApplyStop(stopTypeNBar,stopModeBars,1,1);
> > > dc=1;
> > > MaxPosPer=1;
> > > }
> > >
> > > while outside brackets it runs.
> > >
> > > In a similar way variable I noticed that arrays declared at
> > different
> > > scope levels are not accessible to the lower levels (i think
scalr
> > > yes) unless they are defined at gloabal level,
> > > This is different from c++ scope conventions.
> > > So the only way to share among different scopes (I mean
portions of
> > > code at differnt levels of {} nesting), seems to declare them
> > globally.
> > > Am I correct?
> > >
> > > Thanks
> > > Ly
> > >
> >
>
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 NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
For other support material please check also:
http://www.amibroker.com/support.html
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/amibroker/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:amibroker-digest@xxxxxxxxxxxxxxx
mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx
<*> 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/
|