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

[amibroker] barcount and selected value, _trace and printf disagreement



PureBytes Links

Trading Reference Links

the code below gives an out of range error while I dont think it should.


I just want to access value of an array after the selected bar, to plot a forecast.
I tried with or without var required and I always get the same error, even if start<barcount( at least from what I can read in the interpretation window).
But if I trace it I get that start=barcount,which explain the error.
How can it be?


SetBarsRequired( -2, -2); 
bi=BarIndex();
	Plot(C,"C",colorBlue);
	start=SelectedValue(bi)-bi[0];
	printf("\n selected bi="+SelectedValue(bi));
	printf("\n bi[0]="+bi[0]);
	printf("\n start=selected bi-bi[0]="+start);
	printf("\n barcount"+BarCount);
	printf("\n start+1="+(start+1));
	printf("\n c[start]="+C[start]);
	

	_TRACE("\n selected bi="+SelectedValue(bi));
	_TRACE("\n bi[0]="+bi[0]);
	_TRACE("\n start=selected bi-bi[0]="+start);
	_TRACE("\n barcount"+BarCount);
	_TRACE("\n start+1="+(start+1));
	_TRACE("\n c[start]="+C[start]);
	_TRACE("\n c[start+1]="+C[start+1]);
	

	_TRACE("\n c[start+1]="+C[start+1]);
	printf("\n c[start+1]="+C[start+1]);

Regards
Ly



------------------------------------

**** 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/

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> 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/