How to allow for both Capital Reconstructions and ASX tick size rounding

I'm a huge fan of the way the Norgate Database settings allow selection of price adjustments settings. I generally run my backtests with adjustment for capital reconstructions and special distributions, as to the best of my understanding that is the best way to realistically simulate how real life trading would have occurred (without considering any dividends earned for long positions or dividends paid in lieu for short positions).

However, I'm encountered a small issue when I backtest over the ASX. The price ticks for ASX stocks (at least when I traded them years ago) where 0.1c for stocks under 10c, 0.5c for stocks between 10c and $2 and 1c for stocks over $2. Hence if I determined a price point to place a trade at by some calculation, say Previous Close + ATR(5) , I would need to round it to be able to place the order properly.
I would use a line of code similar to the following when calculating the price to place orders at:

PricePoint = IIf(Close> 2.00, round(PricePoint*100)/100, IIf(C < 0.10, round(PricePoint*1000)/1000, round(PricePoint*200)/200));

However, I noticed that when I use the adjustment for capital reconstructions and special distributions, a lot of the time I get some very small decimals (due to all the adjustments) and rounding the figures like this is giving me some weird trades. This left me with a bit of a dilemma in that:

  1. If I remove all rounding code, I get left with price points that don't realistically exist in the market, i.e. I am simulating putting a limit sell order at say $6.028674 when I couldn't realistically have a put an order in at that price.

  2. If I leave the rounding code, I get a number rounded to a 1c value (for a stock over $2) that doesn't actually correspond to the realistic points where orders could be placed at that point in time, as I have rounded relative to the adjusted close, not the actual close at that time in the past.

Hopefully that makes sense, I apologize if that is not clear.

Assuming I'm not missing something simple within the NorgateData software itself to correct my problem, this is the only thing I could come up with:

#include_once "Formulas\Norgate Data\Norgate Data Functions.afl"

oc = NorgateOriginalCloseTimeSeries();	//	original closing price

Ratio = Close / oc;

oh = High / Ratio;
ol = Low / Ratio;
oo = Open /Ratio;

OriginalLimitSellPrice = RawLimitSellPrice / Ratio;
RoundedOriginalLimitSellPrice = IIf(oc > 2.00, round(OriginalLimitSellPrice*100)/100, IIf(oc < 0.10, round(OriginalLimitSellPrice*1000)/1000, round(OriginalLimitSellPrice*200)/200));
LimitSellPrice = RoundedOriginalLimitSellPrice * Ratio;

Just wondering if anyone can see if there is a problem with what I am doing, or this would be a genuine way to correct for the problem I'm having.

Apologies if I have misunderstood the way the adjusted prices in NorgateData work, if that's the case, I'm love it if someone could correct my understanding.

I've got a similar problem with CSI data...

I use CSI and the Metastock Plug-In. I adjust US stocks for splits, dividends, & capital gains.

So historical prices can get tiny, for example AAPL open 1980-12-12 = 0.10045760

When I chart AAPL in Amibroker, it looks like it truncates to 2 decimal places so 1980-12-12 = 0.10

Then next open is 1980-12-15 = 0.09565311 but to two decimal places is 0.10, again.

Is there a way to use full precision prices in Amibroker including the Backtester?

Or am I on the wrong track and need to change my CSI settings?

Thanks for any tips

@Narcissus Whilst you could certainly simulate minimum tick sizes for backtesting on adjusted data - the results are probably not going to be significantly different (and, if they are, you are most likely getting profits from intraday noise, which isn't good - the signals your backtest is acting upon is probably not significantly significant). Note that the minimum tick levels have varied over the years too, as has the procedure for the single price opening and closing auctions. Don't take my word for it though - test it!

@stevo713 The rounding is simply an on-screen display. Backtesting works on the full price (stored internally in AmiBroker in single precision floating point format - accurate for about 6-7 significant figures). Further to this, Nasdaq reporting of opening prices prior to about 1983 for stocks in the lesser Nasdaq tiers was patchy at best. You'll probably find that open price is simulated anyway!

1 Like

@NorgateData , thanks Richard. Yes, I'm aware that the overall results shouldn't be (and aren't) significantly different, whether I simulate the minimum tick sizes or not. One of the things I love about the survivorship bias free databases you guys have put together is that I can run the AB simulation (using NorgateData data) each day and compare it to how my system is actually trading in my trading account in real time.

I'm a bit OCD I guess, and it was driving me nuts that I was getting different real time trading results to what a (semi) real time AB simulation was showing, because when one trade is missed/taken when it shouldn't be, it has follow on effects on other possible trades if there are limits on capital, limits on number of orders placed per day, number of trades allowed, etc. When I've applied the code I included in my post, the issue seems to be resolved, and apart from slippage (which is much more common in the smaller Australian market than US), I get the AB simulation giving the same results as real time trading now.

Cheers again for the great data package you guys put together. I used to create these survivorship bias free databases myself and you've saved me hours and hours of work. If you'd ever consider putting together a similar package for European or Asian stocks, you'd save me even more heartache. But I'll be grateful for what I have at the moment, super happy with the Australian and US packages you guys have.

@Narcissus

Many thanks for the info.

I have noticed 'sketchy' daily data in the 80s. E.g., many days in a row of high volume stocks with O=H & L=C, etc.

I can't really speak for CSI Data as I've never used them, and I also have no idea about their database settings. Sometimes data going back to the 1980s and before looks really dodgy and it's hard to tell if it is erroneous data or the stock was just really lightly traded.

I can only speak on my data provider, but Norgate have been pretty good at answering queries from me about any data I have queries on.

I guess one way you could reassure yourself if money is no object is to source data from several providers and compare the dodgy days. But hey, since when is money no object?! It's definitely an object for me!

I wish you good luck with it mate.

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