Home Artists Posts Import Register

Downloads

Content

Introduction

Have you ever wondered which algorithmic trading strategy would provide you with the highest gains in combination with the best risk management?

Well in this post I will present you my findings on the NFI5 MOHO trading algorithm that might prove to be the best trading strategy for your automatic trading yet.

Where to find this strategy

If you open Github and search for the term NFI5MOHO, then  you’ll find out that a lot of repositories contain this file (https://github.com/search?q=NFI5MOHO&type=code).

There are also other versions available. But in my case I have tested this Work In Progress version.

Let me open the code to take a look what’s inside… 

https://github.com/5drei1/freqtrade_pub_strats/blob/7d59a4ceecba321e47797962bb120cea9618191a/NFI5MOHO_WIP.py#L48

Next select raw, and then we are good to go to explore this code. 

https://raw.githubusercontent.com/5drei1/freqtrade_pub_strats/7d59a4ceecba321e47797962bb120cea9618191a/NFI5MOHO_WIP.py

As with some earlier tested strategies, this is also a variation of the Nostalgia for infinity trading algorithm. A black box algorithm that is created by Iterativ and maintained by lots of other contributors.  https://github.com/iterativv/NostalgiaForInfinity

Interestingly enough there are only four versions in this repo and I suspect that somebody else had made some personal adjustments. That person did not add his or her name to the code, but if you recognize your work here. The creator, the contributors and you deserve all the credits here.

I’m just the guy that presents his personal findings to the Youtube audience here.

The strategy

Now there is a small clue on the differences between the original NFIX version and this specific version. And these are written down here in the code:

Apparently the code has been adjusted to also contain the MultiOffsetLambo algorithm and some optimized parameters. And since this appears to be added way back in june 2021, I think these adjustments could be valid additions to the algo.

That’s also where the adjustment of the name comes from MO Multi Offset, HO Hyper Optimized.

Now as with earlier videos about the NFIX strategy, Im not going over all the lines. 

But I will only show you some highlights within the code.

For example, here you can make a decision whether to use or ignore a certain buy and sell conditon.

These are the spaces that are prepared to be optimized by the Hyperopt command:

Together with some Moving Average indicators.

After these moving averages there is the Trailing stop loss setting. Here it says that it is not used, but still the setting is set to True.

However when I downloaded this file I have manually set this to False. So this time you will see the results without TSL enabled.


Now I also tested this strategy on the 5 minute timeframe. Since that was the only timeframe this algo could work on.

A little bit further below, after a lot more adjustable hyperopt parameters there is a custom sell method programmed. 

Also informative pairs are used. As well as a bunch of informative indicators configured on the 1 hour timeframe.

After that there are normal timeframe indicators coded. 


These informative 1 hour timeframe and normal indicators are then used in the populate indicators method so fill the dataframe that the bot will use for deciding the buy and sell signals.

After that, the real fun begins and the conditions under which a buy signal should be triggered are defined.

For example 

This buy condition is enabled when buy_condition_1_enable is true. It signals a buy if several criteria are met: the 50-period EMA is above the 200-period EMA on the 1-hour timeframe, the 200-period SMA is trending upwards, and specific safety conditions related to dips and pumps are satisfied. 

It also requires the current price to have increased significantly from its lowest point in the last 36 periods, the 1-hour RSI to be within a specified range, the current RSI to be below a certain threshold, the Money Flow Index (MFI) to be below a specified value, and volume to be positive.

And this goes on for each and every specific buy condition that is configured.

What’s at least equally important are the exit signals.

They also consist of different sets with different rules. Althought not that many as the buy parameters.

For example this third sell condition sells a position if it is enabled and also if the rsi is above a certain value and the volume is larger than 0.

MultiOffsetLamboV0

To find the part that originares from the MultiOffsetLamboV0 algorithm, I had to search for the original algo first. https://github.com/search?q=MultiOffsetLamboV0+&type=code

https://github.com/PeetCrypto/freqtrade-stuff/blob/f6c38def0b2fe01d8d42e47740cdeab53511527b/MultiOffsetLamboV0.py#L32

IN that code there was a buy trend configured that made use of the Elliot Wave Oscillator.

That piece was included in the NFI5MOHO buy section at the end

Also the corresponding sell method was also copied from the Lambo file to the NFI file as you can see here.

Together with the Elliot Wave Oscillator itself at the end.

Backtest results

But now lets continue with the results I got.

Also, because I immediately tested this algo with the Trailing Stop Loss disabled I will not surprise you with different results after what I present next.

And after I tested I was very much pleasantly surprised by these hypothetical results this algo gave me.

This trading algorithm has scored tremenously well on my setup.

With a win rate of over 90 percent and a maximum drawdown of less than 15 percent, this strategy managed to attain a profit of almost 17000 percent.

80 percent of the pairs respond well to the rules of this algorithm. All the ratios have very high scores too. Although the Calmer seems to be a little bit too optimistic here. So keep this in the back of your head.

 Let’s take a look at the equity curve.

By the looks of it, the rules of this algorithm seem to hold during bullish and bearish circumstances.

There are some dips in the curve, but nothing too serious so it seems.

The biggest drawdown was around may 2020 and that was around the time the pandemic happened. 

The second larges drawdown happened around the lowest period in the last bear market. So not too much surprises here.

This also is reflected by the profits per week and the mean profit and loss curve. Again the biggest losses happened during last times bear market. Maybe the strategy can be tweaked to not trade at these moments or so.

Next there are the winrate and profit distribution boxplots. These tell me more about what to expect on average about the trades.

    The yellow line in the Win rate box plot indicates the median win rate, which appears to be around 0.85, suggesting that in an average week, the strategy wins about 85% of the trades.

    The box represents the interquartile range, with the lower quartile (25th percentile) around 0.8 and the upper quartile at 1.0. This range indicates that 50% of the weekly win rates fall within this range.

The whiskers extend to approximately 0.6 on the lower end and 1.0 on the upper end, indicating that most of the data points fall within this range.

And there are also several red dots below the lower whisker,  these are the outliers. And they represent weeks where the win rate was significantly lower than the general distribution. You could also see these weeks in the previous plot.

Now about the profit box plot.  

The yellow line in this box plot indicates the median weekly profit. It is around 0, suggesting that the median week sees neither significant profit nor loss.

The box itself shows the interquartile range for profits, which is relatively tight. This indicates that 50% of the weeks have profits that fall within a narrow range close to the median.

These whiskers indicate the spread of the profits, extending from around -2000 to 3000, showing a wider variability in weekly profits compared to the win rate.

Now there are also red dots above and below the whiskers. Again they represent outliers. Positive outliers show some weeks with significant profits, up to 20000, while negative outliers show weeks with significant losses, down to -5000.

Now the total hypothetical profit is not the highest ever found. But There is more then only gains here. Risk management and the way that this equity is gained is also very important. 

In trading it is always a question of how much risk to take to attain a certain reward. And with algotrading this is not different.

Besides, some of the strategies that have these insane performances also have a dark side to them as well. I discussed these in the video’s and blog posts on my patreon page. And if you want to know more about what the pro’s and con’s are of these other strategies, then I reccommend you watch these video’s and posts.

If I compare the individual performance indicators of this NFIXMOHO strategy, then you see that on a lot of these subplots it outperforms most the other best performing algorithms. 

To me, some of the most important factors are the profit factor in combination with the profit percentage. Togehter with the applicability on the pairs that I intend to trade on. Eventually other scores like Sharpe, Sortino and Calmar are derived from these performances.

Strategy League and ending

And if I count all the individual scores up to one total score, then you see that this specific trading strategy has the highest overall score of all the algorithms I tested so far.

Now, that’s something that I did not expect to see since the last time I found another well performing strategy.

Did I reach the ultimate score yet. Well actually not but as it seems now, we are getting close. And it might be that in the future even better performing strategies force me to recalculate this entire list again with adjusted scores.

But for now this algo seems worthy to me to be added to my live trading bot to see if it actually performs well under live circumstances too.

And this is were we end up in this post. A NEW NUMBER ONE TRADING ALGORITHM that we can try out to see if it will make us live changing money.

Thanks for reading and being a Patron and I will see you in the next post.

Goodbye!



Files

Don't Miss Out: I Unveil the Best Trading Algorithm Yet!

Welcome to my channel! In this video, I dive into the NFI5MOHO trading algorithm, a powerful and innovative strategy that could transform your algorithmic trading game. If you've ever wondered which trading strategy offers the highest gains while ensuring excellent risk management, you're in the right place. 📈 Highlights: Introduction to the NFI5MOHO algorithm Step-by-step guide on how to find and use this strategy on GitHub Detailed analysis of the code and its unique features Backtest results showcasing a win rate of over 90% Insights on how this strategy performs in various market conditions 🔗 Links: NFI5MOHO Code on GitHub: https://github.com/5drei1/freqtrade_pub_strats/blob/7d59a4ceecba321e47797962bb120cea9618191a/NFI5MOHO_WIP.py Original Nostalgia for Infinity Algorithm: https://github.com/iterativv/NostalgiaForInfinity MultiOffsetLamboV0 Algorithm: https://github.com/PeetCrypto/freqtrade-stuff/blob/f6c38def0b2fe01d8d42e47740cdeab53511527b/MultiOffsetLamboV0.py 👍 Support the Channel: If you find this content helpful, please click the like button and subscribe to my channel. Your support helps the YouTube algorithm recognize that you enjoy my content, and it motivates me to keep creating valuable videos for you. === !!!! PATREON SUBS GET ACCESS TO ALL OUTPUT, CODE AND STRATEGIES !!!! 💬 SOCIAL 💬 Youtube : https://www.youtube.com/channel/UC-AOcefy1x7lTc17JiqaxqA?sub_confirmation=1 Patreon: https://www.patreon.com/dutchalgotrading Strategy league: https://www.dutchalgotrading.com Buy me a coffee: https://ko-fi.com/dutchcryptodad Youtube: https://www.youtube.com/@dutchalgotrading 💰 AFILIATE LINKS & PROMO’S 💰 Bybit: https://www.bybit.com/en-US/invite?ref=K7JEX Linode $100 Free credits: http://linode.gvw92c.net/dutchalgotrading Tradingview get $15 off with purchase : https://www.tradingview.com/?aff_id=139223 🏷️ TAGS 🏷️ #trading #bot #crypto #cryptocurrency #bitcoin #money #strategy #algorithmic #algorithm #backtesting #dutchcryptodad #dutchalgotrading 📺 PLAYLISTS 📺 Tested trading strategies: https://bit.ly/DCD_strategies_pl Freqtrade bot tutorials: https://bit.ly/DCD_freqtrade_pl 📈 CHART ANALYSIS 📈 Tradingview: https://bit.ly/DCD_Tradingview ⚠️ FINANCIAL DISCLAIMER ⚠️ This channel is for education and entertainment purposes only! All the content I show are hypothetical results on a limited backtest dataset. My way of deciding if an algorithm is good is not an exact science! Everybody has their own preferred way of determining if a trading algorithm fits their person needs or not. It is your responsibility to investigate if this strategy fits your risk appetite, backtest and will provide similar results under live circumstances! Past Performance Is NO Guarantee of Future Results!! I am in no way responsible for bad setups, strategies and possible losses (or gains) of money as a result! Everything expressed here is my own personal opinion and not official investment advice. Investing in cryptocurrency or trading involves a high degree of risk and should be considered only by persons who can afford to sustain a loss of their entire investment. Please do your own research or consult a financial advisor before making any financial decisions!

Comments

Kidon Sull

Hi Dutchman ! I couldn't find any other place to ask, hence this. I'd like to add my indicator(rvi) to qtpylib.indicator in ft docker, but can't figure out how to start a bash shell. I'd appreciate if you could advise how to ! Many thanks for your great works.

Kidon Sull

Ah, one more thing ! Wonder whether it's possible to grid trade in ft futures mode ?! It would be great if it can, I think.

Dutch Algotrading

Im not a Docker expert either, Google is mostly my friend here. Also qtpylib is also a library that you will have to change to make it work. Even when it is part of Docker. My honest advice here is that it could be managed the easiest way when you add your indicator as a function in the strategy file. There are loads of other examples of other developers that just add their indicator at the end of the strategy and call it from there. No fuzz - quick and easy.

Dutch Algotrading

I got this question often in the past. I do not think the bot's architecture is capable of doing this. You can stack multiple trades of the same pair but to program a complete grid would test the limits of the programs intentions. Maybe you could ask the original developers as a change or feature request. I have no further relations with that project.

Kidon Sull

Didn't know it can be done that way ! Will look up other examples, and seems it's the right way. The only thing is how to get the ohlcv feed, and the rest would be easy. Thanks for the prompt advise ! ps. VSCode is great ! Its 'devcontainer' let me edit the files inside the container, without even asking ftuser password !o!

Kidon Sull

Yup, thought it would be... Seems grid should be done seperately, via the brokers' tool or something like PassivBot. There're soooo many things to catch up in your contents !! Cheers

Giovanni Mauro

Hey! Thank you for your hard work I'm wondering if in all your strategy have you ever developped an indicator that can give us (something like a fear and greed index) a sentiment market score. This can help very much to make decisions... Basically a trend detection indicator. This can exist? Thank you

GrantandSarah

What is the setup you are using to run multiple live strategies? Do you allocate tradable balance percentages or just run separate containers?

Dutch Algotrading

This complete setup is downloadable for Patrons from the products section. Also the configs and docker settings. Hope this answers your question.

Dutch Algotrading

First of all I try to make it clear that a lot are not my strategies but found on the internet. I did made videos where I tested 'baseline' indicators that you can use as a demarcation for trading/not trading (these are the SMA indicator strategies) and build further on that. Currently (totally by coincidence perhaps) I am now preparing for a trading strategy test where I use the Bollinger Band Trend indicator. These are 20 different variations so it will take some preparation. But it will be my next vid through. Hope this answes your question.

lemao

Hello, I am new with freqtrade, thank you for your work, I have errors in the backtest of the strategy, can you share the user_data/config.json file please

Sebastian

Hi, I am just starting to trade this way. Is it normal that the bot has been running for 2 days now and hasn't made a trade yet? My exchange is Binance. There are no errors etc. in the logfile. Thank you very much, Sebastian

Sebastian

Her is the running config, Did somebody see something wrong? Mode: Live Exchange: binance Market: TradingMode.SPOT Stake per trade: unlimited USDT Max open Trades: 3 Minimum ROI: {'0': 0.111, '13': 0.048, '50': 0.015, '61': 0.01} Entry strategy: {"price_side": "same", "use_order_book": true, "order_book_top": 1, "price_last_balance": 0.0, "check_depth_of_market": {"enabled": false, "bids_to_ask_delta": 1}} Exit strategy: {"price_side": "same", "use_order_book": true, "order_book_top": 1} Stoploss: -0.99 Position adjustment: Off Timeframe: 5m Strategy: NFI5MOHO_WIP Current state: running

Dutch Algotrading

One simple answer: Yes! That's the advantage of algotrading with automatic trading bots. When you set the exact rules, they will follow. So even if you are feeling that you 'have to take a trade, since it is a while ago', if the rules say that it is not the correct time, then they will obey. Getting personal emotions or thoughts out of the way of actual trading. E.g. follow my live trading bot on YT, sometimes there isn't a trade for days, and then suddenly laods of them...

Atanas Kostov

Hi, I'm a newbie. Backtests results are very different from yours. I'm probably wrong somewhere. Can your get config.json?

Dutch Algotrading

All my files are in the shop section. It was the only place where I can keep these simply at hand :-) You can recreate my complete setup with these files and some help text.

Patrick Schurr

Hey man, i try to reacreate your Strategy. your customized strategy can be found in the zip folder under your blog post? Btw really appreciate your freqtrade Tutorials, there are the only ones who are really understandable. Thumbs up!

Dutch Algotrading

Yes, all my backtest output, including the files are available in the zip. Together with the files i have in the shop section you should be able to recreate my results. And thanks for your compliments :-)

Xavier Escudero

Hi. I am using the strategy in live. After 2 days, I have a win ratio of 80% (21/26). The problem is that the 5 losses are with a big stop loss (15%) and the wins are about 1%. So the final result is a big loss. Have you tried in live?

Dutch Algotrading

I currently use this strategy in a forward test. I will present the findings later in a video. Your observations are correct. One losing trade can indeed cause a big loss that negates all your winning trades. That is the conclusion of many low timeframe strategies I tested so far. You can also make the stoploss bigger so that it will not be triggered and let the trade 'breathe more', but then you risk even greater losses - this is not advice - you'll have to tweak the settings to your own likings and pairs for the best results here.

Xavier Escudero

I see your python file establishes 0.99 as stop loss. When are the positions closed/sold?

Dutch Algotrading

0.99 effectively disables the percentual stop loss. In these cases, the stop loss comes from other algo items like TSL, exit parameters or the exit signal(s).

Dutch Algotrading

0.99 means at 99 percent loss (effectively disabling it). In the algorithm are enough exit signals configured to close a trade before that happens. Check the output of the backtest and exit reasons for that. Hope this helps.

Xavier Escudero

After some days of live trading I've a 40 winning trades, and only 5 losing trades, but the final result is that I am losing money. This is because the average winning trade is about 1,25% but the losing trades have an average of 15% of loss.

Xavier Escudero

Did you finally presented the forward test? I would like to use some strategy for live trading.

Yash Rd

Greetings! So I am using your provided config, and somehow I can't get the backtesting results above 245%. So same strategy with same config. What am I missing?

bas de louw

Where can i find the config file? Its not in the zip file.

DeJohn Franklin

So what command is used to hyper opt this strategy? Can't seem to get that accomplished

Dutch Algotrading

What kind of output do you get? Also there are loads of parameters activated to optimize. This can be a heavy toll on your system and it might crash out without any warning. Try to disable many of these and test. At point it will probably work.

DeJohn Franklin

I have a strong system. I9 64gb Ram. When I put -spaces to all. I get a can not pigtail..etc

Dutch Algotrading

That is indeed interesting. Did you also try just one space like buy or sell? What happened then. Mabye post the complete output

DeJohn Franklin

Multi offset has hyperopt abilities…but don’t know what category it falls up under

Dima

Did you tried the original NFI strategies? V5 for example?