Backtesting Popular Strategies from Youtube #2

5–8–13 EMA + Parabolic SAR “SCALPING” Strategy

Radoslav Haralampiev MSc
Quant Factory
6 min readOct 18, 2022

--

Hello guys, and welcome to another backtesting of a popular strategy on Youtube.

Nowadays there are thousands of videos and articles with that are trying to convince you that a strategy someone found or came up with is sure winner. Unfortunately most of them are probably crap. People combine technical indicators without much of a thought and make them unnecessarily complex so that person that is presenting it looks like a pro. Most of them are based on price action indicators like RSI, Stochastic, MACD, CCI etc. and combined in any possible way.

Things like, the 47 EMA to cross over the 88 EMA and at the same time the MACD line to cross the Signal line while the RSI is below 45. That’s obviously nonsense, overfitted strategy which aims to show you 3 hand-picked situations that are winning and then declare that the strategy is phenomenal.

But my readers are no fools!

That’s why I am set on a mission to explore the more popular strategies presented over Youtube and run them through my Python backtester. That way we can check out and see the real performance.

What’s more using Python for our backtesting gives us a lot of leverage because we have access to more historical data, a better execution engine and comprehensive statistics about the performance.

⚠️📈💲You can check my FREE newsletter in the link below! 💲📈⚠️

How do I choose which strategies to test?

When I am screening through the videos the main thing I am looking for is them to have a specific set of rules that can be put in to an algorithm. Many of the strategies are discretionary and impossible to automate.

So the most important thing we look for is specific conditions that have to be true for the current bar that signal us to enter a trade. Things like support/resistance zones or some kind of retracements or the price came close to the line and then bounced back are of no interest to us because everyone has its own vision as of what those can mean or where are those zones placed that’s why we won’t be using those.

What strategy are we going to test today?

Today I have picked a strategy presented from Trader DNA on YouTube. You can find the video of the strategy here.
We will use the 5–8–13 EMA in combination with the Parabolic SAR
The rules are the following:

  • Long: the 5 period ema to cross over the 8 and 13 period emas and the 8 period ema to cross over the 13 one. At the same time we want the Parabolic SAR to be bullish and below the candle
  • Short: for the short we look for the opposite set-up. The 5 period to cross below the 8 and the 13 ema and the 8 period ema to cross below the 13 one. The Parabolic SAR should be above the the bar.

As those crossings would rarely happen at the same time I will give the 5-period ema a buffer of 2 candles to cross. If you take a closer look that’s how it is in the video as well. First the 5-ema cross the 13 line and on the next candle the 8-ema cross the 13-ema line as well.

Let’s get to work!

We begin with downloading and preparing our data. This is a crucial part of the backtesting because if it is not prepared and cleaned it will mess up everything and our results won’t be reliable.

We download 1H data for BTC/USD for one year from the FTX Exchange and then prepare all the conditions with pandas_ta package.
At the end of the day our DataFrame should look like this.

Final DataFrame with all the indicators calculated

Great!

Now that we have all the indicators prepared we have to define our entry conditions. As I mentioned above for the 5-ema we will say that we want it to have crossed the 13-ema on the current or the previous candle and the 8-ema to have crossed the 13-ema on the current candle. Also we want the PSAR to be either bullish or bearish i.e above or below the price.

This is not the Python code but a mere example of the logic:

For Long:(FAST_EMA[0] > SLOW_EMA[0] OR FAST_EMA[-1] > SLOW EMA[-1])) AND
(FAST_EMA[-2] < SLOW_EMA[-2]) AND (MEDIUM_EMA[0] > SLOW_EMA[0]) AND (MEDIUM_EMA[-1] < SLOW_EMA[-1]) AND (PSAR[0] < CLOSE[0])
For Short:(FAST_EMA[0] <SLOW_EMA[0] OR FAST_EMA[-1] < SLOW EMA[-1])) AND
(FAST_EMA[-2] > SLOW_EMA[-2]) AND (MEDIUM_EMA[0] < SLOW_EMA[0]) AND (MEDIUM_EMA[-1] > SLOW_EMA[-1]) AND (PSAR[0] > CLOSE[0])

*legend: 0 means current bar, -1 means the previous bar etc.

First, we will try the exit logic presented in the video. For long we use the recent swing low as a Stop Loss and then we place our Take Profit at 3 times the risk, vice versa for short.

Results

The strategy actually ended on the positive side banking 32% cumulative return, however with pretty low Sharpe Ratio of only 0.69 and a Max Drawdown of -26% which is quite a lot.

You can check the below video of my partner who is coding way more interesting strategies than that and backtesting them in front of you!
Check the link below :)

Conclusion

After conducting a thorough testing it we can conclude that the strategy that the Trader DNA channel is presenting might have some potential. However I would strongly suggest you always do your own due diligence and testing before putting it to use.

What do you think about the strategy?

I would love to hear your thoughts in the comment section below.

Also if you have any strategy in mind that you want me to test, do please share it and I will write an article covering it.

That’s all from me for this one, if you like such or similar content feel free to subscribe to Quant Factory publication where we post many interesting articles from the world of Algorithmic trading and Quantitative Analysis all conducted with Python.

Cheers and see you in the next one!

A Message from QuantFactory:

Thank you for being part of our community! Before you go:

  • Master Quantitative Research with Python👉 here.
  • Join our Premium Discord Server👉 here.
  • Subscribe to our Exclusive Stocks Newsletter 👉 here.
  • If you liked the story feel free to clap 👏 and follow the author
  • For more stories from the Algorithmic Trading and Quantitative Analysis world you should follow the Quant Factory Publication

*Note that this article does not provide personal investment advice and I am not a qualified licensed investment advisor. All information found here is for entertainment or educational purposes only and should not be construed as personal investment advice.

--

--

Radoslav Haralampiev MSc
Quant Factory

Top writer in Investing, Finance, Data Science | Co-founder of Quant Factory