PureBytes Links
Trading Reference Links
|
One problem you might be having...
All of this "function" capability is only available in recent betas and
recent betas are only available to paid subscribers.
I don't know why you are using java script for your function.
Try putting this into a file caled myFunction.afl:
function myFunction(x1,x2,x3,x4)
{
return (x1 + x2 + x3 + x4) / 4;
}
Then, in your "main" AFL, say:
x = myFunction(Open, High, Low, Close);
It will work just about every time...
> -----Original Message-----
> From: SR [mailto:raftsp@xxxxxxxxx]
> Sent: Thursday, May 15, 2003 6:28 AM
> To: equismetastock@xxxxxxxxxxxxxxx
> Subject: [EquisMetaStock Group] RE:RE: v8 System Tester Issues and how
> to fix.
>
>
>
> Anthony,
>
> I want to be able to create a function that will return a number
> to another
> function that calls the first one. It doesn't really matter what myFuction
> returns exactly. For simplicity, suppose that what I want to get is
> (O+H+L+C)/4. I do know that this is so simple that it doesn't need to be a
> separate function, but let's accept that this is what we want to do.
> Actually I had problems with this one too!
> Although I have never used java sript before, I thought I could
> make such a
> simple script by just reading the examples given. So, this is what I did:
> First I created a function named "myFunction" like this:
>
> EnableScript("jscript");
> <%
> function myFunction(x1,x2,x3,x4)
> {
> return (x1 + x2 + x3 + x4) / 4;
> }
> %>
>
> I saved it in C:\Program files\Amibroker\Afl
> Please notice that I have checked that a function called
> "myFunction" exists
> there indeed!
>
> Then I tried the calling formula:
>
> #include "C:\Program files\Amibroker\Afl\myFunction.afl";
> script = GetScriptObject();
> Graph0 = script.myFunction(Open,High,Low,Close);
>
> The problem is that each time I click 'Apply' I get this error:
>
> Method/function 'myFunction' does not exist at line 3, column 96:
>
>
> Graph0 = script.myFunction(Open,High,Low,Close)
> ----------------------------------------------^
>
> 1. I don't understand. I do see "line 3", but where is "column 96" in the
> above code?
> 2. "doesn't exist"?! But I do see it! So, what is the mistake I
> have made in
> the above formulas?
> 3. The program freezes all the time and I have to shut it down and re-run
> it.
> 4. This is not all. So far I have not managed to get a "Points-Only" test,
> according to the instructions given. The tester keeps buying and selling
> dozens of shares or contracts depending on the equity, regardless
> of what I
> have written in the code.
> 5. Sometimes I get rubbish on the main chart.
>
> Maybe I have to re-install the program; maybe it is the RT (eSignal)
> version..??
> Is it the "demo"? Who knows..
> So, in case you can help with some of the above, I will be very much
> obliged.
> I will also try once more with the AB board, later.
>
> Thanks
>
> Spyros
>
> ________________________________________________________________________
> ________________________________________________________________________
>
> Message: 6
> Date: Wed, 14 May 2003 15:28:57 -0400 (Eastern Daylight Time)
> From: "Anthony Faragasso" <ajf1111@xxxxxxxx>
> Subject: Re: RE:RE: RE: v8 System Tester Issues and how to fix.
>
> Spyros,
>
> If you want to give an example of what you are trying to do...then a more
> helpful solution
> can be given...
>
> Anthony
>
> -------Original Message-------
>
> From: equismetastock@xxxxxxxxxxxxxxx
> Date: Wednesday, May 14, 2003 10:07:13 AM
> To: equismetastock@xxxxxxxxxxxxxxx
> Subject: [EquisMetaStock Group] RE:RE: RE: v8 System Tester Issues and how
> to fix.
>
> Anthony and Kevin and Chuck thank you for your replies.
>
> Chuck:
>
> 1. Obviously
> myVar = myFormula()
> is not enough because it doesn't work [although I am trying with version
> 4.30 (the latest?)]
> I wouldn't mind to have to write a couple of lines including #include
> directives etc. as
> Anthony suggests (in fact, I had already tried that several times in the
> past) but I usually get errors.
> That's why I keep asking and trying. I have already read Janeczko's java
> script and VB examples
> and a few messages on the AB board. Sometimes the #include solution works,
> other times
> it does not. I get unexpected and inexplicable errors.
>
> 2. I asked on this board because the AB conversation was brought to this
> board (not by me anyway).
> BTW my opinion is that such conversations are not exactly off
> topic because
> I guess that the
> members of this group are much more than just MS users. Some of them have
> already tried
> other software (AB included), some have already asked questions about such
> software and most
> of us would like to have some elementary information about ... the rest of
> the world.
>
> 3. As I said, in the past I had directly asked Janeczko about
> these problems
> but I got no answer.
> Yes, he had rapidly replied to my first message, but as the problem
> persisted, I had to ask again.
> This time he did not reply. A few days ago I searched the AB database for
> relevant messages.
> I found I few, among which some replies by Janeczko. I must say that they
> were not very encouraging.
> So, my impression so far is that neither AB programming nor the
> communication is free of problems.
>
> Please don't missunderstand me. I still believe that AmiBroker is an
> excellent program. And as far as
> programming is concerned it is much more powerful than Metastock,
> which for
> different reasons
> is also an excellent program. I am just saying that both programs
> have their
> cons and unless
> the function-calling problem is solved for good, this IMO will be
> a major AB
> drawback.
>
> Anyway I will make a new attempt with the AB group.
> Thanks again
> Spyros
>
>
>
> Message: 16
> Date: Tue, 13 May 2003 20:19:24 -0400
> From: "Chuck Rademacher" <chuck_rademacher@xxxxxxxxxx>
> Subject: RE: RE: v8 System Tester Issues and how to fix.
>
> It's even easier in AFL. Just say:
>
> myVar = myFormula();
>
> Even better than MS, AFL will let you pass values to the "other"
> formula as
> with this example:
>
> myVar = myFormula(Open*1.1);
>
> A lot of people are willing to help with AB/AFL questions, but
> feel awkward
> answering them on this board. If you ask questions like this on the AB
> board, you will get a quick reply. In fact, you will get dozens
> of replies.
>
> > -----Original Message-----
> > From: SR [mailto:raftsp@xxxxxxxxx]
> > Sent: Tuesday, May 13, 2003 6:33 AM
> > To: equismetastock@xxxxxxxxxxxxxxx
> > Subject: [EquisMetaStock Group] RE: v8 System Tester Issues and how to
> > fix.
> >
> >
> >
> > Kevin,
> >
> > Let me add a question about AmiBroker.
> > What I want to do is very simple: have a formula call another
> formula the
> > way we do in MS:
> >
> > myVar:= fml("myFormula");
> >
> > Can this be done with AFL? If yes, then how? Could you provide the AB
> > equivalent?
> >
> > Whenever I ask this question I get no answer! I have asked a
> couple of AB
> > users privately, I have asked
> > publicly, I have asked Tomasz Janeczko. No positive replies no negative
> > ones! Nothing! Very strange, isn't it?
> >
> > So I hope you will be kind enough to post a reply.
> > Thank you in advance.
> >
> > Spyros
>
>
>
>
>
>
> Yahoo! Groups Sponsor
>
>
>
>
>
> To unsubscribe from this group, send an email to:
> equismetastock-unsubscribe@xxxxxxxxxxxxxxx
>
>
>
> Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
>
>
>
>
> ________________________________________________________________________
>
>
>
> To unsubscribe from this group, send an email to:
> equismetastock-unsubscribe@xxxxxxxxxxxxxxx
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Get A Free Psychic Reading! Your Online Answer To Life's Important Questions.
http://us.click.yahoo.com/Lj3uPC/Me7FAA/uetFAA/BefplB/TM
---------------------------------------------------------------------~->
To unsubscribe from this group, send an email to:
equismetastock-unsubscribe@xxxxxxxxxxxxxxx
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
|