CryptoFrog Algorithm Testresults (multiple trading algo's)
Added 2024-09-27 09:00:02 +0000 UTCIn this Patreon exclusive post I will present you the results of tests I did on multiple trading algorithms that ware made by CryptoFrog.
The source
For some people CryptoFrog might be a familiar name. This is because he is also a member of the Freqtrade community and also made some additions for the Freqtrade bot.
The strategies that he made are not available on his Github repository
However if you search for the title of one of the strategies, then you’ll find plenty of resources where these can be found.
One of these resources is this repository PeetCrypto/freqtrade-stuff: Strategies for Freqtrade (github.com) and this is where I got all these strategies from.
Now since there are many versions of the same algorithm, each with small individual differences that have an effect on the endresult. I have decided to test these all and add them to only one blog post instead of spreading these out over multiple posts.
Which strategies are included
In this post I will include the following algorithms:
CryptoFrogHO3A1
CryptoFrogHO3A2
CryptoFrogHO3A3
CryptoFrogHO3A4
CryptoFrogNFI
CryptoFrogOffset
All these strategies Python code files, with their results on my specific setup (mind you), are also included in this post. So you do not have to download these files from the Github repository but can directly access them from this post.
General strategy structure of the algorithms
Before I dive into the results, I will first show you a general view on the way these strategies are build. As said, many are derived from the same origin but have their specific individual settings, that have an effect on the end result after the tests.
For this reason I will only highlight the CryptoFrogHO3A1 strategy and not all the others, since these differences are minimal. However if you find that one of the derived algorithms perform way better than this original algorithm. Then it’s a good idea to investigate why this algo performs better than the original one.
This strategy is a fairly complex Freqtrade strategy that incorporates a variety of technical indicators and custom logic to determine buy and sell signals.
Imports and Dependencies
The strategy uses multiple libraries like `pandas`, `numpy`, `talib`, and `finta` for indicators.
And also uses build in Freqtrade` components like `IStrategy`, `merge_informative_pair`, `stoploss_from_open`, and parameters for strategy tuning (`IntParameter`, `DecimalParameter`, `CategoricalParameter`).
Sell and ROI Parameters
Key to this strategy are the sell_params, which determine when to exit a trade. For instance, cstp_bail_how specifies how to bail out of a trade—either based on a sudden drop in the asset's price (cstp_bail_roc) or after a set time (cstp_bail_time). This ensures you don't hold onto a losing trade for too long. These conditions only kick in when the trade isn't profitable, as defined by cstp_threshold.
The strategy also features dynamic ROI management. The droi_pullback option allows the strategy to exit if profits pull back from their peak, helping to lock in gains before they diminish further. Dynamic ROI adjustment, based on market trends (like the Relative Momentum Index), ensures the strategy aims for higher returns when conditions are favorable.
The ROI table gradually lowers profit targets over time, starting at 5.5% and dropping to 0% after an hour, ensuring adaptability to market changes. A fixed stop-loss at 29.9% prevents excessive losses, while a trailing stop captures rising profits, locking them in as the trade progresses.
Custom Stoploss Logic
This strategy uses a custom stop loss mechanism (`use_custom_stoploss = True`) with a dynamic system to adjust the stop loss based on time, profit levels, and other conditions. This includes concepts like decay, pullback, and trailing stops.
Linear Decay: The stop-loss gradually tightens over 166 minutes, starting at -8.5% and ending at -2%, ensuring the stop-loss becomes more conservative as time passes (decay-start, decay-end).
Dynamic Adjustments: The stop-loss can move closer to the current price if the difference between current and minimum profit (cur-min-diff) exceeds 3% and the profit drops below a certain threshold (cur-threshold). Additionally, a rapid price drop (roc-bail at -3%) can trigger an immediate exit.
Trend and Bailout Logic: The stop-loss decay can be paused if a positive trend is detected (rmi-trend at 50). Depending on the market conditions, the strategy can choose an immediate bailout if certain criteria are met (bail-how set to 'immediate').
Positive Trailing Stop: Once the trade moves into profit (pos-threshold at 0.5%), a trailing stop is activated, following the price at a 1.5% distance (pos-trail-dist), helping to lock in profits as the price rises.
My personal idea so far is that the author has focused this strategy on the trailing stop loss here. This might also explain the relative ‘simple’ exit signal I will present further.
Indicator Calculations
The strategy has a rather complex set of indicators that are inspired from other al;gorithms. This time the author has added some of the sources of these indicators to the file so that we can check later how they will work on the original strategies.
Personally I like to keep things simple since using many indicators, and also combining these into other functions, make things complex. It is hard to troubleshoot why an expected strategy is not working effectively if there are many complex relationships between these indicators.
Anyway, lets continue…
It starts by calculating smoothed Heikin Ashi candles. These are not the standard Heikin Ashi but a customized version that averages the open, high, low, and close prices, giving a clearer picture of market trends. The strategy further smooths these values using an Exponential Moving Average (EMA) when specified, making it easier to detect trends with reduced noise.
Additionally, the strategy uses a variant of Heikin Ashi inspired by Hansen_Khornelius, applied to a higher timeframe. This variant modifies the typical Heikin Ashi formula to smooth out data even further. By shifting the open and close values and applying a Simple Moving Average (SMA), the indicator effectively highlights trends over a six-period timeframe, providing reliable entry signals when combined with other indicators.
To detect potential volatility, the strategy incorporates Bollinger Bands (BB), specifically focusing on the expansion of BB width. By monitoring the width of the Bollinger Bands over time, the strategy can identify when volatility is increasing, which is often a precursor to significant market movements. A custom function checks if the latest BB width is 10% higher than the recent maximum, signaling a potential breakout.
For momentum and trend confirmation, the strategy relies on a suite of other indicators. Stochastic Fast (Stoch Fast) and Stochastic RSI (StochRSI) provide quick feedback on the market's momentum. While Stoch Fast focuses on short-term momentum, StochRSI adds another layer by incorporating the RSI, ensuring that the momentum readings align with the broader trend.
It also uses indicators like the Money Flow Index (MFI), which adjusts RSI for volume, and the Volume Flow Indicator (VFI), which analyzes the direction of price movement based on volume. These volume-based indicators help to confirm the strength of a trend, ensuring that signals are backed by actual market participation.
Directional Movement Index (DMI) is another crucial component, with its +DI and -DI lines indicating the strength of buying and selling pressures. The Average Directional Index (ADX) further confirms the trend's strength, ensuring that the strategy only acts on solid trends.
Lastly, the strategy incorporates indicators like ATR (Average True Range), ROC (Rate of Change), and custom indicators such as RMI (Relative Momentum Index) and SSL Channels with ATR. These are used to manage stop losses dynamically and to refine the strategy's ability to exit trades at the most opportune times.
Timeframe and Informative Timeframe
This strategy was primarily build for the 5 minute timeframe. It also uses an informative timeframe of 1 hour.
This means that I could only test on the 5 minute timeframe. It could be that the algo performs better on higher timeframes, but since the limit of 5 minutes is hard coded, I could only test on this timeframe.
Buy and Sell Signals
Buy Signals
The buy signals in this strategy are intricately designed to identify moments when the market is poised for an upward move. The logic begins with a simple condition: the current price must be below the smoothed Heikin Ashi low on the 5-minute chart. This condition alone ensures that the strategy is only considering entries when the market is in a downtrend or a period of consolidation, waiting for a potential reversal.
It also incorporates insights from a higher timeframe, using Hansen’s modified Heikin Ashi EMA. Here, the strategy looks for further confirmation that the higher timeframe is also in a downtrend, as indicated by the EMA on the hourly chart. When both the 5-minute and hourly charts align in this way, the groundwork is laid for a potential buy.
The strategy then refines its decision-making process by looking for signs of an impending uptick. One key indicator is the Bollinger Band Width (BBW) expansion, which signals increased volatility—a precursor to significant price movement. If the BBW expansion is detected without a quiet market (indicated by the absence of SQZMI), and if the Money Flow Index (MFI) is low (indicating oversold conditions), or if the DMI- (Directional Movement Index Minus) is high (indicating strong downward momentum), the strategy becomes more confident in initiating a buy.
In addition to these conditions, the strategy looks for opportunities in undersold regions. For example, if the current price is below the Parabolic SAR, and the Stochastic RSI (StochRSI) is showing signs of an upward crossover in oversold territory, it suggests that the downward momentum may be exhausted and that a reversal could be imminent. This is further confirmed by the Stochastic Fast indicator, where a similar crossover indicates that the market is beginning to shift from bearish to bullish.
It also identifies potential buys during temporary dips in sideways markets. This is done by detecting when the DMI- crosses above the DMI+, especially if the price is near the lower Bollinger Band. Additionally, if no other strong buy signals are present, the strategy may still consider buying based on a combination of the SQZMI indicator (detecting market squeezes) and the Stochastic Fast indicator, ensuring that even in the absence of strong trends, the strategy can still find profitable entries.
Finally, before committing to a buy, the strategy performs a volume check. It ensures that the Volume Flow Indicator (VFI) is negative, confirming that any potential uptick isn’t driven by a bearish volume trend. Only when all these conditions align does the strategy generate a buy signal, marking the start of a potentially profitable trade.
Sell Signals: Securing Profits Before the Tide Turns
The sell logic mirrors the buy logic but in reverse. It starts by ensuring that the current price is above the smoothed Heikin Ashi high on the 5-minute chart. This condition ensures that the strategy is only considering exits when the market is in an uptrend, aiming to close positions at or near the peak of a rally.
Again, the strategy looks to Hansen’s Heikin Ashi EMA on the hourly chart for confirmation. If the EMA indicates that the higher timeframe is also in an uptrend, the strategy knows that it’s likely in the latter stages of the upward movement and that selling might be wise.
To further confirm the sell signal, the strategy checks for signs of an overbought market. If the BBW expansion indicates high volatility and the MFI is above 80 (signaling overbought conditions), or if the DMI+ (Directional Movement Index Plus) is strong, the strategy takes this as a sign that the upward momentum might be nearing its end.
The strategy ensures that the VFI is positive, indicating that the bullish volume trend supports the recent price increase. This is coupled with a volume check to ensure that there’s enough market participation to sustain the current price level.
When all these conditions align, the strategy triggers a sell signal, closing the trade to secure profits before the market reverses. By doing so, it avoids the pitfalls of holding onto positions for too long and ensures that profits are realized at the optimal time.
Backtest results
So after this explanation of the main algorithm’s inner workings, let me present you with the results of the backtests I did on my setup. I will only show you the overall results of all the named versions and present the most interesting charts in this post.
If you want to get more information and see all the other plots I made on the performance of all these algorithms, then you can find them in the attached zip files of this post.
Ps.
For newcomers: I usually test on multiple timeframes ["1d", "4h", "1h", "30m", "15m", "5m"] and also use the following pairs for the spot trading backtest:
"pair_whitelist": ["BTC/USDT","ETH/USDT","BNB/USDT","SOL/USDT","ADA/USDT","XRP/USDT","DOT/USDT","AVAX/USDT","DOGE/USDT","SHIB/USDT","MATIC/USDT","UNI/USDT","ALGO/USDT","LTC/USDT","LINK/USDT","NEAR/USDT","BCH/USDT","ATOM/USDT","TRX/USDT","XLM/USDT","FTM/USDT","MANA/USDT","AXS/USDT","HBAR/USDT","VET/USDT","SAND/USDT","ICP/USDT","FIL/USDT","THETA/USDT","ETC/USDT","XMR/USDT","XTZ/USDT","AAVE/USDT","KLAY/USDT","ONE/USDT","GRT/USDT","GALA/USDT","EOS/USDT","CAKE/USDT","STX/USDT","FLOW/USDT","LRC/USDT","CRV/USDT","KSM/USDT","MKR/USDT","ENJ/USDT","QNT/USDT","XEC/USDT","AMP/USDT","ZEC/USDT" ],
CryptoFrogHO3A1
The results of the CryptoFrogHO3A1 version (explained in detail above) are rather disappointing. Only a 10 percent profit on the 5 minute timeframe (remember, I could only test on the 5 minute tf).
The most eye-catching numbers are the winrate (24%), lose streak (202) and drawdown (90%).
The equity curve shows the story of this backtest over time:
This algorithm seems to be a great performer in bullish circumstances. But when bear markets arrive (after the yellow line), you’d better make sure this algo is stopped before you give all your gains back to the market…
CryptoFrogHO3A2
The second version of this trading algorithm has an even worse performance on my setup. You can see the numbers here. You can still try to test this algo on your own preferred pairs since some of mine still made some profits with this algorithm (34.69%).
But I think this is just coincidence and not reproducible here.
With an equity curve like this it is hard to imagine how to adapt this algo version to make it keep its gains (but that’s a challenge for you to find out 😉)
CryptoFrogHO3A3
The third version of this algorithm ends up with a small loss after a rather large ‘peak bull market profit’. But then also the gains are melting quickly away like an ice cream in Barcelona’s heat.
It’s interesting to see that this equity curve has an almost 90 degree rise around June 2021 and it could be an interesting idea to find out which exact rules of the strategy cause this.
Again in this case, the trick is to find out which winning trades cause this steep increase in profits. And besides this, the reason of the losing trades is also a question of investigation.
CryptoFrogHO3A4
Again another version of this trading algorithm, but with different settings and also slightly different results.
However the equity curve has similar characteristics over the entire backtesting period.
CryptoFrogNFI
This strategy is different from the one that were presented earlier. Here the basis of the algorithm is probably the Nostalgia for infinity algorithm (hence the NFI in the name). Since I already covered the NFIx strategy a couple of times I will not do this again, but instead only present you the results of this trading algorithm.
If this CryptoFrog version of the NFI algo has better results then the original version, then try to discover why this is so. This code consists of over 2700 lines which will make this a challenge though…
You can see immediately the results of this algorithm being different from the earlier presented algo’s. Here a 76% win rate results in a 252% profit over the backtesting period.
The max drawdown still is fairly high in my opinion (78%) and this should be further investigated to bring it down.
Also only 53% of the pairs respond well to this algorithm and backtesting with only these should gain further insight in the reasons why this algorithm performs well on only these pairs.
There is also something peculiar with the results shown in the plot. For some reason the results of this algorithm could not be plotted correctly. It could be a bug in my code that causes this and I will have to find this if this happens more often.
This plot shows the win rate and profit distribution of the strategy over a week on a 5-minute timeframe. The left box plot indicates that the strategy has a median win rate around 78%, with most trades falling between 70% and 85% win rate. The right box plot reveals that while the majority of trades are profitable, with a median profit around $300, there are several outliers with significant losses, indicating some trades resulted in large drawdowns.
CryptoFrogOffset
Then there is this last strategy that has a different name but, at a glance, looks similar to the NFI version algorithm.
But the results are astounding and not recommended for use.
The equity curve directly takes a nose dive into loss territory. Only to come up for a short breather and then dive even deeper into the ocean of despair.
The strangest thing happens here though because this algorithm has lots of winning trades (74.9% winrate). But these wins are not enough to make up for the losses that a few losing trades make.
Again here it is proven that focusing on winrate is not enough to make gains in the market. The whole package has to fit.
Conclusion and lessons learned from Testing CryptoFrog Trading Algorithms
After thoroughly analyzing the performance of multiple CryptoFrog trading algorithms, several key lessons emerged:
1. Complexity Doesn’t Guarantee Success: The intricate designs of the CryptoFrog algorithms, while innovative, did not consistently translate into profitable outcomes. Despite utilizing numerous technical indicators and custom logic, many versions struggled, particularly in bear markets, where gains were quickly reversed.
2. Adaptability is Crucial: The performance of these algorithms varied significantly across different market conditions. Algorithms like CryptoFrogHO3A1 and HO3A2 showed strong results during bullish phases but failed to preserve gains during downturns. This underscores the importance of building strategies that are adaptable to varying market conditions.
3. Win Rate Isn’t Everything: The CryptoFrogOffset algorithm demonstrated that a high win rate does not necessarily equate to profitability. Despite a 74.9% win rate, this strategy still ended up in a loss, highlighting that other factors, such as risk management and the magnitude of losses, play critical roles in overall success.
4. The Need for Continuous Optimization: The varying results across different versions of the same strategy suggest that slight adjustments in parameters can have substantial impacts on performance. This indicates the importance of continuous testing and optimization to refine algorithms for different market environments.
5. Understanding Market Conditions is Key: The NFI-based strategy, despite showing better results compared to others, still had significant drawdowns. This indicates that while an algorithm might perform well under certain conditions, understanding the market context and applying the strategy selectively is essential for consistent success.
6. Start simple and then build further: My personal opinion is that simple strategies that perform good have the best fundamentals to build on further. I understand very well that the CryproFrog algorithms were created for the more volatile 5 minute timeframe. But since a lot happens on this 5 minute timeframe, with different circumstances and many variations it is almost impossible to catch each and every trade into a trading rule. Let alone the conflicts that can arise when two rules cancel each other out, or worse one rule creates a loss on another possible profitable trading opportunity.
So in conclusion, these tests illustrate the challenges of algorithmic trading and the necessity for robust, flexible strategies that can withstand the unpredictable nature of cryptocurrency markets.
All the results of these strategies are in the Strategy League. So if you want to find their exact position, I recommend you to check this link (Patreon does not support these kinds of pages): https://www.dutchalgotrading.com/strategy-league/
Ending
So I will end with saying that I really appreciate your support here on Patreon and I hope that I provide you with good information with these posts.
Let me do the hard work of analyzing to get the best performing trading algorithm so that you can reap the benefits.
Thank you very much again, and I will see you in the next post.
Goodbye!!