[amibroker] Using From and To dates from Auto Analysis in Code

 

This code is from the AFL library and I'd like to apply it to all my explorer codes to preset the date ranges for my explorations, but I don't quite understand what part of the code I need to use.  Can someone help me to determine the essential portion and I can use it in and include file for all my explorations.  I'm guessing that the period is the number of day (bars on a daily chart), but how do I apply the FirstBarInRange and the LastBarInRange to a filter?

==============================================

Periods=40;  x=BarIndex();  xMA=tcnt=tsum=Null;  xfirst = LastValue(ValueWhen(Status("FirstBarInRange"), x, 1));  xlast  = LastValue(ValueWhen(Status("LastBarInRange" ), x, 1));  if(xfirst>Periods){  	for (i = xfirst; i < xlast + 1; i++){  		tcnt[i]=0;  		tsum[i]=0;  		for (j=0; j<Periods; j++){ 	  			tcnt[i]++;  			tsum[i]= tsum[i] + Close[i-j];  		} 		                      		xMA[i]=tsum[i]/tcnt[i];  }  Title= "xFirst= " + WriteVal(xFirst,1.0) + ", xLast= " + WriteVal(xLast,1.0);  Plot(Close,"Close",colorBlack,styleLine+styleThick);  Plot(xMA,"xMA",colorRed,styleLine+styleThick);  PlotShapes( IIf( xfirst==x, shapeCircle, shapeNone ), colorIndigo );  PlotShapes( IIf( xlast==x, shapeCircle, shapeNone ), colorIndigo );  Buy=Cross(C,xMA);  Sell=Cross(xMA,C);  Buy   = ExRem(Buy,  Sell);  Sell  = ExRem(Sell, Buy);  PlotShapes( IIf( Buy, shapeUpArrow, shapeNone ), colorGreen );  PlotShapes( IIf( Sell, shapeDownArrow, shapeNone ), colorRed );        Filter=  C>10;  AddColumn(Close,       "Close"            , 1.2);  AddColumn(Volume,      "Volume"           , 1.0);  }


__._,_.___

Posted by: jockpotter@yahoo.com
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (1)

Upgrade your account with the latest Yahoo Mail app
Get organized with the fast and easy-to-use Yahoo Mail app. Upgrade today!

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


.

__,_._,___


EmoticonEmoticon