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

[amibroker] Looping Problem using Array Variables



PureBytes Links

Trading Reference Links

Does anyone know how to work around this problem? Since the loop 
statement does not allow array type variables (Value3), this code 
will not work. 


Price = ( H + L ) /2; 
Smooth = (Price + 2 * Ref( Price, -1 ) + 2 * Ref( Price, -2 ) + Ref( 
Price, -3 ) )/6; 


Length = 39; 

for( Value3 = 0.2; Value3 > 0.002; Length = Length - 2 ) 
{ 
alpha = 2 / ( Length + 1 ); 

Value1 = Median( Smooth, Length ); 
Value2 = AMA( Smooth, alpha ); 

Value3 = Nz( abs( Value1 - Value2 )/Value1 ); 

} 

AvgLength = IIf( Length < 3, 3, Length ); 
AvgAlpha = 2 / (AvgLength + 1); 

Filt = AMA( Smooth, AvgAlpha); 

Plot( C, "Price", colorBlack, styleBar ); 
Plot( Filt, "Filt", colorRed, styleThick );[/code]




Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

For other support material please check also:
http://www.amibroker.com/support.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/