How to change analysis window start date in afl for backtest

I am running a backtest from 1980, the symbol has data back to 1980, but the data used for calculation does not start until 1990.

All the statistics calculate correctly, however the CAR is calculated from 1980 as it should, but how can I change the start date in the afl code so CAR is calculated from 1990?

CAR is calculated for whatever analysis period you choose. Please consult the manual
https://www.amibroker.com/guide/h_newanalysis.html

If you set Range selector to "From-To dates" you would be able to set Start date precisely.

Thank you I understand this, but is there a way to set start date in the afl code rather than manually in the range selector?

Save your analysis into ANALYSIS PROJECT file (using File->Save As...) then instead of loading just formula, load analysis project.
It will set "from" date AND the formula AND the settings in one simple step. That is intended way of operation, not tons of code to change the settings.

I have done this, but then anytime you call project you must run that specific date range.

What I am looking to do is have the flexibility to set start date in analysis window manually, but if by chance I set the date before possible calculation of any trades that it would automatically change start date to first trade date so the CAR reflects actual trades possible.

It does not work that way. CAR is calculated from backtest period but only including data that ARE available.

It does NOT count data that are NOT available.
For example, try changing "From" date to 1900 and then to 1950. It will NOT change CAR unless you actually have data before 1950.

In other words, even if you set 1900 as start date it will NOT use 1900 unless you actually have data starting from 1900. It checks and uses first actually AVAILABLE data bar under test.

You might be misguided if you use padding because padding would add data that exist in REFERENCE symbol, which may or may not exist in a particular other symbol.

The problem I have is that the symbol has data back to 1980, but the data I am using to calculate a trade does not start until 1990. (for ex. put/call ratio or something like this to trigger buy on a symbol. The symbol data could go back further than that of the put/call.)

So when I run the backtest and put in 1980 start date because I forget that no trades can be created until 1990 it goes ahead and calculates the statistics from 1980 because symbol has data back to 1980.

Show the code. It is apparently incorrect.

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.