A New Number 1 Trading strategy!! Combined_NFIv6_SMA (Patreon)
Downloads
Content
Introduction
In this post I want to present you another spectacular performing Nostalgia for Infinity based trading algorithm that I have found on GitHub. It is called Combined NFI Version 6 SMA and I can already tell you that with my testing methodology this Algo ends up high on my Strategy list.
Where to find it
As I am working my way to the end of my backlog with algorithmic trading strategies, I sometimes come across a trading algorithm that is an evolution of something I already tested a while ago.
You have to know that, every day there are new iterations of trading strategies developed, that can perform even better than their earlier versions.
And this time is no exception.
You can find this strategy if you look for the name on Github. Code search results (github.com)
And as you can see, there are two persons that have this file saved in their code repository.
Oh, and If you finished this video and still have doubts on the performance I have showed you, then you can also go down this page and open one of these files. Here you can check the results of the tests this person has done on this trading algo.
rat/Series another test/another_test_2.txt at becad6ffa09e2e8ab81a02d25ff14a7e20515e04 · criminau/rat (github.com)
Anyway, let’s not wonder of and dive into the code of this trading algorithm.
I must warn you that I will not go into each line of code, since it consists of over 2200 lines.
Let me open the file to show you…
Most of the times I call these humongous algos ‘black box algorithms’ since I cannot tell how it works in detail and where possible dangers lie. In the case something unexpected happens with trading.
Since it is an evolution or fork from the original NFIX strategy (iterativv/NostalgiaForInfinity: Trading strategy for the Freqtrade crypto bot (github.com)) I’m assuming that this is a specific trading algorithm where many people have worked on and also have tested it on the probability to make money in the market. So it is already somewhat verified on its correct workings.
But this shouldn’t stop you from doing your own research too, since your setup could very well be totally different and might give you different results too.
So let me glance over this file and give you a high level overview of what it does. And for those persons that still want to have more information about it.
I have already have taken a deep dive into the original Nostalgia for infinity trading algo in an earlier video (LINK OPZOEKEN EN TONEN). So if you want to be more informed about its inner workings, you can always watch that video.
Now let’s continue with the file.
This algo operates on a 5-minute timeframe with an informative timeframe on the 1 hour. This relatively short interval allows the strategy to capture quick market movements and react quick to new opportunities.
The ROI setting will close out the trade as soon as a 1000% return on investment is reached from the moment the trade opens, which is extremely optimistic in typical trading scenarios. This high setting is probably set to disable the ROI and let the code of the algorithm determine the exit signals.
This is also the case with the large stop loss setting. It means that the strategy allows a trade to go 99% into loss before closing it, which is risky and likely not practical for most trading environments. Most of the time this setting is used to effectively disable the stop loss and let the trading rules decide when to exit the trade.
The trailing stop loss is also set to true. And this nags me a little bit, since it gives a positive bias to the backtest results. Therefore I also have made a file with the stop loss disabled and tested that version also.
Later I will show you the results of both the trailing stop loss enabled and disabled versions. So you can decide which results are closer to reality.
The strategy uses several technical indicators that are pivotal for the decision-making processes.
And some of these are the:
SMA (Simple Moving Average)
EMA (Exponential Moving Average)
Elliot Wave Oscillator
RSI (Relative Strength Index)
MFI (Money Flow Index)
Chaikin Money Flow
Bollinger Bands
The code also contains a lot of methods that check for specific conditions to decide when to enter or exit trades. These conditions are based on the calculated indicators and might include checks for crossovers, thresholds being exceeded, or specific market trends.
The populate_buy_trend method in the strategy determines when to buy by evaluating a series of conditions derived from various technical indicators. If all these conditions align then the method flags these instances in the dataframe. That instructs the trading bot to execute buy orders at those specific moments. There are many different methods or buy conditions set for many different market situations. That makes this algorithm so divers and also complex.
Similarly, the populate_sell_trend method identifies when to sell by checking if conditions such as reaching profit targets or hitting stop-loss limits are met. And when any of these sell conditions hold true, the strategy updates the dataframe to signal selling points. Which guids the bot to exit positions accordingly. Also there are many different sell situations defined. And this is the reason why the default stop loss has been disabled.
So, overall, the strategy employs a very comprehensive and dynamic approach to trading and it uses a variety of technical indicators and complex logic to make trading decisions.
Now, all these methods are designed to maximize potential gains while incorporating several layers of risk management to safeguard investments.
But what about its ability to make profits in the market. Is it really as good as I promised at the beginning of this video?
Backtest results
Now again you have to be aware that these results are on my specific setup with my pairs to test. And if you test on your machine, the results might not be the same as what you see on the screen.
That’s why you should always do you own research on your setup before any real live trading. This goes for any trading strategy you see on the internet.
Now the original strategy has a spectacular gain of 65300 usdt. That’s a gain of 6400 percent on the initial investment of 1000 dollar.
Whats even more admirable is that this strategy has also a 85 percent win rate and only a drawdown of 6 percent or so.
Also most of the pairs favor this algorithm so it could well be that your preferred trading pairs also respond well to this strategy.
The equity curve also shows that it responds well to almost any market circumstance.
It is true that sometimes the algo has difficulty under very harsh circumstances as you can see around September 2022. But it recovers fine and continues to rise after that.
This can also bee seen in the drawdown plot
The highest drawdown occurred at that time. But on average the drawdown sits around 1.5 percent.
Which I can certainly live with.
As you can imagine, most of the weeks this algo has green numbers. But sometimes this algorithm has trouble keeping the gains and will lose a significant amount of money as you can see on this plot. According to these theoretical backtest results ofcourse.
Now what about the trades and profit itself.
These boxplots show you an overall view of what you can expect per trade.
The left plot depicts the winrate distribution for the Combined NFI strategy, showcasing a predominantly high performance with a median close to 0.9. Despite the general success, the presence of several outliers indicates episodes of unexpected lower winrates, dropping to around 0.2. This variability underlines a certain unpredictability in the strategy’s overall robustness.
On the right, the profit distribution plot reveals a strategy that oscillates around break-even, with a narrow interquartile range suggesting that most outcomes are modest in financial terms. However, the presence of significant outliers ranging from losses of -$2000 to profits reaching $6000 highlights the potential for both substantial gains and considerable risks. This dichotomy between frequent small gains and occasional large deviations will form a critical aspect of the strategy's financial impact that you have to be aware of.
No TSL
To stay on this somewhat critical note here. I also tested this strategy without the TSL enabled.
It’s performances are therefore also lower. But it gives a more realistic view on the capabilities of the algorithm in my personal opinion.
To make a ballbark estimation. It’s performance is around 5 to 10 percent lower than the TSL enabled version.
On and by itself it is still very good though. Since some strategies that I tested with and without the TSL enabled have way higher differences in performance between each other.
The equity curve is also comparable with the TSL enabled. It looks a little bit more jagged. But overall you can expect the same performance.
Which is also the case with the boxplots of this NoTSL version.
The numbers are all a little bit lower and the variability is a little bit higher. But overall comparable.
So it’s up to you to decide which of these give a more realistic view on the performance here.
With TSL Enabled
Now Getting back to the original strategy results.
The overall performance indicators show a great performance on most of the indicators. With some minor exceptions like the profit percentage and maybe also the Sortino a little bit.
But with this overall performance you can already guess, and have also seen it here.
This trading algorithm currently enters at the top of my Strategy League. A well deserved position.
If I also add the No_TSL version to this list. Then that version enters a little bit lower. But still well within the current top 5 with the score I give it.
So there you have it. A completely new number one trading algorithm discovered.
I actually never thought that this was possible, but in this business it is proven again to never assume things.
Thank you all for reading the post and to be a Patron for me. I appreciate this very very much.
I will soon come with new results of other backtests so, see you in the next Post.
Goodbye!