Do you want to get informed about new posts via Email?

"Phantom" equity due to rounding & stock splits?

Author: 123blee9

Creation Date: 7/13/2017 9:47 PM

In the process of replicating WLP's "Trades" tab in a spreadsheet, I discovered a peculiar trait. My spreadsheet long-only strategy was producing far less equity than WLP. I pinpointed the root cause as being attributed to rounding within WLP in combination with stock splits when using limit orders to enter and exit trades. "Help" provides the reasoning for rounding, but that technique results in grossly overstated cumulative equity when the above characteristics are present.

For example, I provide a simple spreadsheet capture whereby 1,000 shares of stock originally traded in a strategy at its original, unadjusted price. To make the example highly simplistic, I assume the trade is entered__and__ exited at the same price of **$55** for no gross gain. Further assume the stock splits 2:1 five times over the course of the strategy analysis period resulting in a current, split-adjusted price of **$1.718750** and split-adjusted shares of **32,000**. Using limit orders to buy and sell the stock within WLP set to 2 decimals; backtesting this single, roundtrip trade results in a phantom gain of $320. This occurs because WLP Buy-Limit orders round-down price to 2 decimals (**$1.71**) and round-up Sell-Limit orders to 2 decimals (**$1.72**). If position sizing is based on "% of Portfolio," this phantom equity is used to purchase phantom shares allowing the $320 to compound over time; and compound it does if you have a long-term, robust strategy.

Rounding up**and** down using a static number of decimal places set to a small value, such as 2, for split-adjusted data over the entire backtesting period makes little sense - especially in the event it provides the modeler with a false sense of confidence in a given strategy that may be nowhere near approximate. A large number of trades also exacerbates the problem. A more preferable approach would employ a term structure of decimal places changing in step when actual splits occur. That, however, presents its own problems. I personally prefer to err on the conservative side if model error is evident. A simple solution would allow the modeler to be consistent in rounding, round all prices up or round all prices down. Are strategies such cliffhangers that they absolutely derive their success/failure on the concept of a mere sub-penny trading rule? If so, they should be abandoned.

As further evidence, I present an actual equity curve using 2-decimal rounding.

Next the same strategy is run using 7-decimal rounding. This particular stock has split numerous times, and this is a more realistic assessment of the strategy's performance. The ending equity falls significantly by ~ $1 million in cumulative phantom value.

Oddly, when I instruct WLP to not use any rounding in the limit trades, the equity curve looks that of the 2-decimal variety though 7 decimals are selected.

For example, I provide a simple spreadsheet capture whereby 1,000 shares of stock originally traded in a strategy at its original, unadjusted price. To make the example highly simplistic, I assume the trade is entered

Rounding up

As further evidence, I present an actual equity curve using 2-decimal rounding.

Next the same strategy is run using 7-decimal rounding. This particular stock has split numerous times, and this is a more realistic assessment of the strategy's performance. The ending equity falls significantly by ~ $1 million in cumulative phantom value.

Oddly, when I instruct WLP to not use any rounding in the limit trades, the equity curve looks that of the 2-decimal variety though 7 decimals are selected.

QUOTE:

If position sizing is based on "% of Portfolio," this phantom equity is used to purchase phantom shares allowing the $320 to compound over time; and compound it does if you have a long-term, robust strategy.

Yes, this is a known fact that split and dividend adjustment can lead to a loss of precision: Rounding when backtesting - how do you deal with it? That's why it's advused to enable "Turn off limit/stop order rounding entirely" in Wealth-Lab's Preferences > Backtest Settings.

If you prefer to err on the conservative side, you might consider using Monte Carlo simulations.

QUOTE:

The ending equity falls significantly by ~ $1 million in cumulative phantom value.

I'm afarid there's not enough detail as to what's going on here with this $1 mln. without the actual data files, strategy code, and settings.

Attached are actual split data for an equity under analysis. A simple look indicates rounding should change by 1-decimal for each 2:1 stock split and only apply until the next 2:1 split.

As I generally model beginning on 1/1/2001 (after split #2 / before split #3 per the attached), decimal rounding in the range of 2-5 would be applicable for my analysis period.

1. Decimal rounding = 2 = overly aggressive (phantom equity produced due to rounding up and down)

2. Decimal rounding = 5 = overly conservative (only applies to ~3 yrs of the modeled data, 1/1/2001 to 12/18/2003)

3. Using 3 or 4 decimal-rounding would paint a tradeoff between the 2/5 extreme decimal rounding values

However, the problem of rounding up and rounding down persists with any rounding (1-7). Again, when I turn rounding off, it produces results similar to rounding to 2 decimals (phantom equity) in the example cited above.

Is Fidelity split-adjusted data rounded/truncated to "4" decimals? When I select 7 decimals, the price data from the chart only possesses 4 decimals. Though the "Trades" tab displays 7 decimals, it's actually just 4 decimal precision (last 3 digits = 000 or 999). With five historical 2:1 stock splits, the precision should extend past 4 decimals. Otherwise, phantom equity is produced from this level of rounding/truncation. I assume the data should extend to 7 actual decimals, since that is a selection available in WLP for rounding. True?

As I generally model beginning on 1/1/2001 (after split #2 / before split #3 per the attached), decimal rounding in the range of 2-5 would be applicable for my analysis period.

1. Decimal rounding = 2 = overly aggressive (phantom equity produced due to rounding up and down)

2. Decimal rounding = 5 = overly conservative (only applies to ~3 yrs of the modeled data, 1/1/2001 to 12/18/2003)

3. Using 3 or 4 decimal-rounding would paint a tradeoff between the 2/5 extreme decimal rounding values

However, the problem of rounding up and rounding down persists with any rounding (1-7). Again, when I turn rounding off, it produces results similar to rounding to 2 decimals (phantom equity) in the example cited above.

Is Fidelity split-adjusted data rounded/truncated to "4" decimals? When I select 7 decimals, the price data from the chart only possesses 4 decimals. Though the "Trades" tab displays 7 decimals, it's actually just 4 decimal precision (last 3 digits = 000 or 999). With five historical 2:1 stock splits, the precision should extend past 4 decimals. Otherwise, phantom equity is produced from this level of rounding/truncation. I assume the data should extend to 7 actual decimals, since that is a selection available in WLP for rounding. True?

When I select Preferences, I do not see Wealth-Data as an option. I've heard horror stories regarding Yahoo data, so I elect to steer clear of that source.

When I visit the Wealth-Data website, the link to activate the data source simply navigates to the ever popular WealthLab download site (???). Simple question, how can Wealth Data be more robust(cleaner) than Fidelity data??? Didn't Fidelity purchase WealthLab a decade ago?

Data quality is of extreme importance to my analysis, as I trade based on the data and plan to sell personally developed systems to commercial clients.

In answer to one of my own questions above, utilizing 4 decimals for rounding versus 7 decimals within WLP provides meaningful, different cumulative equity results; even though the Trades tab show identical pricing.

In order to assist my my data understanding in concert with WLP analysis, I reiterate my above unanswered questions.

Is Fidelity split-adjusted data rounded/truncated to "4" decimals? When I select 7 decimals, the price data from the chart only possesses 4 decimals. Though the "Trades" tab displays 7 decimals, it's actually just 4 decimal precision (last 3 digits = 000 or 999). With five historical 2:1 stock splits, the precision should extend past 4 decimals. Otherwise, phantom equity is produced from this level of rounding/truncation. I assume the data should extend to 7 actual decimals, since that is a selection available in WLP for rounding. True?

I trust you can well understand my concerns/questions; as I have personal and, so to be, sophisticated commercial client monies in play.

When I visit the Wealth-Data website, the link to activate the data source simply navigates to the ever popular WealthLab download site (???). Simple question, how can Wealth Data be more robust(cleaner) than Fidelity data??? Didn't Fidelity purchase WealthLab a decade ago?

Data quality is of extreme importance to my analysis, as I trade based on the data and plan to sell personally developed systems to commercial clients.

In answer to one of my own questions above, utilizing 4 decimals for rounding versus 7 decimals within WLP provides meaningful, different cumulative equity results; even though the Trades tab show identical pricing.

In order to assist my my data understanding in concert with WLP analysis, I reiterate my above unanswered questions.

Is Fidelity split-adjusted data rounded/truncated to "4" decimals? When I select 7 decimals, the price data from the chart only possesses 4 decimals. Though the "Trades" tab displays 7 decimals, it's actually just 4 decimal precision (last 3 digits = 000 or 999). With five historical 2:1 stock splits, the precision should extend past 4 decimals. Otherwise, phantom equity is produced from this level of rounding/truncation. I assume the data should extend to 7 actual decimals, since that is a selection available in WLP for rounding. True?

I trust you can well understand my concerns/questions; as I have personal and, so to be, sophisticated commercial client monies in play.

QUOTE:

Didn't Fidelity purchase WealthLab a decade ago?

Wealth-Data is developed by MS123 LLC, a 3rd party company that runs the wealth-lab.com website, is involved in Wealth-Lab extension development, acts as an analyst and facilitator to submit problems to Fidelity, and is licensed by Fidelity to support and resell Wealth-Lab products to international customers.

QUOTE:

Simple question, how can Wealth Data be more robust(cleaner) than Fidelity data???

Simple answer: because it employs in-house algorithms for eliminating untradeable data and careful processing of corporate events. The Wealth-Data FAQ explains it pretty visually. If you like to give W-D a try please sign up at wealth-data.com, install the extension and restart WLP: W-D provider. It's free. If it doesn't suit you, question closed.

Personally, I don't know what digit is Fidelity data rounded to (I don't use WLP at all) but maybe our expert Cone has an idea?

Thanks Eugene. The FAQ is informative and appeals to my conservative modeling stance. I will give it a try.

Full accuracy in split adjusted data may be the best solution. However consider trading split unadjusted prices. Create an entire price series for each split and make the buy and sell on the relevant series. In your example, both buy and sell would be made whenever they occurred at 55 exactly. Slight rounding can occur at the high and low of the unadjusted bars but all limit prices in between should be very realistic and under your control.

Dividends if desired must be added through a separate process.

For example I have a WLP system that processes historical trades from actual trade prices. Overall results match to the penny Active Trader Pro official results. All trades including splits are automatically traded on unadjusted series. All trades are processed as WLP limit or stop orders with no rounding error.

Dividends if desired must be added through a separate process.

For example I have a WLP system that processes historical trades from actual trade prices. Overall results match to the penny Active Trader Pro official results. All trades including splits are automatically traded on unadjusted series. All trades are processed as WLP limit or stop orders with no rounding error.