PureBytes Links
Trading Reference Links
|
<SPAN
class=627132710-16062004>Here's the function I use, which I keep in my
common.afl file:
<SPAN
class=627132710-16062004>
<SPAN
class=627132710-16062004>function FibNum(fn) { fn1 = fn2 =
1; for(i = 1; i <= fn; i++) { fnTemp =
fn1; fn1 = fn2; fn2 = fn1 +
fnTemp; } return fn2;}
<SPAN
class=627132710-16062004>
<SPAN
class=627132710-16062004>Dave
<BLOCKQUOTE
>
We read in the Users Guide, AFL Reference Manual, FOR
statement"...For loop is extremely flexible. loop-expression can
be ANY kind of expression you wish. You can produce not only regular series
like this:for( i = 0; i < BarCount; i = i + 3 ) // increment by 3 every
iterationbut you can produce exponential series too:for( i = 1; i <
BarCount; i = i * 2 ) // produces series of 1, 2, 4, 8, 16, 32, ... ...
"
The following loop will produce the Fibonacci series, for
any further use.
// The Fibonacci
seriesd=2/(sqrt(5)+1);// the accurate calculation
of 0.618n=5;for(i=d^(-n);i>=d^n;i=i*d){fib=i;Title=Title+"\n"+WriteVal(fib,1.3);}
The Fib coefficients are accurately calculated and you dont
need to write them one by one.
n may be increased for more Fib pairs.Dimitris
Tsokakis
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.
|