3 Lines Of Code To Time The Stock Market With 76% Accuracy

How many times have you bought a stock or ETF with no idea if it was going to be profitable?

All of them? - If so, you need swing trading systems!

Do you treat trading as a hobby and simply haven’t invested the time and money to figure the game out?  Do you want to get fleeced just as easily as it is to take candy from a baby? - NO!

It's a sad fact that 95% of short-term traders lose all their money; like a casino, fools and their money are quickly separated.

Today I'm going to give you 3 easy to understand lines of code you can use TODAY to time the stock market correctly 76% of the time - and you don't even need a computer (some basic counting required).



Code Line 1: The Trend Is Your Friend

Most traders quit, broke and frustrated; don’t leave trading to the pros just yet.  

You haven’t traded the market like this before or you wouldn’t be reading this.

I'm shocked to say this, but this is one of the only phrases I've EVER HEARD come out of the talking heads on financial TV that's actually true:

"The trend is your friend."

i.e., don't be a dummy and short stocks in a bull market!  

I know plenty of people that try, and trust me, they don't make money, they just want to brag to their friends or resentful spouse about how they "called the top."

Just don't do it, it's not worth your time.

With that said, let's restate the obvious:

Only buy in bull markets.  Only short in bear markets.

What's a bull market?  

Glad you asked, because I've tested this using a computer (not my CNBC rent-a-crystal-ball).

Using the ETF "SPY" to trade the S&P 500, you want to look at closing prices only and ask yourself the following questions:

Is SPY's close today >= average(close, 200)?

This is where we need a little bit of counting...you can do this with an excel spreadsheet or pull up a free charting tool like stockcharts.com

You only want to buy if today's closing price of SPY is ABOVE the 200-day moving average (this also works on any stock, index or commodity).

The 200-day moving average is an extremely standard measure of if something is in a bull or bear market (maybe too standard, but that's a discussion for another time). 

Code Line 2: Buy SPY On The Dip

What's a dip?

A dip is a bull back in price also known as "Man, the market fell again today!"

This is about the point where you'll hear people that normally don't talk about stocks start to talk about how much the stock market dropped.

You know those people, work folks around the coffee machine, your drinking buddy, maybe your Mom.

How do you tell a computer what a dip really is?

You have to use absolute quantifiable terms here, you can't just say "oh the market should find support here."

You also want to keep your definition of a dip super simple, you don't want to over optimize or you run the risk of curve fitting your swing trading systems.

 Is SPY's close today <= lowest(close, 10)?

Here, you count again.

Is the close of SPY today the lowest close in the past 10 days?

If so then buy SPY!

You have an uptrend established, and now a dip in the uptrend.

This proves to be remarkably profitable as you will see in a minute.

Code Line 3: Sell SPY Into A Rally

You bought shares of SPY, now do you know when to sell them?

You have to wait for a rally.

How do you tell a computer what a rally is?

Let's use another extremely simple line of code that looks for the highest close in the last 5 days.

Is SPY's close  today >= highest(close, 5)?

If today's closing price of SPY is the highest in the last 5 days SELL!

If so then sell SPY!

Here's an easy to follow flow-chart of the logic:

easy swing trading flow chart

It's truly that simple!

Remember, these swing trading systems rules are about as basic as they come.

Now, let's look at how unbelievable powerful simple systems like this are over time

Spy Swing Trading 5-Day Low System

Spy Swing Trading 10-Day Low System

Incredible isn't it? 

Each of the green dots above signals a new equity high for this trading model.

Around trade 143 is where I first wrote this system in 2012.

One hint that I can give you is that you want to see your "out-of-sample" data look the same or better than with the data you used to create the model with.

In this case, you can clearly see that the real-time performance (i.e. out of sample) data is much better than the in-sample.

Let's look at the statistics now.

easy sp500 swing trading stats

Can you believe that such a simple set of rules can time the stock market with 76% winning odds!?

You need swing trading systems!

Next time you take a stab at your trading, ask yourself if you truly know, using a computer, what the odds of making or losing your hard-earned money are.

I mean, come on, if you don't know the exact odds how do you even know how much money to risk!

And this is NOT rocket science. 

Anyone, I repeat, ANYONE can do this.

(Even your financial adviser whom I guarantee has no idea what they are talking about.)

So I implore you to take control and start testing your ideas before you risk another penny!

It's not that hard, and if you are like me, you'll start to enjoy it immensely.

Your account will too 😉

Conclusion: With Swing Trading Systems Simple Rules Work!

  • Simple rules work remarkably well especially for swing trading systems
  • Buying dips in up-trending markets using moving averages and highest and lowest closes can be done with a 76% accuracy rate
  • Here's the code if you are interested >> SPY Swing Trading System 10-day low

About the Author

Hello! I'm Kurt the "Relaxed Trader" writing the stuff on this website. Feel free to ask me questions. I love talking to fellow traders that want to use computers to beat the stock market. Shoot me an email: Kurt@relaxedtrader.com