Maximum Shares = 2,147,483,647
Author: KGo
Creation Date: 6/26/2015 3:38 PM
profile picture

KGo

#1
A backtest produced the typical message regarding trades skipped due to insufficient capital. After trying various workarounds I conclude the skipped trades are due to exceeding the int32 max value for shares (2,147,483,647). I am running WLP 64 bit edition.
1. Is there a workaround? maybe to have shares be int64?
2. It would have saved a lot of time to have the skipped trades error reflect the cause. Could that error be noted?
3. Please confirm the limitation.
profile picture

Eugene

#2
"Limitation" confimed: Not all trades taken when equity reaches HUGE numbers

Workaround: reduce starting equity to make sure the system isn't trading unrealistic position sizes.
profile picture

KGo

#3
Thanks for the quick response and link. Here too there is no possible reduction in starting equity to complete the analysis because starting equity would be below the cost of 1 share. Reducing portfolio profitability or breaking the analysis up into multiple time periods get the analysis done but performance statistics are compromised.

A warning message when the limit is exceeded would be helpful for the next customer that hits this problem.
profile picture

Eugene

#4
QUOTE:
A warning message when the limit is exceeded would be helpful for the next customer that hits this problem.

In an ideal world, yes. In the real world, better forget about it.

A low importance issue like that would never make it. (We lobbied for a solution to crashes (!) on change of regional settings for years.) Considering only two occasions of unrealistic billion-share backtest in 7 years of WL .NET history, it's a non-issue from a business perspective.
profile picture

Cone

#5
To quickly add a touch of realism to your simulation, I recommend applying the Backtest Settings Preference: "Limit a Position's Quantity to a Percentage of the Bar's Volume..." A number as high as 10% would still be pretty ingenuous, but give it a try.

Note: 2.1 e+9 is about twice the entire NYSE typical daily volume (currently).
profile picture

KGo

#6
OK I get that an execution error message is not possible.

Yes, volumes in the analysis are totally unrealistic and I agree that a realistic portfolio analysis would have different position sizing.

The purpose was to look at performance metrics especially Return % and Max DD % graphically and over various periods. Regardless of start date, these measures are repeatable during any period and vary greatly when position size is reduced to accommodate an over-sized equity. In other words I like to see the same Return % and DD % over any period regardless of when the backtest begins.

So, this exercise is to analyze the efficiency of the system then a separate test is done to reflect actual trading expectation.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).