How to plot Yahoo dividend adjusted OHLC values

Hello AmiTraders,

Here is a way to plot Yahoo historical data adjusted for dividends, like it used to be.
Currently (after the change), Yahoo provides date, open, high, low, close, adjusted close and volume.
The OHLC values are raw or non-adjusted values except for the adjusted close. But with both the adjusted and non-adjusted closes we can create an adjustment ratio to modify the OHLC values.

To make use of the adjusted close, edit aqh.format in the formats subdirectory and change the word skip in the $FORMAT line to Aux1.
It should now look like this:
$FORMAT Date_DMY,Open,High,Low,Close,Aux1,Volume
Now the Aux1 field will be populated with adjusted close values the next time you run Amiquote with Yahoo historical quotes.

Create a new AFL fomula called and copy the code below into it.
Put the formula into a new pane and see how it works.

NOW, if only this could be done in AmiQuote at the flip of a switch, that would really be the cat’s meow…


// created 7/27/17

// set chart options

//calculate the adjustment ratio
adj_ratio = Aux1/Close;

// calculate the adjusted O H L C values
a_open = Open * adj_ratio;
a_hi = High * adj_ratio;
a_lo = Low * adj_ratio;
a_close = Close * adj_ratio;

// create the title block at the top of the chart
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} open %g, hi %g, lo %g, close %g (%.2f%%) {{VALUES}}", a_open, a_hi, a_lo, a_close, SelectedValue( ROC(a_close, 1 ) ) ));

// now plot the candles using adjusted data
PlotOHLC(a_open,a_hi,a_lo,a_close, "A_Close", ParamColor("Candle Color", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); 

It can. Read the FAQ point 12.

Tomasz - can you please point me to where to find the “FAQ point 12” you refer to here? Thank you. Sorry but I cannot find it on my own.

You can’t find it? How about entering “AmiQuote frequently asked questions” in the search box?
You would easily find it

I went to Program Files\Amibroker\Formats\aqh.format and opened it up with notepad.
On or about the 8th line I saw the $FORMAT statement.
I made it look like this:

$FORMAT Date_DMY,Open,High,Low,Close,AdjClose,Volume

Then I saved the file.

NOTE: Be sure you download ALL the historical data every time you update the stock, because everytime there is a dividend all the previous stock prices are adjusted downwards.

Best of luck to you.

Thank you for your help Bushido!!

Thank you for your help Tomasz.