Find unadjusted stock splits

I would like to look at the last 10 months worth of data and find if my data provider had quotes that were not adjusted for splits.. so if there was a 1:10 split it would look like the stock jumped from $1 to $10 overnight.

DayChange = 0;
MaxDayChange = 0;
for (i = 202; i < 4; i--)
{
DayChange[i] = abs ( Ref( Close, -i+2 ) - Ref( Close, -i+1 ) ) / Ref( Close, -i+1 ) * 100;
MaxDayChange = Max ( DayChange[i] );
}

AddColumn(MaxDayChange,"MaxDayChange", 1.2);
2 Likes
period = 202;
RR = ROC(C, 1);

MinDayChange = LLV(RR, period);
AddColumn(MinDayChange,"MinDayChange", 1.2);

MaxDayChange = HHV(RR, period);
AddColumn(MaxDayChange,"MaxDayChange", 1.2);

DayChange = HHV(abs(RR), period);
AddColumn(DayChange,"AbsDayChange", 1.2);

Filter=1;
2 Likes

Awesome, thank you Anderson!

Please don't forget that this functionality (finding splits and other data issues) is built-in in Tools->Database Purify

1 Like

Hi Experts,

Out of curiosity how AmiBroker performs this automagically !

  1. On what conditions (or comparisons) AB identifies that an adjustment is required on a given date?
  2. How is the guessed Adjustment factor calculated?

Thank you

It’s right in the database purify tool. You can set the percent to detect. Default is 40%.

Thanks @Metamega,

Still got doubts....

Is the same "Database Purify" 40% (or whatever custom%) used in Symbol -> Split? Also how does AB calculate the Adjustment factor automatically?

1 Like

https://www.amibroker.com/guide/h_basic.html

Splitting a stock

To perform stock split use Symbol->Split menu item or Split toolbar button.

AmiBroker provides easy way of handling stock splits. Program will try to guess split date and ratio by analyzing quotations. If there is just a single quotation after split this should work, if not you will be asked for split date and ratio. Note well that this operation can not be undone!!!

From version 2.0 and up the split function offers more functionality: you can use old-style ratio or you can specify a split using following expression:

x->y

which means that x shares before split become y after it. For example 2->3 means that 2 shares become 3 after the split. So ordinary split into five pieces will be 1->5.

As you have probably guessed it is possible now to perform reverse-split, for example 2->1, which means that 2 shares are joined together into 1 share.

Obviously, AB analyzes the big gap and its subsequent quotes so it differs from intraday volatility for example.

1 Like

But how does AB calculate the Adjustment Factor and how does it guess the Split date automatically ? What is the algorithm?

Then you should tag TJ in you post instead of experts :slight_smile: because AB is a proprietary software.

You can make reasonable assumptions yourself to see if the RoC is in conforming ratios like 1:1, 1:2 2:5 and so on which are common. I've even seen 1:10 but something of a round number combined with the subsequent intraday range being reasonably small or some form of ATR etc

Potential candidate for split is bar-to-bar movement of more than +/- 20%. Then AmiBroker tries all factors N/M where N and M are natural numbers 1..5 and picks best match.

Please note that this is just answer of the question posted here and presents current status quo and this information is provided "as-is".

AmiBroker evolves and we may change any algorithm without warning.

4 Likes

Thank you @Tomasz could you please share the maths behind picking the best factor?

I have got some continuous stock futures data for which I am unable to find Split adjusted quotes. And manually it won't be possible to cater all the splits for all the symbols. So, was wondering if I could apply the required adjustments externally directly on the CSVs (based on your logic), then import them back to AB.

BTW I tried to mimic Yahoo's AmiQuote ASCII Import "aqh.format" using AdjClose and $RECALCSPLITS but it did not work either.