Adjclose vs Close

Close vs Adjclose during backtests

This is related to data from Yahoo Finance. I’ve read the FAQ and Knowledgebase and know about the AQH files. I did change SKIP to ADJCLOSE and I can see that adjclose data is present.

Working with the stock Visa (ticker: V), the v.aqh file is:

$NAME V

Date,Open,High,Low,Close,Adj Close,Volume

19-03-2008,14.875000,17.250000,13.750000,14.125000,11.215883,708486000

You can see the adjclose data is present, but when a backtest is run (or a chart is plotted), it uses close, not adjclose.

My aqh.format file is:

AmiQuote historical quotes download format (.AQH extension)

Revision 1.4 - changed the order of columns (due to July 22, 2017 Yahoo site change)

Revision 1.3 - changed the order of columns (due to May 17, 2017 Yahoo site change)

Revision 1.1 - removed $VOLFACTOR 0.01

The format line below allows to get data adjusted for SPLITS

to get data adjusted for SPLITS AND DIVIDENDS replace 'Skip' by 'AdjClose'

$FORMAT Date_DMY,Open,High,Low,Close,AdjClose,Volume
$SKIPLINES 0
$BREAKONERR 0
$SEPARATOR ,
$DEBUG 1
$AUTOADD 1
$CONT 1
$GROUP 254

the following switches are optional - please consult

the read-me for description of those options

$RAWCLOSE2OI 1

$RECALCSPLITS 1

$ROUNDADJ 4

I’ve searched for a setting which makes the backtester use adjclose but can't find one.

There is no backtester setting because format files are related to IMPORT of data files.
That aqh.format file is used for import of AQH data files to AmiBroker data base.

AQH (data) files (being located in C:\...\AmiBroker\AmiQuote\Download folder) are related to AmiQuote. If you choose "Yahoo Historical" as data source there in AmiQuote and then if you hit download there it will download and create files with file extension *.aqh (if that mentioned data source is selected). If auto-import is checked in AmiQuote the data will be automatically imported to AmiBroker after download (applying the settings of aqh.format import format file).

Now if you change aqh.format file content (as you did) and want to update data of data base symbol(s) then you need to re-download your symbol(s) from Yahoo again (via AmiQuote) with set date range including the date range of your same symbol(s) already having been existed in your AmiBroker data base (since you intend to apply adjusted prices for entire period of that already existing symbol(s) of AB data base). And of course after download AQH data file(s) have to be (auto-)imported again (as mentioned in first paragraph).

So once again as summary:

  1. XXXX.aqh files are data file(s) (downloaded/created by AmiQuote). XXXX stands for any symbol you want to download.
  2. aqh.format file is import format file (containing import settings for XXXX.aqh data file(s) imported to AmiBroker).
  3. If you change aqh.format content and if you want to update AmiBroker data base symbols then you have to re-download data for those AB data base symbols via AmiQuote (including symbol's date range of data base) and have to re-import XXXX.aqh data files after download.

Problem with Yahoo Adj close now is they only provide adj close, no open/high/low adjustments.

Before they use to provide raw o/h/l/c (split adjusted) and adjusted o/h/l/c which took dividends into account.

https://www.amibroker.com/kb/2017/06/30/wrong-close-price-in-yahoo-data/

fxshrat,
Thank you for your very thorough post.
I did change aqh.format BEFORE I downloaded the Visa(V) quotes.
But just to be safe, I re-downloaded the quotes this morning.
The v.aqh file now has todays date modified in Windows Explorer. And I can see that the adj close prices are present.
The 'automatic update' box was checked and I believe the prices went into the Amibroker database.
Unfortunately, both the AB backtester and chart are still showing the Close.
The close for V for 12/31/18 is 131.94 and the adj close is 131.51.
I closed and reopened AB to refresh it, but that did not help.
I also did AB menu, Tools, Auto-update quotes and that did not make a difference.

When both close and adj close are present in the quote files, what setting is it that causes AB to use adj close as close?

SOLVED(?)
I changed a line in adq.format
from
$FORMAT Date_DMY,Open,High,Low,Close,AdjClose,Volume
to
$FORMAT Date_DMY,Open,High,Low,Skip,Close,Volume
then re-downloaded the quotes in AmiQuote and imported them to Amibroker.
Amibroker is now using the AdjClose as Close which was desired.
The only downside to this is that open, high & low are still unadjusted for dividends, but I'm not using them right now, for this particular analysis/research, so that's fine.

The KB article you are quoting is OLD (from 2017). Current versions of AmiBroker and AmiQuote come with all files updated and download adjusted prices (OHLC).

Not to contradict, but the OHL do not seem to be adjusted. See attached screenshot of a Visa chart. The close is lower than the low. I have AB version 6.30.0 (64 bit) and AQ 3.31 (64 bit, copyright 2018). This is not a problem as I'm not currently looking at charts and can easily fix the problem by changing the $FORMAT line, re-downloading and re-importing the quotes.

AB_Chart_Visa

AmiQuote 3.31 is NOT current.

Sorry, that KB article was around same time they changed their data format.

They’ve corrected the OHLC values so their adjusted for splits like the close(before it was just the close) , but adjusted close column (dividend adjusted) is still just a lone column.

Current aqh.format file is AmiQuote 4.12 is

AmiQuote historical quotes download format (.AQH extension)

Revision 1.4 - changed the order of columns (due to July 22, 2017 Yahoo site change)

Revision 1.3 - changed the order of columns (due to May 17, 2017 Yahoo site change)

Revision 1.1 - removed $VOLFACTOR 0.01

The format line below allows to get data adjusted for SPLITS

to get data adjusted for SPLITS AND DIVIDENDS replace 'Skip' by 'AdjClose'

$FORMAT Date_DMY,Open,High,Low,Close,Skip,Volume
$SKIPLINES 0
$BREAKONERR 0
$SEPARATOR ,
$DEBUG 1
$AUTOADD 1
$CONT 1
$GROUP 254

the following switches are optional - please consult

the read-me for description of those options

$RAWCLOSE2OI 1

$RECALCSPLITS 1

$ROUNDADJ 4

If you replace Skip with AdjColse, the the database will now have both Close and AdjClose in it - correct?

Now, where is the switch in AmiBroker to use AdjClose instead of close when conducting backtest with equities where most of their gains are due to Dividends. Using only the Close data will not give you the optimal performance for these equities especially when you are using a rotational strategy.

How do we tell AmiBroker to use AdjClose instead of Close to conduct a backtest without having 2 databases one Close and the other AdjClose?