During business school, ironically, I found it quite confusing figuring out whats what when it came to finance, markets, and trading. The only thing they really pushed in finance was investment banking, and the "investment" club was super douchey and only focused on fundamental analysis. University really sucked when it came to teaching about the markets, so I started digging around and reading a lot, and these 5 books really helped me find my way! They are mostly interviews and stories, I hope it helps you as much as it did me! Enjoy! More Money Than God by Sebastian Mallaby The Quants by Scott Patterson Diary of a Hedge Fund Manager by Keith McCullough Reminiscences of a Stock Operator by Edwin Lefevre Market Wizards: Interviews with Top Traders by Jack D. Schwager
Alright, back at it again with another trading algorithm! I made this a category so it will be easier to find once there are more posts. Today we are testing buying after 3 down days! The algorithm is easy, we are buying after 3 consecutive down days when the close is above the 200 day moving average. Then we are selling "x" days later. We will optimize this to find the duration of which to hold the trade. IF close
I remember some time ago, I was reading an article on how a ridiculous percentage of the stock markets gains have come from the overnight session. This lead me to test the idea out in Trade Station, and it is one surprisingly easy and effective trading algorithm! Okay, so overnight session... what is that? It's simply in reference to when the stock market is closed. During this time you can trade the futures contracts (6pm EST to 9:30am EST is the overnight session) which is how the markets can gap up or down in the morning. I'll be testing this on SPY and UPRO and I'll add a simple trade filter to show how a small change can make all the difference. So the algorithm is quite simple... Buy at the close, Sell at the open. Details & Assumptions Does NOT factor in trade commission or slippage. Trades are filled exactly at the close and open prices. In reality, filling exactly the close price is harder than the open price due to timing the trade for 3:59:59pm EST. In my own experience, I routinely get filled at the open price when I set a market order while the market is closed (it's queued up for next time the market opens). SPY (S&P500 ETF): November 1994 to February 4th 2019 Overall Performance Statistics Total Net Profit: $216,363.55 Profit Factor: 1.19 Number of Trades: 6090 Win Rate: 54.88% Avg Trade Net Profit: $35.53 (+0.035%) Avg Winning Trade: $412.58 (+0.41%) Avg Losing Trade: -$434.57 (-0.43%) Ratio Avg Win to Avg Loss: 0.95 Largest Winner: $6,068.10 (+6.06%) Largest Loser: -$8,324.33 (-8.32%) Annual Performance Year % Result 2019 -0.32% (YTD as of Feb 4th) 2018 +12.23% 2017 +10.53% 2016 -3.96% 2015 +0.99% 2014 +8.39% 2013 +11.53% 2012 +4.23% 2011 +3.76% 2010 +6.59% 2009 +8.32% 2008 -20.13% 2007 +12.99% 2006 +7.73% 2005 +13.23% 2004 +4.54% 2003 +6.76% 2002 -10.95% 2001 -14.49% 2000 +22.57% 1999 +37.93% 1998 +27.75% 1997 +28.34% 1996 +17.12% 1995 +17.67% 1994 +3.03% As you can see this looks, a lot better than the actual S&P500 chart during the same time... What this goes to show is that in bull markets this works VERY well. I mean it's literally buying at the close and selling the next morning at the open. It really does not get much easier than that... In order to identify a bull market, I'll simply use the tried and true 200 day simple moving average. This is loved by many and is really deemed to be the universal Bull/Bear market indicator. For me, it's just a good indicator that when price is above, there is less volatility in long signals and when it is below there is significantly more volatility in long signals. 200 Day Simple Moving Average Filter The Algorithm If close>average(close,200) then BUY this bar at close; SELL next bar at open; Overall Performance Statistics Total Net Profit: $196,221.31 Profit Factor: 1.31 Number of Trades: 4485 Win Rate: 55.70% Avg Trade Net Profit: $43.75 (+0.043%) Avg Winning Trade: $330.84 (+0.33%) Avg Losing Trade: -$327.39 (-0.32%) Ratio Avg Win to Avg Loss: 1.01 Largest Winner: $4,090.45(+4.09%) Largest Loser: -$3,403.32 (-3.40%) Annual Performance Year % Result 2018 +4.94% 2017 +10.53% 2016 -2.52% 2015 -3.11% 2014 +9.35% 2013 +11.53% 2012 +1.35% 2011 -4.38% 2010 +2.81% 2009 +6.50% 2008 -0.55% 2007 -0.40% 2006 +3.66% 2005 +9.03% 2004 +6.16% 2003 +7.94% 2002 -0.58% 2000 +10.45% 1999 +35.40% 1998 +28.35% 1997 +28.34% 1996 +13.65% 1995 +16.75% 1994 +1.02% This is a waayyy smoother equity curve. The 200 day simple moving average filter really does well in reducing overall volatility. It also increased important stats like profit factor, win rate, and avg win to avg loss ratio. UPRO (3x long S&P500 ETF): June 2009 to February 4th 2019 Now these are pretty good returns for such a simple system... but they are really only meaningful if there is more capital behind it. So I am also testing this on the 3x leveraged S&P500 ETF, UPRO. I'll only be showing the results for the 200 day filter added in since that is the better algorithm. Overall Performance Statistics Total Net Profit: $143,608.51 Profit Factor: 1.19 Number of Trades: 1,791 Win Rate: 53.55% Avg Trade Net Profit: $80.18 (+0.08%) Avg Winning Trade: $943.93 (+0.94%) Avg Losing Trade: -$975.18 (-0.97%) Ratio Avg Win to Avg Loss: 0.97 Largest Winner: $12,225.00 (+4.09%) Largest Loser: -$10,336.80 (-3.40%) Annual Performance Year % Result 2018 +12.99% 2017 +35.41% 2016 -4.94% 2015 +2.79% 2014 +31.89% 2013 +41.53% 2012 +8.94% 2011 +4.32% 2010 +10.68% As this is on a shorter time frame, the curve does not look as smooth as SPY. However, it does produce some solid percentage returns. What's interesting is that 2011 and 2015 are positive vs SPY... I'm not exactly sure why that is. As you can see though, despite it being a 3x leveraged ETF, the returns are not necessarily 3x that of SPY which is part of the reason I am showing this. Summary Overall this is a good algorithm that produces really interesting results. From a long term execution standpoint, trying to get as close to the closing price will be crucial. Also depending on which broker you use, commissions will also play a factor. This would be a great candidate to live test using the Robinhood App!
Awesome, you made the decision that you're going to jump in and make MILLIONS from the stock market but not quite sure how to get there. In this article I'll outline how to get started in 3 easy steps! Step 1 Getting The Lay of The Land Step 2 Finding The Right Stock Broker Step 3 What Type of Analysis Should I Use? STEP 1 Getting The Lay of The Land First we have to understand a few things. This step is like the first episode of a new series on Netflix, it's kinda slow but it sets up the whole show. If you're familiar with all this then go ahead and skip to Step 2! What exactly is a stock? Easy - It's just a slice of the pie. An ownership stake in the company. If you own one share you are technically an owner. When Steve Jobs got the boot from Apple, he sold all but one share in the company. Where do I buy and sell stock? A place where the buying and selling of stocks happens is called a stock exchange. For example, the New York Stock Exchange! How do I buy and sell stock? You simply open a trading account at a stock broker (most likely at your bank) and you will be able to trade with just a click of the mouse! Basically they execute your trades on your behalf and you will pay them a commission to do so (more on this in step 2). The Two Types of Stocks Yes.. there are two types Common Stock Preferred Stock The main difference is that common stock has voting rights while preferred does not. To compensate for this, as the name suggests, preferred stock are first in line when it comes to dividends, and claim on assets should the company experience hardship or insolvency. When you log into your trading account and go to buy Apple shares, you'll be buying common stock. Don't worry common and preferred stock will have different symbols so you will know what you're trading. What is a stock index? A grouping of individual stocks. Generally, stocks are grouped into an index according to their market capitalization, regardless of their sector or industry. This gives an overall broad picture of how stocks are performing. For example, the S&P500 is made up of the 500 biggest companies (in the US) according to market capitalization. Some major stock indexes are: S&P 500, Dow Jones Industrial Average, Nasdaq, Russell 2000. Market Capitalization Definitions Large Cap: >$10 Billion Mid Cap: $2 Billion to $10 Billion Small Cap: $300 Million to $2 Billion Stock Market Categories This is how the stock market is organized from largest to smallest: Stock Index Sectors Industries Individual Companies There are 11 different sectors within the stock market: Energy Materials Industrial Consumer Discretionary Consumer Staples Health Care Financials Information Technology Telecommunication Utilities Real Estate Each of these sectors is made up of industries. For example, in the financial sector, there are different industries such as asset management, banking, insurance, etc. STEP 2 Finding The Right Stock Broker Obviously, in order to start trading you need a trading account. This is where you will hit that buy and sell button to make some money! There are so many stock brokers to choose from and nowadays, they all more or less offer the same thing. There are two parts to this equation: Commissions Services offered The services stock brokers offer are mainly the trading platform and customer support. Generally, the lower the commissions the less comprehensive the trading platform. Commissions 1. Flat Rate This is a simple flat fee no matter how many shares you buy or sell. This is fantastic for large account sizes as commission will virtually have no affect on overall performance. Conversely, for smaller accounts this is detrimental. For Example: Say commission is $10. That means to buy and to sell, you'll pay $20. For an account size of $50,000 that is 0.04% For an account size of $5,000 that is 0.4% This means that commissions will eat almost half your profits if you make 1% on a trade in a small account. 2. Per-Share Rate This is a far better solution for smaller account sizes and you only pay for what you trade. 3. No Commissions This is a relatively new addition to the world of stock brokerage. This is where you literally do not pay any trade commission at all. The downside to this is that accounts like this are only really good for swing trading and investing. Day trading becomes very, very difficult due to order execution. This is because in order to make money they will sell your order flow to high frequency trading firms. Services Offered This is the second half of the broker equation. Like I mentioned above, lower commissions results in a basic bare bones platform that is strictly for execution. When you are paying average commissions ($5 to $10 per trade) then you can evaluate other factors like the ones listed below. 1. Trading Platform How comprehensive is their desktop platform for charting as well as providing fundamental information about companies? Do they have an app to execute trades from your phone? 2. Instruments Not the musical kind, but the financial kind. This will be if you want to trade instruments other than stocks, like currency, bonds, options, or futures. 3. Customer Service If you have a question or something goes wrong, how easy is it to get someone on the phone or online chat? Brokers To Check Out This is not a paid promotion or anything like that, this is just from personal research, what I use, and good things I've heard about other broker's from fellow trading friends. TD Ameritrade - Think or Swim Trade Station Interactive Brokers E-Signal * *E-Signal is more of a charting platform, but it can link into a trading account so it becomes the interface to execute trades. The charting platform is the best I have ever used. STEP 3 What Type of Analysis Should I Use? There are two sides to learning about trading. Its learning about the markets first, and then its about how to trade the markets. The information in steps 1 and 2 help you learn about the market but don't help you figure out how exactly to make money... This is what step 3 is all about! Here I will give you can overview of the three main types of analysis used to dictate 99% of investment decisions across all markets: Fundamental Analysis Technical Analysis Quantitative Analysis Now there are obviously pros and cons with each, however, the only thing that matters at the end of the day is making money. The goal is to find a type of analysis that fits your personality so you become a consistent level-headed trader that makes money no matter the market environment. So if it's just sticking to one type of analysis or using a combination of all three, find what is right for you! 1. Fundamental Analysis Fundamental Analysis seeks to find the "intrinsic value" of a company's stock. What this means, is that through analyzing financial statements and figuring out key ratios, you will determine whether or not the market is over or undervaluing a particular company. There is no set recipe for what to include or ignore when coming up with an intrinsic value, and the number that is calculated is only there to compare against the actual share price. The idea is that if share price is below "intrinsic" value then you buy it and if it is above then you sell. Fundamental Analysis uses financial statements and ratios to in part determine the intrinsic value. Financial Statements Income Statement: The most important to look at as it shows the revenue, expenses, and profit (or losses) generated. Balance Sheet: This will show the assets, liabilities, and equity of the company. Cash Flow Statement: This will show the inflow and outflow of cash during the quarter. Retained Earnings: This is the least looked, it will show you the changes in equity during the quarter. It can include stock buybacks, dividend payments, or changes caused by the reported profits or losses. Financial Ratios The number crunching mentioned above revolves around finding key ratios from those statements. There are a few different categories that will assess how healthy and how well the company is being run. Price Ratios These show how the stock price is doing relative to the rest of the industry or sector. Price to Earnings PEG Ratio Price to Sales Price to Book Dividend Yield Dividend Payout Ratio Profitability Ratios These will tell you how good a company is converting its business activities into profit. Return on Assets (ROA) Return on Equity (ROE) Profit Margin Liquidity Ratios These show how capable a company is in meeting their short term debt obligations. Current Ratio Quick Ratio Debt Ratios These show how capable a company is in meeting their long term debt obligations. Debt to Equity Interest Coverage Ratio Efficiency Ratios These show how efficient a business is using its assets. Asset Turnover Ratio Inventory Turnover Ratio 2. Technical Analysis Technical analysis is mainly about anticipating what is likely to happen in the future based on past price movements. It operates on the belief that prices are not random, and that the market is not efficient in reflecting all available information in the share price. Technical analysis is made up of two components: Chart Patterns Indicators Chart Patterns There are quite a few patterns and usually the simpler they are the more effective. Most patterns have both bullish and bearish sides to them. Common Patterns Flag patterns Head and Shoulders Channels Ascending and Descending Triangles Pennants Double Tops/Bottoms Triple Tops/Bottoms Trend Lines How you identify the patterns above is by drawing lines on the chart, literally. There are various charting and data providers that have platforms to do this. But in the old days, people literally held up a ruler to the screen or they just printed out the chart and then drew the lines. Trend lines are created by connecting two points on a chart; they are usually lows or highs. When you connect the lows on a chart it will help identify an uptrend and connecting the highs will help identify a downtrend. Below is an example of downward and upward trend line on the Apple weekly chart. Indicators Technical indicators attempt to quantify price action into actionable information. For example, there are indicators that measure the strength of a trend, how much momentum a stock has, or even how oversold or overbought a stock is. Popular Technical Indicators: Moving Averages Relative Strength Index (RSI) MACD Bollinger Bands Average Directional Index (ADX) Stochastic Oscillators Below is the Apple Daily Chart with a 50 day moving average, the MACD, and the RSI applied to it. As you can see, these offer useful information to help make profitable trading decisions! 3. Quantitative Analysis Quantitative analysis is about taking a scientific approach to the markets. No emotion, just data analysis to find consistent patterns and relationships that will make money. In order to see how useful a trading idea is, you back test it against historical data to see how it has performed in the past. Now of course, nothing is 100% certain and past performance is not indicative of future results. The goal is to create a step-by-step process (an algorithm) of how to trade consistently and effectively. It can be a powerful tool when used as an overlay or in combination with one or both of the other analysis techniques discussed. There are a few main questions that need to be answered in order to determine the potential validity of a trading idea... Does it even make money? How well does it make money? What is the win rate? What is the average win to average loss ratio? What is the profit factor? What does the draw down distribution look like? This will help identify potential changes you would want to make. Maybe it's adding a filter to the entry point to try and bump up the win rate, or just completely changing the exit point to see if the algorithm becomes profitable. Summary Now you have a bit more guidance to be able to make your own way in the markets! It's not easy and it takes time, but it is one of the most rewarding things in life. Comment down below any questions, comments, or if I missed anything. If you enjoyed this article, please share the link with friends and family!