Running Exploration on predefined bars (Filter Mode)

Dear Team,

I am working on an afl wherein no of Bars is getting predefined using a user input on date. The base code is as follows:

                fromdateCal = StrToDateTime( ParamDate("Start Date", "2013-03-14", 1 ) );
		fromdatestr = DateTimetoStr(fromdateCal);
		
		startDate = DateTimeDiff(DateTime(),fromdateCal) == 0;
		
		Barsno = BarsSince( DateTime() <= _DT(fromdatestr));
		BarsNum = LastValue(Barsno);

Now I wish to run the exploration on "BarsNo" -> Bypassing the Filter (Range) in the exploration. e.g.
If BarsNo = 100 then exploration should show 100 rows corresponding to 100 last bars.

You SHOULD just use Range setting. No matter what range you choose normally, the exploration output is AUTOMATICALLY limited to selected range. No need to code anything.

Filter = 1; // automatically show ALL bars belonging to selected RANGE

Dear Tomasz,

Reproducing the code for adjustments in Aux 1 (Average Traded Prrices)

Filter=1; 

dn = DateNum(); 

SplitRatio = Param("Ratio",1,0,200,0.05);
FromDate = ParamDate("Start Date","13-03-14");
LastDate = ParamDate("Last Date",Date()); 
ATPAdj = IIf( dn >= FromDate AND dn <= LastDate, (Aux1 / SplitRatio), Aux1 ); 

fromdateCal = StrToDateTime( ParamDate("Start Date", "2013-03-14", 1 ) );
fromdatestr = DateTimetoStr(fromdateCal);
		
startDate = DateTimeDiff(DateTime(),fromdateCal) == 0;
		
Barsno = BarsSince( DateTime() <= _DT(fromdatestr));
BarsNum = LastValue(Barsno);

SetBarsRequired(BarsNum,BarsNum);


AddTextColumn(FullName(),"F-Name");
AddColumn(O,"Open"); 
AddColumn(H,"High"); 
AddColumn(L,"Low"); 
AddColumn(C,"Close"); 
AddColumn(V,"Volume",1.0); 
AddColumn(OI,"Open Interest",1.0); 
AddColumn(ATPAdj,"ATP Adjusted",1.2); 

SetSortColumns(-2);


The first date is fixed (13-03-14) but the second date is variable (date when the corporate action is lapsed). So Aux1 is to be adjusted till second date. Each day as the trading completes number of bars have to be manually changed in range, instead can it be changed as part of code itself?