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

[amibroker] subarrays



PureBytes Links

Trading Reference Links

hi,

I want to use subarrays. For instance I want to use it to fit certain 
patterns that consist of maybe 5 bars.

I am trying to write this getSubArray function, see below. The error 
(I think because error message is not real clear) I think here is 
that I have to create the output array with a proper length (e.g. 5 
bars). How do I do that?

thanks, Ed



function getSubArray( ain, startdate, enddate ){

	// ain: input array
	// aout: output array

	sdate = IIf(DateNum() == startdate,BarIndex(),0);
	edate = IIf(DateNum() == enddate,BarIndex(),0);
	cnt = 0;	
	aout=ain; aout=0;
	for( i = sdate; edate; i++ ) {

		aout[cnt] = ain[i];	
		cnt = cnt + 1;
	}
	
	return aout; 
} 



error message:

Line 12, Column 777:
//rr = IIf(DateNum() == startdate,BarIndex(),0);

//Filter = rr;



rr=getSubArray(C,1031008,1031010);
---------------------------------^

Error 3.
Condition in IF, WHILE, FOR statements
has to be Numeric or Boolean type.
You can not use array here,
please use [] (array subscript operator)
to access array elements



------------------------ Yahoo! Groups Sponsor ---------------------~-->
Rent DVDs Online - Over 14,500 titles.
No Late Fees & Free Shipping.
Try Netflix for FREE!
http://us.click.yahoo.com/JYdFFC/XP.FAA/3jkFAA/GHeqlB/TM
---------------------------------------------------------------------~->

Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/