It’s time to stop treating your spy swing trading as a hobby, it’s time to get serious.
Understanding the exact odds of every trade you make is the only way to make consistent money swing trading stocks.
Therefore, I want to share three lines of code in a simple swing trading strategy that you can use to time the S&P 500 with amazing odds.
And the best part is you don’t even need a computer, but some basic counting is required.
Let’s get started!
The Trend Is Your Friend When Swing Trading SPY
I used to listen to TV personalities and internet gurus, but I never made any money.
Actually, I lost a lot.
How could so many “pro traders” be so wrong all the time?
I still remember the day, around 2006, when I threw up my hands in disgust over another “pro trader’s” opinion that lost me a ton of money.
I decided then and there that I was going to TEST any and all trading ideas I could get my eager hands on before I risked another dime of my hard-earned money.
Of all the ideas I tested, gleaned off internet forums and blowhards on TV, only one was true:
“The trend is your friend.”
The “trend” is which way a market is moving, and there are three directions, sideways, down, or up.
You only want to trade in the direction of the trend.
Sounds intuitive, but I’ve known plenty of traders that fight the trend trying to call tops bottoms.
They don’t make money, they just want to brag to their friends or resentful spouse about how they were “right”.
Betting against a market’s direction is the stupidest thing you can do with your money, besides heading to Vegas.
The simplest way to determine the trend is with a moving average.
The 200 and 100-day moving averages are standard for many swing traders, but we’re going to use a non-standard one to stay away from the herd.
Let’s use the SPY ETF (which tracks the S&P 500) to demonstrate the first line of code in this SPY swing trading strategy.
Looking at closing prices only, let’s ask the computer if SPY is above its 66-day moving average:
If close > average (close, 66)
If this expression is true, we want to look for swing trades in the long direction.
You only want to buy if the price is above the 66-day moving average (this also works on individual stocks and many commodities).
Now, let’s move on to the second part of our swing trading strategy, when exactly do you trade SPY?
Only Buy Dips in SPY in Uptrends
Once you establish that the market is moving higher, you want to buy dips.
You never want to short an up-trending market because you will get your head handed to you.
I don’t know why so many amateur traders love to short stocks.
Humans tend to overestimate their abilities and this is where I think a lot of that psychology comes from.
Check yourself if you are thinking “I’m smarter than the markets”.
Nope, you aren’t, and neither am I, that’s why we test our ideas first.
OK, so how do you tell a computer what a dip is?
You must use absolute quantifiable terms here; you can’t just say “the market should find support here.”
Also, you must keep your definition of a dip super simple.
You don’t want to over-optimize and run the risk of curve-fitting your SPY swing trading strategies.
So, let’s look at SPY and ask the computer a simple question, is today’s close the lowest in 3 days?
(You can play around with this number, but I’ve found 3 works well)
If close < lowest(close, 3)
If this expression is true you have yourself a “dip”.
You now have an uptrend established and a dip in the uptrend and it’s time to buy!
(This proves to be remarkably profitable as you will see in a minute)
The SPY Trading System Sell Signal
Do you know what the hardest part of trading really is?
It’s not knowing when to buy, it’s knowing when to sell.
You might intuitively already know that.
How many stocks have you held onto for too long?
Anecdotally, my brother once showed me his portfolio and it was full of losers!
I asked him what was going on, and he responded: “I just never know when to sell.”
This is why it is so important to have a trading system in place, especially when swing trading stocks.
Getting in is easy, getting out is hard.
So how do you know when to sell your position in SPY once you bought the dip?
You have to let the market mean-revert to the upside and then sell into that rally.
But what is a “rally” and how do you think like a computer to give it exact instructions?
Well, let’s use the inverse of how we defined a dip above.
Let’s ask the computer to tell us when SPY has made a close higher than the previous 19 days.
If close >= highest(close, 19)
If this expression is true, it’s time to sell SPY and most likely bank a nice profit.
Okay, let’s wrap these three simple ideas into a swing trading strategy for SPY.
Then let’s plug it into the computer and see what happens.
Computers don’t lie to your face like the suits on Wall Street or internet grifters selling doom and gloom and “technical analysis”.
Let’s recap what we’ve put together so far in visual form:
Simple SPY Swing Trading Strategy Flowchart:

It’s truly that simple, these trading strategy rules are about as basic as they come.
Let’s look at what this little SPY swing trading strategy actually did.

That’s a $25,000 account traded by those three rules, on a log scale so the early years are actually visible. Everything right of the dashed line is out-of-sample — the rules were fixed in 2016 and never touched again, so that stretch is the part that wasn’t fitted to anything.
This is the power of testing ideas before jumping headfirst into the stock market.
Put it on a SPY daily chart and the pattern is easy to read: a buy arrow every time price closes at a 3-day low while still above the 66-day average, and a sell arrow when it closes at a 19-day high. Buying the dip in an uptrend, selling into the bounce — over and over, with no opinion required.
I often get asked if this is the best SPY Options Trading Strategy.
I usually recommend people stay away from options unless they really know what they are doing.
There are too many variables for my liking, and also wow that leverage can absolutely kill your portfolio.
I like to keep it relaxed as you know, so I stick with stocks and ETFs.
Now the part that matters — the statistics.
Roughly four out of five of those trades closed green, across more than five hundred of them and thirty-plus years of data. But a win rate on its own is a half-truth, so I publish the drawdown next to it: the deepest peak-to-valley dip you’d have had to sit through, which is the number that actually decides whether you could have held on. The full table — return, profit factor, win rate, drawdown, trade count, average hold — is on the free strategy page, and it updates whenever I re-run the back-test, so it never drifts out of sync with this post.
One thing worth saying plainly, because most published back-tests don’t: this one is cash only. Position size is capped at 100% of the account, so it never buys on margin. Left uncapped, volatility-based sizing quietly implies leverage — and the calmer the market, the more of it. That flatters a back-test and it isn’t something you could run in a cash account or an IRA, so the demo doesn’t do it.
Can you believe such simple rules can time the stock market with those kinds of odds?
Next time you are about to trade, ask yourself if you truly know the odds of making or losing money.
Because if you don’t know the exact odds how do you even know how much money to risk?
So, I implore you to always test your ideas before you risk another dime.
Learning From This SPY Swing Trading Strategy
- Only trade in the direction of the trend, never against it!
- Buy dips in up-trends and sell into rallies
- A tested trading system tells you your exact odds before you risk a dime
This is a long only system, imagine what the profits would be if you added shorting to it; play around with it, see if you can make it even better!
Happy Trading!
Get The Code — Free
The exact 3-lines-of-code SPY strategy from this post — the annotated EasyLanguage source and a plain-English strategy guide — is a free download.
Get the code: Free SPY strategy download →
Educational only; not investment advice. RelaxedTrader is not a registered investment advisor. Back-tested and hypothetical results have inherent limitations; past performance is not indicative of future results.
