Backtest date start from in script

Hi, is there any way, how to put date start strategy from backtest in script?
I trade manualy and I run every time backtest and I must every time scroll back few months to date from which strart strategy in main backester…
For example my strategy start date is 10.5.2015 and I need this date add to script to avoid manualy scroling in maim backester Range From - to dates.

Thanks for help.

You don’t need to scroll back. Simply save an analysis project (-> file with APX extension-> File->Save/Save as)! All analysis settings are saved to such project (including range from-to). Then you simply load that project if required and hit analysis execution button. That’s basically it.

Thank You for advice.
So adding date to script is not supported from Amibroker?

If it is not, I think it is a fabulous idea.

Why over complicating things instead of doing what is best? I don’t get it.
A project saves your AFL and your entire analysis settings! What is your gain doing it via code? There isn’t any gain.

Of course you can set data range via code but then metrics of backtest report will be still getting calculated based on entire length of array if start date of code is later than from date of analysis.

So example snippet

dt = DateTime();

start_dt = _DT( "2015-05-10" ); // May 10th 2015
end_dt = LastValue(dt); // last date of array as end date

datewindow = dt >= start_dt AND dt <= end_dt;

YourBuyRules = ....;
YourSellRules = ....;

Buy = YourBuyRules AND datewindow;
Sell = YourSellRules AND datewindow;

// futher code below....
2 Likes

Ok, I will try both of advicess, thank You for your time and help.