[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] loops and lastvalue part I



PureBytes Links

Trading Reference Links

Hello all,
that's many times that I ask me if the usage of lastvalue in a loop 
returns expected results, as lastvalue returns the scalar value of 
the last bar of an array and can be used in a loop.
the example below confirms, I suppose, that we must take care of 
lastvalue in a loop.
I think I am right?

Stephane


myMFI = MFI( 14 );
myRSI=RSI(14);
average=averageLV=0;
for( i = 0 ; i < BarCount; i++ )
{
if(  myMFI[i] > myRsi[i] ) 
average ++; 
if(  myMFI[i] > LastValue(RSI(14)) ) 
averageLV ++; 

result[i]=average;
resultLV[i]=averageLV;
}

Plot(result,"",2,1);
Plot(resultLV,"",3,1);



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
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:
    http://docs.yahoo.com/info/terms/