How to Use this Tool
It has been demonstrated that buying and selling equities in certain prescribed ways tends to increase one's returns over time. The most commonly employed such strategy is Dollar Cost Averaging (DCA). An alternative is called Value Averaging (VA). This app was created in order to test equity buying and selling strategies such as these.
The Ticker Symbol field links directly to the Yahoo.com Finance site to download a .cvs report for the date range entered. At this time, the reported fund prices are weekly, and cannot be changed. Hence, price changes are from week to week. The field only accepts ticker symbols, with an optional two letter Exchange designation (e.g., TO for Toronto Stock Exchange). If you need to perform a symbol lookup, you may do so on the Yahoo.com Finance site.
The Benchmark Fund Start Value field sets the lump sum to start with. That amount will be invested on the Start Date provided and it's final sum will reflect how much that amount of money would be worth by the End Date.
The Strategy Fund Start Value sets the lump sum to start with on the account that will apply the buying and selling strategy. I would generally recommend that both the Benchmark and Strategy fund start values are identical for an accurate comparison.
When funds are sold, the go into a Side Fund account. The Annualized Side Fund Interest Rate sets how much interest the account will earn on an annualized basis. At this time, a typical rate of return would be between .25% and 2.0% - maybe more or less, depending on your country's economy.
The Period Start and End Dates determines the investing time frame. Manipulating these values can alter the investment type from shot to long-term.
Standard Deviation and the Deviation Threshold Field
In this first version of the Simulator, buying and selling decisions are based on the Deviation Threshold Percentage. The Deviation Threshold Field accepts a percentage value that triggers purchase and sell events whereby a Weekly Percentage Change above the percentage value signals a sell and a Weekly Percentage Change below the percentage value signals a purchase.
The image below shows a sample distribution for the S&P500 where the blue line represents a fine-grained distribution and the red line a more typical bell curve. On the Y axis, we have the Weekly Percentage Change. The X axis measures the number of occurrences at each Percentage Change. The thick black line highlights the most common change at about 1.3%. We can also see that the most common range of weekly changes is between plus or minus 1.5%.
Anything outside of that plus or minus 1.5% range represents a more rare event and should eventually result in an eventual regression to the mean. In fact, one could assume that the further we go from the mean, the more likely a return to the mean will occur at some later time. At least that's the theory! This app helps us answer that assumption.
A good read that I found on Standard Deviation can be found on
Using the Buy and Sell radio buttons, we can test what effect removing the buy or sell actions have on the strategy as well as answer the question as to whether buying or selling plays more of a role than the other in the resulting performance.
All trades come at a cost. Broker Fees can range anywhere from $6.99 to $39.99 or more and should be accounted for. The Broker Fee field accepts the exact dollar amount up to $99.99. Entering a value of zero or leaving the field empty are permitted and can illustrate the difference that Broker Fees make on the overall strategy.
A Word about Margin
When used properly, the judicious use of margin *can* enhance returns. On the other hand, they can also erode one's capital entirely away when things go awry! Why not test its effects here rather than with real money?
The Use margin? checkbox will determine whether or not the following margin-related fields will be applied.
The Annualized Margin Rate is similar to the Annualized Side Fund Interest Rate except that the former sets how much interest the account will incur on an annualized basis. Hence, the higher this value, the more money will be lost to interest charges. The interest rates for borrowing are almost always higher than those paid out on interest bearing accounts. Typically, one would expect to pay at least two percentage points higher than that of the Annualized Side Fund Interest Rate. Entering a value of zero or leaving the field empty are permitted and can illustrate the difference that the Margin Rate makes on the overall strategy.
There are two types of Margin Limits to choose from. The first is the fixed Total Dollar amount, whereby a sum of $0 to $999,999.99 dollars can be entered. Of course, at the higher end of the scale, such a high limit could be considered as no limit. The other, Percent of Account, option is more typical of Margin accounts available from brokerage houses. Choosing this option will enable the triggering of margin calls whenever the margin amount rises above that of the investment account, as ascribed via the Percent of Account field. Thus, entering an amount of 50% would mean that whenever the margin exceeds fifty percent of the value of the strategy fund, the application will sell whatever amount of funds are required to cover the difference. For example, if the margin rose to $6,240 (52%) of the investment funds' value of $12,000, then the excess of $240 would be sold immediately to bring the margin level back to the limit of 50%. As a general rule of thumb, margin calls are bad for investment returns!
This application is for entertainment purposes only. Any results obtained are not to be taken as a substitute for professional investment advice in any way, shape, or form. Since it uses backtesting exclusively, there can be no guarantee that results would be indicative of future performance.
This will be an ongoing project, so I would appreciate any feedback that you might have, whether it be bug reports, suggestions, feature requests, or just general comments! Email me at: rgsonsulting(AT)robgravelle(DOT)com (Don't forget to replace the (AT) and the (DOT) with the '@' and '.' characters!)
Sep 2012: Beta Version 2
- Added benchmark vs. strategy fund comparison chart using PlotKit. Not supported in IE 8 and below.
- Added function to divvy the broker fees between the strategy fund and and side fund. The latter takes precedence so that funds are not drained unnecessarily from the strategy fund. Margin may be used on purchases, but not on sales.
- Added minimum transaction amount of twice the broker fees in order to avoid minuscule transactions.
Interpreting the Results
The results of the fund analyses are divided into three sections: the Performance Comparison table, the Summary table, and Charts. Of the three, the Performance Comparison table contains the most fine grained data, so let's look at it first.
The Performance Comparison table contains seven fields as follows:
- Period Ending: The date marking the end of each week.
- Price: The closing price of the benchmark fund on the last day of the week.
- % Change: The percentage change of the benchmark fund since the previous week.
- Fund Value: The total value of the benchmark fund (previous week's fund value times the percentage change).
- Strategy Fund Value: The total value of the strategy fund (previous week's fund value times the percentage change plus or minus any purchases or sales).
- Side Fund Value: The value of the side fund adjusting for transactions and interest accumulation.
- Purchases/Sales: Transactions incurred that week based on timing or fund performance.
Here we see the first four rows of data comparing the weekly performance of our chosen fund using a strategy versus a simple lump sum investment, whereby no further action is taken after the initial purchase. The first row contains the fund data for the end of the first week of the selected Period Start Date. Hence, if your date falls on a Tuesday, the fund data for that Friday will be displayed. The percentage change is always shown as N/A because the Price is the starting one. Likewise, the Side Fund Value will start off without any funds and no transactions will have been triggered at that point.
The second row is where the comparison analysis begins. We can see that the Price has fallen from $118.76 to $117.74, which amounts to a Percentage (%) Change of -2.02%. This change was enough to trigger a purchase $500.32 of additional funds (using margin). This figure is calculated by multiplying the Strategy Fund Value by the difference between the Percentage (%) Change and the selected Deviation Threshold (in this case plus or minus 1 percent). The Side Fund has decreased by an additional ten dollars to cover the brokerage fee. When ever possible, the broker fee is paid from the Side fund in order to minimize deductions from the Strategy Fund. However, in cases where there are insufficient funds to cover a sale such as in the case of a margin call, the broker fee may be partially or fully covered by the Strategy Fund.
In the third row, we find that the funds have increased by 123.57, or 4.05%. That brings the benchmark fund to $50973.52. After selling $1570.67 of stock, the Strategy Fund Value should be $49923.44. However, since the Side Fund has a negative balance, the broker fee was paid from the Strategy Fund, bringing it to the $49913.44 that we see displayed. The Side Fund may now benefit from the Annualized Side Fund Interest Rate or be saddled with margin interest as per the Annualized Margin Interest Rate field value. Having a negative balance of -$510.32, the Side Funds would incur 0.010958904109589041% daily, or $0.39147923093361986 per week. The value of -$1570.67 was obtained by subtracting the weekly margin interest from the previous week's value of -$510.32 and adding the sale of $1570.67 worth of stock.
The fourth row sees another decline in fund value from $123.57 to $122.25 - a change of -1.07%. This the value of the benchmark fund it adjusted to reflect the change and now stands at $50,429.01. Meanwhile, such a small decline in value only triggers $33.69 of new stock to be purchased. Since the Side Fund has more than enough to cover both the amount and broker fee, they are deducted and the purchase amount (WHICH DOES NOT INCLUDE THE BROKER FEE) is transfered to the Strategy Fund. The Annualized Side Fund Interest Rate is applied to the Side Fund because it has a positive balance.
||Strategy Fund Value
||Side Fund Value
The Summary Table
The Summary Table provides totals, averages, and high level overview of the Strategy fund's performance compared to the benchmark. Here are some sample Summary Tables followed by an explanation of each table's fields:
Margin not used:
|AVERAGE CHANGE||Benchmark Fund Total||Strategy Fund Total||Side Fund Interest||Margin Interest||# of Margin Calls||Total number of periods||# of times above deviation threshold||# of times below deviation threshold|
|-0.88%||$3,102.05 (-46.015% per annum)||$9,005.20* (-31.623% per annum)||$846.51||$0.00||0||235||78 (33.19% of periods)||99 (42.13% of periods)|
*Includes $3,507.29 side fund value, $846.51 interest and $1,740.00 broker fees
|Average Change||Benchmark Fund Total||Strategy Fund Total||Side Fund Interest||Margin Interest||# of Margin Calls||Total number of periods||# of times above deviation threshold||# of times below deviation threshold|
|-0.88%||$3,102.05 (-46.035% per annum)||-$2,546.87* (>-100%)||$451.32||$540.49||0||235||91 (38.72% of periods)||109 (46.38% of periods)|
*Includes $11,517.36 margin, $570.10 margin interest, side fund value, $314.13 interest, and $1,780.00 broker fees
- Average Change: The arithmetic mean of all the weekly percentage changes of the benchmark fund.
- Benchmark Fund Total: The final account value of the Benchmark Fund after the selected number of weeks. The resulting annualized returns are also included in parentheses.
- Strategy Fund Total: The final account value of the Strategy Fund after the selected number of weeks. To give an accurate final value, this number takes into account the final Side Fund Value, interest, and broker fees. If margin was employed, it, along with interest incurred are also factored in. Again, the resulting annualized returns are included in parentheses. In some situations where margin is used, a loss of greater than 100 percent may result. In those instances, an annualized figure is not provided. Instead, the following ">-100%" indicates that the loss exceeded the principal.
- Side Fund Interest: The total amount of interest earned on the Side Fund.
- Margin Interest: The total amount of margin interest accrued.
- # of Margin Calls: The total number of margin calls caused by the margin amount exceeding either the Total Dollar amount or Percentage of Funds.
- Total number of periods: The number of weeks which elapsed between the chosen Start and End Dates.
- # of times above deviation threshold: The total number of times that the weekly benchmark fund rose above the Selected Deviation Threshold, thus triggering a Sell action.
- # of times below deviation threshold: The total number of times that the weekly benchmark fund dipped below the Selected Deviation Threshold, thus triggering a Buy action.
The Charting Section
There are two charts showing the Performance Comparison and Buy & Sell Transactions. The X axis of both charts shows the Week Number and the Y axis. The Y axis of the Performance Comparison charts shows the Fund Value over time, while the Y axis of the Transactions chart shows the Transaction Amount.