PureBytes Links
Trading Reference Links
|
Dear keith,
Thanks very much for your explanations.
Regards
Kus
--- Pada Sen, 25/5/09, Keith McCombs <kmccombs@xxxxxxxxxxxx> menulis:
Dari: Keith McCombs <kmccombs@xxxxxxxxxxxx> Topik: Re: [amibroker] Is Array Processing correct? Kepada: amibroker@xxxxxxxxxxxxxxx Tanggal: Senin, 25 Mei, 2009, 2:14 AM
Kus -- You are making a classic afl mistake that almost all of us have made before (more than once for me). The mistake is that: nn is an array which you have on both the left and right side of the = sign in your equation nn = IIf(etc. You are assuming, incorrectly, that the new value of Ref(nn, -1) will always be calculated before it is used in the equation.
This is a good example of when you need use looping with explicit array indexing.
One alternative which could reduce the code within the loop might be:
temp = (C-Ref(C,-1) )/Ref(C,- 1); n[0]=100; for(i-1; i<BarCount; i++){ n[i] = n[i-1]; if(V[i]<V[i-1]) n[i] *= 1 + temp[i]; } -- Keith
Kusnady wrote:
Dear All,
I found some un-answered questions about array processing of the AFL. ------------ --------- --------- --------- --------- --------- --------- -- nn = 100; nn = IIf(V<Ref(V,-1), Ref(nn,-1) + (C-Ref(C,-1) )/Ref(C,- 1) * Ref(nn,-1), Ref(nn,-1)); Plot(nn,"",colorYel low); //---------- --------- --------- --------- --------- n[0]=100; for(i=1;i<BarCount;i++ ) { if(V[i] < V[i-1]) n[i] = n[i-1] + (C[i]-C[i-1] )/C[i-1] * n[i-1]; else n[i] = n[i-1]; } Plot(n,"",colorRed) ; ------------ --------- --------- --------- --------- --------- --------- --------- --- Array of "n" is supp osed to be the same as "nn" in the AFL below, but when they are plotted, they are not the
same...It is the formula of NVI....
Could you help whey "n" is not the same as "nn"? or Do I make a mistake?
Thanks Kus
|
Yahoo! Mail Sekarang Lebih Cepat dan Lebih Bersih. Rasakan bedanya!
|
Firefox 3: Lebih Cepat, Lebih Aman, Dapat Disesuaikan dan Gratis.
__._,_.___
**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.
TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com
TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)
For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
__,_._,___
|