Home Creators Posts Import Register Favorites Logout
haven't archived this post yet. have a subscription? use the importer!

Downloads

  • 2024.06.Simple_SMA_strategy_spot.7z
  • 2024.06.Simple_SMA_strategy_futures.7z

Missing 2 files, as this post has not yet been imported.

Content


Simple is better !?

In this  post I will go back to basic and will show you the results of  tests where I only use the Simple Moving Average. The results of these  tests can be also used as information for your manual trading strategy. I  will show you the best three SMA lenghts and timeframes, some  remarkable findings over all these tests and some suggestions to improve  this strategy. So let's get right to it!

Intro

This blog post is also made in  response after receiving questions from the audience that also want to  see trading strategies that can be done manually. And can also check the  results by themselve.

In my latest posts I presented the results of some highly  sophisicated trading algorithms and their sometimes questionable  results. And although they, hypothetically, can provide you with very  high gains, they also include a risk factor where you cannot tell what  is happening within the code. Therefore relying on the coders expertise  and the results of backtests and forward tests before using the algo  with real trading.

So, this time I thought it was time to do a step back and test out  the most simple way of trading crypto, stocks, options and other assets,  where you use only one indicator. In this case the Simple Moving  Average.

The strategy

The trading strategy is as simple as can be. I also added some minor  variations so find out which of them has the highest probability of  future profits but still all versions can also be used with manual  trading. So if you do not have a trading bot or some other automatic buy  or sell mechanism, the strategy and the results I got could also be  interesting for you so see.

So watch until the end for all the information.

In this test I will use my hopefully already well known set up and will do spot and long trading on multiple timeframes.

As for the trading strategies here I will only use the following rules:

Spot trading

Trade entry

For spot trading where only long trades will be made there are two strategies I will test:

  1. The first trading strategy does long buys when the closeprice crosses above the simple moving average.

  1. And the second variant does long buys as long as the closeprice is above the simple moving average.

So in the first case there is only one buying opportunity and that is  exactly at the crossover moment and no candle before or after. In the  second case there can be a long buy as long as the close price is above  the SMA. But in both cases there is no buy long trade when the close  price is below the SMA.

Trade exit

  • The trade exit will be if there is 100% profits reached or
  • if the close price gets below the SMA
  • There is no stop loss set. The trade will be stopped when either of these two conditions are met.

Futures trading

I will also do a futures test where both long and short trades are made.

Here the rules are also simple. In this case I trade both ways:

  1. The first trading strategy does long buys at the crossover above the SMA and short sells at the crossover below the SMA.

  1. The second version will buy longs as long as the price is above the SMA or sell short as long as the price is below the SMA.

Trade exit

  • The long trade will be exited when the price goes below the SMA
  • the short trade will be exited when the price goes above the SMA or
  • in both cases where there is 100% reached with the ROI setting.

Again, the small distiction between crossed above and is above is the  moment and period where a trade can be. With crossed it is only at the  decection of that crossing moment where close is above or below the SMA  where the trade is made. And with the "is above" system trades can be  made as long as the price is above or below the SMA.

For example: If you only allow 5 trades at the same time and all 5  slots are occupied. And if one trade can be closed for some reason. Then  as long as the closeprice for another asset is above its SMA, the rule  is valid to enter a trade for that asset. With the crossed above rule  this would not be the case and you have now an unused trading slot for  as long as there is no crossover or down.

Simple moving average lengths

I will also test the most used SMA lengths according to the Investopedia website, which are the:

  • 5 period
  • 10 period
  • 20 period
  • 50 period
  • 100 period
  • 200 period

... moving average

And will not use the Fibonacci sequence in this case.

So let be start and test these different trading strategy setups and I  will come back and present the results I got with the automated  backtests.

Shameless commercial here!

Closeprice crossed above SMA (SPOT / Long trades only)

SMA 5

(crossedabove_sma5_s.py)

SMA 10

(crossedabove_sma10_s.py)

SMA 20

(crossedabove_sma20_s.py)

1

SMA 50

(crossedabove_sma50_s.py)

SMA 100

(crossedabove_sma100_s.py)

SMA 200

(crossedabove_sma200_s.py)

Closeprice is above SMA (SPOT / Long trades only)

SMA 5

(isabove_sma5_s.py)

SMA 10

(isabove_sma10_s.py)

SMA 20

(isabove_sma20_s.py)

SMA 50

(isabove_sma50_s.py)

SMA 100

(isabove_sma100_s.py)

SMA 200

(isabove_sma200_s.py)

Closeprice crossed above/below SMA (FUTURES / Long & Short trades)

SMA 5

(crossedabove_sma5_f.py)

SMA 10

(crossedabove_sma10_f.py)

SMA 20

(crossedabove_sma20_f.py)

SMA 50

(crossedabove_sma50_f.py)

SMA 100

(crossedabove_sma100_f.py)

SMA 200

(crossedabove_sma200_f.py)

Closeprice is above/below SMA (FUTURES / Long & Short trades)

SMA 5

(isabove_sma5_f.py)

SMA 10

(isabove_sma10_f.py)

SMA 20

(isabove_sma20_f.py)

SMA 50

(isabove_sma50_f.py)

SMA 100

(isabove_sma100_f.py)

SMA 200

(isabove_sma200_f.py)

Putting it all together

So after  running my computer for days and days to do backtesting only the  different SMA strategies on different timeframes and with spot and  futures trading, I can now tell you which of these has the best results.

isabove_sma20_f  - 4 hour

Let's start with the SMA version that has the third best results over the backtests.

And that is the SMA20 on the four hour timeframe where long trades  are made as long as the close price is above the SMA and where short  trades are made as long as the close price is below the SMA.

Over the full backtest range this SMA setting does provide you enough trades that can be quite profitable over time.

THe profit curve also is build up quite nicely over my backtest settings.

However you should be aware that this trading strategy has only  slightly less than 30 percent win rate. In my automated backtest I had  some long losing streaks which can put your patience and faith to the  test.

You also have to rely on the big winners that provide you with the best gains and settle for lots of small losses over time.

However the maximum drawdown is only 24%, with an average of 8.7  percent. And that is above average for a swing trading strategy.

The Calmar, Sortino and Sharpe ratio's also approve this strategy with pretty high scores.

But you have to be aware that not all crypto pairs respond well to  this setting so you have to experiment and find out which pairs have the  highest probability for winning trades with these settings

All in all a good start for such a simple trading strategy.

isabove_sma200_f - 4 hour

The next best scoring trading SMA setting is the SMA 200 on the 4 hour timeframe with futures trading.

And its endresult in theoretical backtesting profits is a big step-up in comparison with the SMA 20 version.

However the build up of this amount looks very jagged so your psyche  will be taken to the test here with these big profitable swings up and  large swings back down again. However the overall curve ends up positive  and so it takes the second spot in these tests.

Thats not strange ofcourse, since the win rate is only 20 percent,  with a maximum win streak of 13 in my test. So 80 percent of your manual  trades are losing and it might well be that you will have over 40  losing trades after another as seen in my test result.

Again this will be a game of patience and have the steel nerves to let your winning trades run when you have them.

But a positive thing here is that the drawdown in this case is also  lower than the average swing trading strategy. In my experience these  can have around 40 percent drawdown at max.

The average drawdown is around 10 percent but the main thing that  this chart shows that drawdowns of 20 percent are the most common here.

The weekly profit/loss chart shows the average profits you have per  week. And as you can see, this average profit line is mostly above the 0  line, which indicates positive trading weeks in this hypothetical case.  With some outliers to the top and the bottom.

Calmar and Sortino are quite positive about this strategy setting but the Sharpe lags behind. Still positive but much lower.

And also in this case you should try to pick the pairs that respond  the best to this strategy, since only 38 percent of the 50 pairs I use  respond well to this strategy.

All in all, this strategy looks to be the easiest version to do  manual trading with. In my backtest it did almost 1500 trades, but you  still have to remember that is over 5 years of data and over 50 crypto  pairs.

You can do the math on how much trades you do on average per pair.

Is (1500/50)/5 = 6 trades per pair on average

Some findings and remarks about these tests

After doing 144 backtests (24 strategies * 6 timeframes) I could not help but notice the following things:

Only high timeframes

First of all,  all the winning timeframes for all these SMA lenghts, spot and futures  testing were either the 4 hour or 1 day timeframe. With one exception,  that had the 1 hour timeframe as the best performing timeframe. So  apparently trading with the SMA as a baseline for making trading  decisions should be better done on these higher timeframes.

Futures strategies perform better than spot only

In  this specific test the futures oriented strategies tend to perform  better than the spot only strategies. On the one hand this sounds  logical since you trade both sides of the moving average. But my  experience up until now is that that this is not always the case. I have  experienced many times that spot strategies acually performed better.  Probably because downward movements can be quite violent and entering a  short trade could already be too late in these cases.

Low win percentage

Also, over all  tests, the highest win percentate was only 36 percent. Most of the times  the winrates were between 20 and 30 percent. So trading only on the SMA  and the way my testes strategies worked is not advices for the faint of  heart.

It would be better if you started out with the SMA as a baseline  indicator and then slowly build up your strategy with additional  indicators or trading rules. This way you have a possibility to filter  out the losing trades.

Like for example: filtering out whipsaws around the SMA, where the  close price is above or below an almost horizontal SMA for days.

In this case you could, for example use manual stop loss and take profit points with a specific risk to reward ratio.

Price profile of the pairs that fit this strategy

On  some rare occasions, 60 percent of the pairs that I use for backtesting  responded well to this strategy. On average only 35 to 40 percent  profit from this trading strategy. So of 50 pairs that is only around 20  that have a price profile that fits this trading strategy.

For example: the Binance USDT pair shown here has a price profile  that has lots of upward and downward movements around the 200 SMA. It  will probably make lots of trades around this average that could  probably end up with lots of losses since there is no strong upward  movement here.

Whereas Bitcoin has a price profile that seems to fit the SMA 200  more. With long price movements and not much zigzagging around this  moving average.

High SMA lengths on low timeframes equals low SMA on high timeframes

Another  thing that I'd like to mention before anyone else does is the fact that  high SMA lengths on lower timeframes can be compared with lower SMA  lengths on higher timeframes.

For example: On this 4 hour chart I have the SMA 50 on the 4 hour  open and I have the SMA 200 on the 1 hour open. Since 4 * 50 is 200. And  these lines are almost identical.

You probably now think that the backtest results of these 2 SMA  lengths on their different timeframe are now also almost identical. But  you would be mistaken, since trading on lower timeframes can lead to  many more signals and thus can lead to more losses since these winrates  are so low. That's also the reason why there are mostly high timeframes  that have the better results.

Making use of confirmation indicators

One  final thing I have to say here is that the use of only the Simple  moving average for trading success is not guaranteed as you can see.  However building on this knowledge is advised and the use of  confirmation indicators like the RSI, MACD, Stochastics or other  momentum indicators can filter out bad trades better. Which makes  trading successes more probable.

So as the old saying goes: "It all depends" on how to apply the SMA  200 to your trading strategy to make it a successful one. These are just  some remarks and tips I want to share here.

Now let's continue with the number one SMA length that got me the best theoretical backtest results...

The winner: isabove_sma100_f - 4 hour

And  the current Simple Moving Average length that proved to have the best  theoretical results is the SMA 100 on the 4 hour timeframe where you  trade longs as long as the close price is above the SMA or trade shorts  as long as the close price is below the SMA.

This lenght on this timeframe seems to be the best middleground between the SMA 100 and SMA 20 on the 4 hour chart.

However, the same remarks the second and third position has, apply to this SMA lenght and timeframe as well.

A low win rate where only 22 percent of the trades are winners. But  letting these winners run provided one the highest gains of all tests.

The profit curve has a nice 45 degree upward angle and does not seem to show heavy drawdown moments, like the SMA 200 did.

You might experience many drawdown moments that reach around 15  percent, up to max 17.5 percent. But the average drawdown is still less  than 8 percent.

The average profit and loss over the backtest period is positive most  of the time. There are more weeks with good gains of sometimes over  2000 dollar. And negative weeks over 2000 dollar were not as many. And  that was clearly visible in the profit curve.

The default plot of the backtesting engine also shows that, if you  would use this strategy with a trading bot, the bot would use all  the  available slots to trade with. As you can see in the paralellism plot  section here:

Strategy League

Now I can compare this  profit curve with the other results in the Strategy league. But as you  can see, comparing this final result with the hypothetical profits of  the other strategies does not add more information then we already have.

Comparing the scoring factors however show that starting a trading  strategy with the SMA as its fundament already gives you a headstart on  some of the better performing algorithms.

For example, it already has a pretty low drawdown. A high Sortino ratio and a high profit factor.

It is the factors where this trading strategy is weak that should get  the most attention if you want to improve on this. Like the low win  rate and the pairs selection.

But still, with all its pro's and cons, this very simple to do SMA  strategy still managed to get a place in the top 10 of the strategy  league. The 8th spot to be exact.

Thanks and endings

For now I think it is enough information. Thepost is already long enough as it is.

I hope you liked the excersise and analysis in this post and learned something from it.

Please remember that all results are just hypothetical and based on backtest information. Future results are not guaranteed.

Thank you for watching this reading this post until the very end and I will see you in the next one!

Goodbye!!