The ‘Reinforced Smooth Scalp’ strategy. Is it profitable or not?

The ‘Reinforced Smooth Scalp’ strategy. Is it profitable or not?

By DutchCryptoDad | DutchCryptoDad | 22 Apr 2022


Intro

In this blog series I will be searching for the best trading strategy for cryptocurrency trading with a trading bot. These posts are complementary to the video's I make on Youtube, which you can watch below.

The trading bot I use is the Freqtrade (https://www.freqtrade.io/en/latest/) trading bot which not only has good options for bot trading, but also is excellent in backtesting and optimization of trading parameters. Therefore I will use this program to not only trade automatically, but also look for the best strategies and setups.

The strategy I investigate in this post is freely available in the Freqtrade github repository on the following location: https://github.com/freqtrade/freqtrade-strategies/tree/master/user_data/strategies/berlinguyinca
All credits go to the original author of this code.

The backtesting setup

If you want to know more on how I do these backtests like: which pairs I use, which timeframes and which periods I test, then see this blog post to know more about the approach I use: https://www.publish0x.com/dutchcryptodad/is-it-profitable-or-not-the-setup-and-approach-xppgjoj

Strategy

In this post I will show you the results of the backtests I did on the "Scalp strategy".

This strategy is part of a ‘trilogy’ of scalping strategies from the author that make use of the same indicators. Each variant of this strategy however is a slightly different and more advanced approach on how these indicators are used. This Scalp strategy is the simplest form.

As the previous Scalp and Smooth Scalp strategies, his strategy was intended to work on the 1 minute timeframe!

f0a520ef7a12482ecaf3d2d09bf58720cb22161d6625aaf1a338ec43a8db8b82.png

This code uses a resample factor of 5.

Also this time the file is configured out of the box with spaces for hyperopting and these will be used later on in the populate indicators function. See lines 38 - 57 for these hyperopt spaces.

It's also a whole bunch of indicators and my experience so far with these scalp scripts is that these are not always used in the end.

What you’ll have to know is that these default values will be used during normal trading and backtesting.

The other space configuration is the range the hyperopt session will use in order to find the best value that hypothetically provides the best future trading results.

These BooleanParameters at line 53 - 57, are either true or false and are used to enable or disable the guards. Later in the buy and sell functions, the hyperopt will use these to see if the strategy has better results if one of these parameters is enabled or is disabled.

And finally these spaces are used to define if the parameter will be used for buying or selling the asset in the hyperopt session.

The following indicators are configured and will be part of the dataframe to determine the buy and sell signals (lines 59 - 83):

  • The exponential moving average of the close price over the last 5 candles.
  • Two other 5 day moving averages that will form a band around the closeprice EMA. One that uses the high price of the day and one ema that uses the low price of the day. 
  • Just like in the Scalp and smooth scalp strategies a fast stochastics with settings of five, three and three will be used.
  • Also the ADX will be part of the dataframe.
  • As well as the commodities channel index, 
  • the RSI indicator and
  • The Money Flow Indicator.

The more interesting thing is this part here where some resampling is going on on the dataframe at line 60 - 64.

The first thing that's happening is that the value of the current timeframe is captured and then multiplied by 5. So if you have a 1 minute timeframe the value of tf_res will be 5. On the 5 minute timeframe this will be 25 Or on the 15 minute timeframe this will be 75. And so on.

Next the DF_RES variable will get a resample of the entire dataframe to that calculated tf_res value. So actually that will be a completely new dataframe with the name DF-Res

Next an SMA of 50 periods will be calculated with the multiplied dataframe DF_RES

And the final thing that happens here is that the complete original dataframe gets replaced with the resampled dataframe and a resampled SMA will be added to that dataframe.

Now what I think the intention is here is that on the one minute timeframe that timeframe gets resampled to the 5 minute timeframe with the appropriate simple moving average.

In other words, there will be a 5 minute sma used on the 1 minute dataframe (line 64).

BUY Signal

The buy function here is a little bit more difficult to understand than usual because of the hyperopt type code that is used here.

975a4022b27d7d4b314993d861bf448bdf1a3035c3867d19d63fba56644f6aef.png

  • In all these indicator cases, the function will give a buy signal when the given indicator is below or above the default value that is given in the space section above (see lines 88 - 96). So to take the MFI indicator as an example, the buy signal will be given when the MFI value in the dataframe is lower then the default MFI value that is defined in the default value or the scope above.
  • The fastk should crossover the fasted to create a signal
  • And the resampled simple moving average should be below the closeprice of the candle. 
  • The open price of the candle had to be below the EMA low line as part of the buy signal.

Only when all these indicators meet their criteria, and in combination with the other static conditions shown here, a buy signal will be given. 

Also note that the RSI and CCI indicators are not used to determine buy signals.

SELL signal

To get a sell signal, 

  • The open price of the candle should be above the high ema band.
  • Then the code is almost identical to the buy signal but the conditions are reversed, so instead of a mfi that should be lower than the default mfi threshold value, it should be higher. 
  • The CCI is finally used here to create a sell signal. 

But again, the earlier configured RSI is still not used.

Stoploss and takeprofit

The first thing I spotted was that the ROI and Stop loss settings are again configured the same but the width between profit and stop loss is increased once more.

This time the ROI takes profit at 2% gains and has a stop loss of 10%. So to get  break even on one stop loss, the strategy should have at least 5 winning trades.

Initial backtest results

According to the backtest over all the available time periods I have the following results:

  • Best timeframe: 15 minute
  • Total profit of strategy: 42 %
  • Drawdown of strategy: 183 %
  • Winrate 75 %
  • Risk of ruin of strategy: 0.02 %

dd1bdebb91e07af6c398ee6a626b6355e25be15f59b8fc91ed75df8617b10bc9.png

This Reinforces smooth scalp code finally acts as a scalping strategy and realises this also on a low timeframe. 

The profit is reasonable as well and because of a 75% win rate this could actually do things. But seeing the amount of trades and the profit that comes from it, it is a strategy where you really should have patience and the discipline to not interfere with all these relative small wins over time.

Second backtest with 50 pairs open

Now, in the code of the strategy it says that this strategy is intended to run with at least 60 parallel trades. But because I only have 50 pairs I decided to do another backtest run with all 50 pairs open at the same time. So to be as much loyal to the strategy preferences.

Now the results of these tests were somewhat disappointing because the highest profit I got was on the 15 minute timeframe with only slightly more than 8% profit. And this over almost 1200 trades. 

4efa8595585c7b930cb1cd05365a322f11012ce0a3a4cb9d4248b5709859d297.png

So I guess I leave this at my default 10 open trades at a time and see what parameter optimisation will do to the profitability.

Hyperparameter optimisation

The author of the strategy was so nice to create a strategy that is also hyperoptable on the buy and sell signals instead of only the default roi and stop loss parameters.

The command I used to execute hyperopt is:

freqtrade hyperopt -c  user_data/backtest-config.json  --epochs 1000 --spaces stoploss roi --hyperopt-loss SharpeHyperOptLoss --timeframe 15m -s reinforcedSmoothScalp

Conclusions

The strategy has indeed been nicely optimised and got very profitable on the 15 minute timeframe. It went from a initial profit of 40% to almost 2000%. 

The winrate is still very acceptable in my opinion with 68% which results in a Risk of ruin of arount 50%.

I am not really happy with the drawdown that has been increased, but I am not surprised if you consider that almost every very profitable strategy suffers from high drawdowns as well. Nonetheless, the score that I recalibrated since my last video shows also that the high profit is valued and therefore might put this strategy somewhere in the mid regions of the league that I created.

e86e09fa2cb8a398b677bc48676f4006c30882bf4eb602d864a0393ecc15a917.png

Strategy League

The Reinforces Smooth Scalp strategy is the first strategy that enters the top 6 with a low timeframe of 15 minutes. I honestly thought that good gains were only possible if you used a trend riding strategy that was in the market for a couple of days or even weeks or months. THis strategy proves that there is indeed a possibility to scalp the market and still make good profits as well. 

It enters right behind the earlier Scalp strategy but has much higher gains and by the looks of it, the scalp strategy is only just in front because it has such a low drawdown experience and has a very low risk of ruin. But it also has a lot less trades made so again this is a tradeoff between large gains and the risk of getting rekt…

Nonetheless, with the relatively high win rate it surpassed the first four strategies and this could definitely be a strategy that can provide you with nice gains over time.

6634bed14f67af59deb738b1085df9d43caf5ac3f7f821296b17773f7a65eaed.png

The strategy code

Note: this is NOT MY CODE !

https://github.com/freqtrade/freqtrade-strategies/blob/master/user_data/strategies/berlinguyinca/ReinforcedSmoothScalp.py

The hyperopt json results

{
  "strategy_name": "ReinforcedSmoothScalp",
  "params": {
    "trailing": {
      "trailing_stop": false,
      "trailing_stop_positive": null,
      "trailing_stop_positive_offset": 0.0,
      "trailing_only_offset_is_reached": false
    },
    "buy": {
      "buy_adx": 35,
      "buy_adx_enabled": true,
      "buy_fastd": 19,
      "buy_fastd_enabled": true,
      "buy_fastk": 26,
      "buy_fastk_enabled": false,
      "buy_mfi": 23,
      "buy_mfi_enabled": false
    },
    "sell": {
      "sell_adx": 100,
      "sell_adx_enabled": true,
      "sell_cci": 114,
      "sell_cci_enabled": true,
      "sell_fastd": 88,
      "sell_fastd_enabled": false,
      "sell_fastk": 57,
      "sell_fastk_enabled": true,
      "sell_mfi": 79,
      "sell_mfi_enabled": false
    },
    "protection": {},
    "roi": {
      "0": 0.398,
      "102": 0.11000000000000001,
      "269": 0.04,
      "600": 0
    },
    "stoploss": {
      "stoploss": -0.347
    }
  },
  "ft_stratparam_v": 1,
  "export_time": "2022-04-01 14:20:21.385898+00:00"
}




How do you rate this article?


15

0

DutchCryptoDad
DutchCryptoDad

I'm just a regular Dutch dad with a passion for crypto, trading, technology and learning. This channel is my personal journey into the world of Crypto, blockchain, programming, trading bots, trading strategies, NFT's, Defi and many things more.


DutchCryptoDad
DutchCryptoDad

I'm just a regular Dutch dad with a passion for crypto, trading, technology and learning. This blog is my personal journey into the world of Crypto, blockchain, programming, trading bots, trading strategies, NFT's, Defi and many things more related to digital assets. I want to share my knowledge with others to help them as well in this vast world of digital assets.

Send a $0.01 microtip in crypto to the author, and earn yourself as you read!

20% to author / 80% to me.
We pay the tips from our rewards pool.