PureBytes Links
Trading Reference Links
|
Tomatz,
I agree that it's against the execution model of AFL and I can
imagine the amount of work required to change the execution model. For this
reason, it's not worthwhile changing it.
But I disagree that a linear implementation of PREV in C
is less efficient or simpler than using JScript/VBScript !
In any case, unless other user want to pursue in this
discussion, there is no point of continue this thread.
I appreciate the way AmiBroker is
implemented now and I am anxious to see version 3.8 when DevKit will provide a
way to implement anything we want at the speed only limited to the C/C++
efficiency.
Thanks again !
Jon.
<BLOCKQUOTE
>
<DIV
>From:
Tomasz Janeczko
To: <A title=amibroker@xxxxxxxxxx
href="">amibroker@xxxxxxxxxxxxxxx
Sent: Friday, September 07, 2001 12:52
PM
Subject: Re: [amibroker] Another PREV
example
Hello,
I won't dig into technical details herebut
there is no sense in implementing PREV-like function
because it is against array-based execution
model of AFL (for more details see "Array processing"
article in the newsletter: <FONT
face=Tahoma size=2><A
href="">http://www.amibroker.com/09-2001.html<FONT
face=Tahoma size=2>. This model makes AFL so fast.
All you really need is an access to individual
items of the array and they way
to iterate through the array.
Now this functionality is provided in
JScript/VBScript and as AFL fully supports these languages
via its scripting host you can write ANY
recursive formula using script. This is not only simpler
than wrestling with PREV-like formulas but also
more efficient.
Best regards,Tomasz Janeczko===============AmiBroker - the
comprehensive share manager.<A
href="">http://www.amibroker.com
<BLOCKQUOTE
>
----- Original Message -----
<DIV
>From:
jonf
To: <A
title=amibroker@xxxxxxxxxxxxxxx
href="">amibroker@xxxxxxxxxxxxxxx
Sent: Friday, September 07, 2001
5:53 PM
Subject: Re: [amibroker] Another
PREV example
Tomasz,
I am not so sure about not implementing a PREV function.
It's true that a lot of time you can find a replacement but some expression
need self reference. Now I think you are right by saying that you shouldn't
implement it as a truly recursive function but we need a self referenceof
the previous day of the current array !
I think an improved PREV function like PREV(Period,
Default) could be very useful. This will take the result of the past Period
ago current expression result. Default parameter will be
return if expression is not yet calculated or index is before the first
bars.
This doesn't required an recursive implementation. We are
self reference the previously calculated individual elements and not the
expression by itself like a true recursion formula !.
For a better understanding here are an example of the
classical fibonacci number series:
1) Non recursive
implementation fib[0] = 0;fib[1] = 1;for i=2 to
n fib[i]
= fib[i-1] + fib[i-2];
2) Recursive
implementation function fibF(i) if i<2
return i else return
fib(i-1) + fib(i-2)end functionfor i=0 to n fib[i]
= fibF(i);
3) Hypothetical
Amibroker improved PREV fib = prev(-1,1) +
prev(-2,0)
Now the complexity order for first algorithm is O(n).
For the second algorithm is O( n*sum(i) ) = O( n*(n+1)*n/2
) = O(n^3)
An implementation of PREV should be as the first algorithm
(linear, efficient) and not like the second (cubic, very inefficient).
Now the implementation PREV may required a complete
reprogramming of the AFL evaluation and may be not reasonable use of your
time. But this is another story !
Best !
Jon
<BLOCKQUOTE
>
----- Original Message -----
<DIV
>From:
Tomasz
Janeczko
To: <A
title=amibroker@xxxxxxxxxxxxxxx
href="">amibroker@xxxxxxxxxxxxxxx
Sent: Friday, September 07, 2001 7:34
AM
Subject: Re: [amibroker] Another PREV
example
Hello,
This is the reason why I think it isa good
idea NOT to have PREV in AFL.
In 80% of cases things may be coded without
it in much more efficient manner
(remember MS's PREV is very slow). The rest
20% of cases could be coded
in script (also much more
efficiently).
Best regards,
Tomasz Janeczko
amibroker.com
<BLOCKQUOTE
>
----- Original Message -----
<DIV
>From:
DanielErvi
To: <A
title=amibroker@xxxxxxxxxxxxxxx
href="">amibroker@xxxxxxxxxxxxxxx
Sent: 07 September, 2001
12:44
Subject: RE: [amibroker] Another
PREV example
<FONT face=Arial color=#0000ff
size=2>Hey that worked perfectly!
<FONT face=Arial color=#0000ff
size=2>
<FONT face=Arial color=#0000ff
size=2>It just goes to show that there is always a different perspective
for every problem. I never thought to use the barssince
function.
<FONT face=Arial color=#0000ff
size=2>
<FONT face=Arial color=#0000ff
size=2>Thanks Jon and David for your help!
<FONT face=Arial color=#0000ff
size=2>
<FONT face=Arial color=#0000ff
size=2>Daniel
<FONT face=Tahoma
size=2>-----Original Message-----From: jonf
[mailto:jonf_ca@xxxx]Sent: Thursday, September 06,2001
11:25 PMTo: <A
href="">amibroker@xxxxxxSubject:
Re: [amibroker] Another PREV example
Daniel,
barssince( month() != ref(month(),-1) )
+ 1;
Hope this will help !
Tell me if it's not what you want !
Jon.
<BLOCKQUOTE
>
----- Original Message -----
<DIV
>From:
Daniel
Ervi
To: <A
title=amibroker@xxxxxxxxxxxxxxx
href="">Amibroker Yahoo Group
Sent: Thursday, September 06,
2001 10:32 PM
Subject: [amibroker] Another
PREV example
Hi All,I've been struggling to figure out
how to code an MS indicator in AFLwithout using VBScript or
JScript. The function is pretty straight forward,but the
solution still eludes me. Here is the
function:
If(Month()<>Ref(Month(),-1),1,PREV+1)It is recursive,
which makes it very simple to understand. It is
anindicator that plots the current trade day number of the
month.Can anybody offer any ideas on how to get this
going?Thanks in
advance!DanielYour use of Yahoo!
Groups is subject to the <A
href="">Yahoo! Terms of
Service. Your use of Yahoo!
Groups is subject to the <A
href="">Yahoo! Terms of
Service. Your use of Yahoo!Groups
is subject to the Yahoo!
Terms of Service. Your use ofYahoo!
Groups is subject to the <A
href="">Yahoo! Terms of Service.
Your use of Yahoo! Groups is subject to the <A
href="">Yahoo! Terms of Service.
Your
use of Yahoo! Groups is subject to the <A
href="">Yahoo! Terms of Service.
|