Tuesday, June 11, 2013

Modifications, Updates, and New Data

Updates to our back testing platform brought in a whole new set of data -- visual data. To reiterate, our signals are:

Strategy 

Buy:
- Price above 200 day MA, and
- Price above the 50 day MA, and
- Price sets a new 10 day low
Sell:
- Price drops below the 50 day MA, or
- Price sets a new 10 day high, or
- Position has been open for 10 days
In order to check if our signals provide an edge we compared it to a random strategy.  We will be calling this our 'base case' and the signals are:

Base Case

Buy: 
- None
Sell:
- Random day in the next 1 to 10 days
We've also created a portfolio function that allows us to account for our initial investment, commissions, and slippage; it will also avoid fractional ownership.  Our portfolio parameters are:


Portfolio

- 5,000 initial investment
- 3.95 comission
- Random slippage of [-.5%, .5%] of the target price
We conducted 10,000 scenarios with each being a possible sequence of trades over the duration of our analysis. Here is our data:

Chart Legend

- Gray: end of trade portfolio values for all 10,000 scenarios
- Blue: middle 25% of gray values
- Red: the return of buying and holding SPY

2007




Stratgey

Basis
Ave. Return
44%
Ave. Retrun
1%
Stdev.
30%
Stdev.
24%
Max. Return
207%
Max. Return
196%
Min. Return
-40%
Min. Return
-74%
Scenario Returns > 0
95%
Scenario Returns > 0
48%

2008



Stratgey
Basis
Ave. Return
35%
Ave. Retrun
-34%
Stdev.
24%
Stdev.
32%
Max. Return
160%
Max. Return
173%
Min. Return
-23%
Min. Return
-96%
Scenario Returns > 0
95%
Scenario Returns > 0
12%

2009



Stratgey
Basis
Ave. Return
87%
Ave. Retrun
30%
Stdev.
40%
Stdev.
57%
Max. Return
328%
Max. Return
627%
Min. Return
-21%
Min. Return
-92%
Scenario Returns > 0
99%
Scenario Returns > 0
68%

2010



Stratgey
Basis
Ave. Return
44%
Ave. Return
10%
Stdev.
25%
Stdev.
26%
Max. Return
168%
Max. Return
154%
Min. Return
-276
Min. Return
-39%
Scenario Returns > 0
98%
Scenario Returns > 0
61%

2011



Stratgey
Basis
Ave. Return
6%
Ave. Retrun
-7%
Stdev.
16%
Stdev.
23%
Max. Return
78%
Max. Return
142%
Min. Return
-37%
Min. Return
-75%
Scenario Returns > 0
63%
Scenario Returns > 0
33%

2012



Stratgey
Basis
Ave. Return
27%
Ave. Retrun
6%
Stdev.
21%
Stdev.
24%
Max. Return
137%
Max. Return
193%
Min. Return
-27%
Min. Return
-69%
Scenario Returns > 0
91%
Scenario Returns > 0
56%

Code:


Language: Python 2.7
Third party packages: NumPy, matplotlib

FileSnack zip folder: http://snk.to/f-c7k56nnx
GitHub main program: https://gist.github.com/theBrokeQuant/5746064

The FileSnack link has everything we'll need to run our program; it's a zipped folder that contains:
  • theBullsSupplier.py
  • poorBoysData.py
  • SP500.txt
  • Empty folder 'Tickers"
If we have all the prerequisites then we can simply copy and paste the GitHub code to a new python file.   

2 comments:

  1. I'm interested in working with your code and project. I really appreciate the work you've done so far. I've begun work here (https://github.com/chas11man/theBrokeQuant). I want to make sure that you get proper credit and that I have your permission to work with your code. I looked at your github page but I could only find the code on your gist page. I added links to both this blog and your gist page in the readme, but I want to ensure that you are happy with the credit. Please let me know what I can do to ensure proper credit and permission. Thanks for the work you've done. Currently I'm running into an index out of bound error but I'd love to work with you on developing the code. I'm going to be working on it myself, but if you're interested in any sort of collaboration I'd be more than happy to work with you.

    ReplyDelete
  2. What are the best casinos to play in 2021?
    Which casinos offer slots? ford fusion titanium — Casino Sites. Best casino sites are those https://vannienailor4166blog.blogspot.com/ that allow players to try a game septcasino from anywhere. The most common casinosites.one online slots 바카라 사이트

    ReplyDelete