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

RE: [amibroker] Indicator code execution



PureBytes Links

Trading Reference Links

You have created an ARRAY result when you just want the total. Not sure
why it shows all years to start with, but as soon as you click you have
SELECTED a SINGLE day and you see the result for that day.

Try this:
printf("#years this symbol %1.0f",Cum(Year() != Ref(Year(),-1)));

The above is still only accurate if clicked somewhere in the most recent
year. You can make it give the same answer all the time by wrapping the
computation inside LastValue(Cum(Year() != Ref(Year(),-1))))
--
Terry

-----Original Message-----
From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On
Behalf Of cpescho
Sent: Monday, June 05, 2006 10:21
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Indicator code execution

Im working on some seasonal indicator but had problems with it.
I stripped the code to the problem related part, see below.
It counts the number of years within a symbol. As soon as i click
on apply indicator it displays the correct year count, but then
everything disappears and the yc is set back to 1. Looks like
the code is executed twice for some reason. Any help?

yc = 0; //Yearcount
yeer = Year();
for(i=1; i<BarCount; i++) {
	if(yeer[i] != yeer[i-1]) {   // year change
		yc++;
		printf("yc %f", yc);
	}
}
 







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