
This post is probably the last one that I will do concerning algorithmic trading strategies that you can readily download from the Internet for the Freqtrade bot. Some of the more important reasons are that most of the files you can download are just version or iterations of older ones, are just not good (and more experiments), contain many errors so debugging and fixing takes too much time and effort, and also not compatible anymore with the current and future versions of the Freqtrade trading bot.
I’m not completely guaranteeing to never download these algo files and test them anymore. Because it could be a missed opportunity if it suddenly happened to be a real good one. But I want to focus my energy more to these Youtube video’s or other Blog posts on the internet where big promises are made and want to test these strategies to find out if they are really worth your (and my) time.
Nonetheless, let’s do this ‘show’ one more time with this VWAP-based trading strategy. Thank you author @jilv220 for creating this one!
This algo revolves around leveraging the Volume-Weighted Average Price (VWAP) and related technical indicators to identify profitable trade opportunities.
Here's a detailed breakdown of the strategy's setup, including its essential settings, key indicators, and the buy/sell logic:

Basic Settings
ROI (Return on Investment): The strategy sets a minimal ROI target of 2%, encouraging quick turnaround trades.
Stop Loss: The stop loss is set at 15% below the entry price to protect against significant losses.
Timeframe: The strategy operates on a 5-minute timeframe, which suggests it is optimized for short-term trading and quick market movements.
Indicators Used in the Strategy
VWAP (Volume-Weighted Average Price): A rolling VWAP calculation with standard deviation bands (high and low) is employed. These bands provide dynamic support and resistance levels:
CTI (Chande Trend Index): A momentum oscillator that measures price trends. It helps identify overbought and oversold conditions.
RSI (Relative Strength Index): 14-period RSI: Evaluates short-term price momentum and overbought/oversold conditions.
84-period and 112-period RSI: Used to confirm longer-term trends and add depth to trend analysis.
TCP Percent Change: Measures the percentage change of the current close from the maximum open price over a specified look-back period (4 candles).
Volume: Ensures that trades are only placed when the market has sufficient trading activity.

Buy and Sell parameters
The strategy triggers a buy signal when the following conditions are met:
Price below VWAP Low: The current close price must be below the lower VWAP band, indicating a potential undervalued condition.
Positive TCP Percent Change: A >4% change in the close price relative to the maximum open price over the last 4 candles.
CTI Confirmation: The CTI must be less than -0.8, signaling a strong bearish trend likely nearing a reversal.
RSI Levels: Short-term RSI is less than 35, indicating oversold conditions.
Long-term RSI values (84-period and 112-period) are below 60, suggesting an absence of excessive upward momentum.
Volume: Trades are only considered when trading volume is greater than zero.
Interestingly, the sell logic is left intentionally blank in the provided code. This implies the strategy might rely on external sell triggers such as manual interventions, a trailing stop loss, or other dynamic exit mechanisms not defined in the script.

So to summarize this trading algorithm, it is a high-frequency, short-term approach that combines the power of VWAP bands with momentum and trend indicators to identify undervalued buying opportunities. The reliance on multiple RSIs and CTI ensures that the signals are robust and filtered for quality. But the absence of an explicit sell logic indicates a significant area for further customization, where traders can refine the exit strategy to align with their risk tolerance and profit goals.
Backtest Results
I have tested this algorithm on the well known dataset and got the following results:

The backtest results for the VWAP strategy reveal strong performance on the 5-minute timeframe (5m) but a steep decline in effectiveness as the timeframe increases. On the 5m, the strategy achieves an impressive 93.43% win rate, a profit factor of 1.68, and a CAGR of 2.32, generating a massive profit percentage of 3565.46%. These numbers align with the high-frequency nature of the strategy, which relies on short-term movements and precise VWAP-based signals.
The strategy is coded to exploit short-term oversold conditions via VWAP and RSI thresholds. This design inherently fits the 5m timeframe, where price movements are volatile and frequent. The performance drop at longer timeframes suggests the indicators fail to capture momentum effectively in slower, less volatile markets.

The cumulative profit chart for the VWAP strategy on the 5-minute timeframe confirms its strong alignment with short-term market opportunities. The cumulative wins (green line) consistently rise over time, reflecting the strategy's high win rate of over 93%. The cumulative losses (red line) remain relatively flat, suggesting effective filtering of poor trades. However, the sharp increase in cumulative profits (orange line) around the 2021 bull market top indicates that the strategy benefits significantly from high-volatility, bullish market conditions.

The drawdown chart reveals critical insights into the VWAP strategy’s risk profile on the 5-minute timeframe. While the average drawdown of 3.25% (green line) appears moderate, there are significant spikes, notably exceeding 9% during specific periods. These high drawdowns often coincide with volatile market conditions or incorrect entries where the strategy’s recovery mechanism struggles to contain losses.

The winrate and profit distribution charts for the VWAP strategy provide additional depth to its performance analysis. The winrate box plot shows a consistently high median winrate close to 1 (100%), with a tight interquartile range. This reinforces the strategy's ability to identify successful trades. However, the occasional outliers, including a few near 0%, highlight instances where the strategy fails entirely, likely due to unexpected market conditions.
The profit distribution plot reveals a more complex picture. While most weekly profits cluster within a modest range, significant outliers on both ends indicate periods of exceptional gains or severe losses. These extremes suggest the strategy's dependency on volatile market phases, which can amplify both positive and negative outcomes.
Although the strategy shows an impressive winrate, the variability in profit highlights its reliance on favorable market conditions and the absence of a robust mechanism to cap losses during adverse scenarios. This inconsistency in profit suggests the need for stricter risk management, especially during less predictable market conditions.

The comparison chart positions the VWAP strategy as a standout performer in several key metrics but reveals critical weaknesses in others. The profit percentage is exceptional, surpassing most other strategies and highlighting VWAP's ability to generate substantial gains in volatile markets. Similarly, the win percentage is among the highest, demonstrating the strategy's consistency in capturing profitable trades.
Both the Sortino and Sharpe ratios are robust, reflecting favorable risk-adjusted returns and highlighting the strategy's ability to manage volatility effectively during successful periods. However, the drawdown is significantly larger than its peers, indicating vulnerability to substantial losses in adverse market conditions, a clear red flag for risk management.
The Calmar ratio is underwhelming due to the drawdown, signaling inefficiency in balancing risk against returns. This weakness undermines the otherwise strong results. VWAP’s high profit factor reflects efficiency in extracting profits relative to losses, but the strategy is notably weaker in longer-term measures like CAGR, which is dwarfed by several competitors.

Conclusion
The VWAP strategy looks to be a strong performer for short-term, high-frequency trading on volatile markets. Its key strengths lie in its exceptional win rate, profit percentage, and risk-adjusted returns as reflected by strong Sharpe and Sortino ratios. These attributes make it highly effective in capturing consistent gains in favorable conditions, particularly on the 5-minute timeframe.
So overall, the VWAP strategy is well-suited for traders who can monitor the market closely and tolerate occasional drawdowns in exchange for strong short-term profits. For broader applicability and sustainability, especially in less volatile or bearish markets, it would benefit from enhancements to its exit logic, risk management, and adaptive measures to handle changing conditions. But its current design excels in specific scenarios, these improvements would make it a more robust and versatile strategy.
It’s recommended that you first test this algorithm on your own setup by doing backtests and then forward tests. After you are certain that this could be a profitable strategy, dip your toes in the real market by using a small amount of real money and gradually add more if you are certain that the bot will not lose your money big time.
Always ALWAYS do your own research first please!
And this this very important message and this last precoded strategy file I’m at the end of this year cycle and tests. Many many thanks for being a Patron! I hope that 2024 ended well and your in profit now in this bull market. Let’s make 2025 even better!! I will return 😊
See you in the next post!
Goodbye
2024-12-13 19:00:03 +0000 UTC
View Post
Text will be added later in a separate post. Good luck!
2024-12-08 13:16:34 +0000 UTC
View Post

Hello my dear Patrons,
In this post another analysis of a trading strategy I found on the Internet. It is called the True Lambo 2 and is probably (hopefully) improved version of the true_lambo 1 trading algorithm that I tested a while ago.
Let’s keep things short and simple and stick to the plan of making not such dreadfull long posts at the end of this year. We have more to do at the moment (like watching Bitcoin reach 100.000 US Dollar for example 😊).
The algorithm is created by jilv220 and has the following remarks added by the author:
The Strategy
The strategy has loads of buy and sell parameters that can be optimized by Hyperopt. It looks to be aimed to high-frequency trading on short timeframes, which makes it suitable for active cryptocurrency markets.
Timeframe and Stoploss
Timeframe: The strategy operates on a 5-minute timeframe, allowing it to capture rapid price movements.
Stoploss: A deep stoploss of -0.99 is set, though a custom trailing stoploss function is used for more precise risk management during trades.
ROI (Return on Investment) Targets
The strategy features a step-based ROI configuration:
0 minutes: 9.2% profit
29 minutes: 4.2% profit
85 minutes: 2.8% profit
128 minutes: 0.5% profit
This allows the strategy to lock in profits depending on how long a trade is active.
Indicators Used
The strategy utilizes a broad set of technical indicators to analyze market trends and identify trading opportunities. Some key indicators that are configured are:
Exponential Moving Averages (EMA): Short-term (5, 8, 14) and long-term (50, 200) EMAs track momentum and trends.
Bollinger Bands (BB): These provide volatility insights, with various standard deviation widths for nuanced analysis.
VWAP Bands: Used to identify support and resistance levels, calculated with rolling standard deviations.
RSI and Stochastic Indicators: Offer insights into overbought and oversold market conditions, critical for timing trades.
Elliott Wave Oscillator (EWO): Detects wave-like price patterns.
T3 Average: A smoothed trend-following indicator for advanced market movement detection.
It also uses a custom stop loss function too that is activated. It uses predefined profit thresholds to transition between different trailing stoploss levels. For example, at lower profit levels, a moderate stoploss is applied, but as profits increase, the stoploss tightens to secure gains. The transition between these levels is smooth, using linear interpolation to ensure that the stoploss adjusts proportionally as the trade moves into deeper profitability.

Buy Conditions
The algorithm includes multiple buying rules optimized for diverse market conditions:
Crash Recovery: Detects sharp declines by analyzing percentage drops over short timeframes (3, 9 candles) to enter at potential recovery points.
ClucHA and VWAP Strategies: Buy signals are generated based on price interactions with Bollinger Bands and VWAP levels, signaling potential reversals.
Momentum Metrics: Uses RSI and EWO to confirm a strong bullish or bearish momentum before placing trades.
Lambo-specific Entries: Combines fast and standard RSI levels with EMA crossovers to enter trades in moderately bullish conditions.

Sell Conditions
The selling logic focuses on maximizing profits while minimizing risks:
Exits occur when price crosses above key moving averages or deviates significantly from predefined thresholds.
RSI-based conditions ensure momentum fades before closing positions.
Again, the custom trailing stoploss is employed to let profitable trades run while securing gains against sudden reversals.
Backtest results
As always I tested this algorithm on its merits and got the following optimistic results back from the tests on the 5 and 15 minute timeframe (because of the maximum 1 hour timeframe as the informative timeframe).

The best-performing timeframe in this table is the 5-minute timeframe, achieving an impressive 843.80% profit with a 77.97% win rate over 5,278 trades. The Calmar Ratio (3.38) and Sharpe Ratio (5.33) indicate strong risk-adjusted returns, despite a maximum drawdown of 32.91%. The relatively high win streaks (45 max) and profit factor of 1.22 suggest consistent profitability, making this timeframe optimal for this strategy's high-frequency design.

This chart shows the True Lambo strategy's performance on the 5-minute timeframe, analyzing cumulative wins, losses, and profit over time.
The cumulative profit demonstrates a sharp rise during the 2021 bull market, peaking around the bull market's top (highlighted by the yellow dashed line). This reflects the strategy's ability to capitalize on favorable market conditions with high volatility and trending behavior.
The wins line exhibit a steady and consistent increase throughout the backtest, indicating a high win rate. However, post-bull market, the profit line begins to decline, suggesting that the strategy struggles in less favorable or choppy market conditions.
The losses line remain relatively stable, showing that the strategy manages risk well by maintaining fewer losing trades, which aligns with its high win rate.
This chart highlights the strategy's strong performance during trending conditions and its vulnerability to drawdowns in stagnant or bearish periods, likely due to its trend-reliant buy and sell signals. This calls for further optimization to adapt to varying market environments.

The drawdowns are relatively minimal and stable during the early period up until late 2021, coinciding with the bull market's favorable conditions. The drawdowns during this period mostly remain below the average, reflecting the strategy's ability to handle upward-trending markets efficiently.
However, post-2021, as the market transitions into more volatile or bearish phases, the drawdowns increase significantly, peaking above 25% in some instances. This rise indicates that the strategy struggles in non-trending or declining market conditions, likely due to its reliance on trend-following mechanisms, which lose effectiveness during such periods.
The weekly winrate distribution on the left shows a relatively high median winrate, centered around 0.8 (or 80%). The boxplot is fairly narrow, indicating consistency in the strategy's winrate across trades. However, the presence of a few outliers at the lower end (around 0.4) reflects occasional instances of underperformance, potentially due to market conditions that are unfavorable for the strategy's trend-following logic.
The profit distribution on the right reveals that most weekly profits are clustered near a relatively modest range, with a median slightly above zero. There are a few significant outliers in the positive direction, representing highly profitable periods likely linked to strong market trends. But there are also outliers in the negative range, which could correspond to drawdown-heavy weeks during choppy or bearish market phases.
This information aligns with its strong reliance on trending markets and the potential for large drawdowns during adverse conditions.

This strategy can compare its high win percentage to the other best performing strategies (that I had at that time – at the moment I have other better algos in the league – I was running behind schedule with some of these algo’s)
This high win rate is counterbalanced by a significant drawdown, which reflects the strategy's vulnerability to adverse market conditions or large losses that are not sufficiently mitigated by its risk management rules.
The algorithm overall has modest performance metrics—such as lower Calmar and Sortino ratios—compared to other strategies in the chart. While it generates strong results in trending markets due to its frequent wins, the high drawdown indicates that its ability to handle downturns or periods of increased volatility is limited. This suggests a need for additional safeguards, such as tighter stoploss settings or enhanced market condition filters, to reduce the impact of losing trades and improve the overall risk-adjusted performance.

It’s no wonder that this performance leads to a place within the top 50 (I guess). It’s not the worst strategy because the rules and indicators do feel like the have potential, but tweaking the other variables and parameters might seem to make the performance better. Still this True Lambo strategy achieves a high win rate and consistent performance in trending markets but suffers from significant drawdowns, which limit its overall effectiveness and highlight the need for better risk management in volatile or bearish conditions.
All the output of the test, including the strategy Python file are in the zip file included in this post. It also includes the plots of this strategies performance over time. If you do want to investigate the potential of this algo further. Please do so with caution. Backtest and forward test this on your own setup and after confirmation of true profits carefully start testing with real money.
Thanks for reading this post and I’ll see you in the next post.
Goodbye!
2024-12-05 19:00:02 +0000 UTC
View Post

Introduction
In my previous blog post I wrote that I am running pretty far behind with my analysis on the performance of pre-defined and complete Freqtrade strategies that you can find on Github or the Internet.
Under normal circumstances I write the complete text for my video’s and then alter it here and there to create a blog post for reference. But since these next couple of algorithms, and their respective posts, are mostly derivations or evolutions of older strategies and do not have the same high performance, I decided to only write ‘exclusive blog posts’ of these. I also have thought of a different style of writing that should eventually stay informative enough while not diving too deep into the code. I think I have explained enough already how to interpret these Freqtrade coded algorithms in older video’s. So if you are new here and really need to know how these algorithms should be read and what they do line by line, then please watch the older posts for that information.
This Obelisk RSI strategy that I have left on my shelf is the first one to handle, so here it goes…
The Strategy

Timeframe and Strategy Overview
The ObeliskRSI_v6_1 strategy (downloadable on github here) is programmed to operate on a 5-minute timeframe, making it a short-term trading approach designed to take advantage of brief market fluctuations. Its aim is probably to catch dips in the market, buying in before a reversal and riding the price back up to generate profit. So in essence, it is a momentum-based strategy that tries to capture value from market “bottoms” while avoiding overextended downtrends.
ROI and Stop Loss Settings
The return on investment (ROI) setup is designed for flexibility, with gradually decreasing profit targets as time in the trade progresses. It starts aggressively, targeting a 15% profit immediately, but as time elapses, it lowers to 4% at 35 minutes, 1% at 65 minutes, and finally reaches a break-even point of 0% by 115 minutes. This progressive ROI structure helps the strategy adapt to varying market conditions, capturing quick profits when possible, yet willing to settle for smaller gains if the trade lingers longer than expected.
The stop loss is set at a conservative -30%, meaning the strategy is willing to risk up to 30% of a trade’s value before cutting losses. This wide stop loss aligns with the strategy’s anticipation of reversals, allowing lots of room for price fluctuations. Additionally, a custom stop loss function gradually reduces the risk exposure over time, narrowing from the initial -30% down to nearly break-even after 110 minutes, providing an extra layer of loss protection.
Custom Stop Loss Ramp
A custom stop loss ramp all the way down at the bottom of the code dynamically tightens the stop loss using a time-based curve that narrows the allowable loss as the trade progresses. It begins with the full stop loss but gradually tightens along a cubic curve until, after 110 minutes, it nearly reaches zero. This approach prevents trades from dragging on indefinitely and ultimately forces an exit after a set period, win or lose. This feature tries to act like a “safety net,” capturing any profits that may exist by the time the stop loss curve reaches its end point, and I think that this way it tries to ensure that the strategy doesn’t hold onto a losing trade for too long.
Indicators in populate_indicators
This strategy only uses the Relative Strength Index (RSI). And also in two ways. First, it calculates a long-term RSI by resampling the data over a 1-hour timeframe, which provides insight into the broader market trend (bullish or bearish). The results of this longer RSI are then used to determine if the strategy is in a “bullish” or “bearish” mode, switching between different buy and sell thresholds depending on this trend.
The second RSI calculation is done on the standard 5-minute timeframe, and it acts as the primary trigger for both buying and selling. When the RSI dips below a certain value, the algorithm considers this a sign that the asset may be oversold, indicating a buying opportunity. Conversely, when the RSI crosses above a set threshold, it signals a potential overbought condition, triggering a sale.
Entry and Exit Rules
The entry rules in populate_buy_trend use a comparison between the RSI value and specific thresholds, depending on whether the trend is bullish or bearish. For example, in bullish conditions, the strategy uses a higher RSI threshold (like 35) as a buy trigger. When RSI crosses below this threshold, it indicates a temporary dip in a generally upward market, suggesting a buying opportunity. In bearish conditions, a lower RSI threshold (like 21) is used, reflecting a need for a stronger dip before entering, which aligns with the strategy’s more cautious stance during downtrends.
In populate_sell_trend, the exit rules are similar, but in reverse. Here, the RSI thresholds determine the exit point, aiming to capture gains once the price reaches an overbought region. In bullish conditions, the strategy exits at a higher RSI level, while in bearish conditions, it exits sooner at a lower RSI, playing it safer. This dynamic approach of entering earlier and exiting later in bullish markets and doing the opposite in bearish markets. This aligns well with the strategy’s idea of capturing market dips and riding them up for profit.
My first reaction is that it has the potential to navigate different market moods. In a choppy market with frequent dips or a more sustained trend. But stay aware about the author’s notes. The strategy might backtests well but real-world performance can vary and trading live with high volatility pairs requires a keen eye and possibly some tweaks too.
Backtest results
The backtest results show this current picture of the strategies performance on my specific setup.

The backtest results for the strategy show a promising level of profitability but also highlight areas for improvement. With an End Balance of $3168.46 and a Profit % of 216.85%, the strategy achieved solid growth over the test period. The Win % of 56.74% indicates a favorable win rate, although not exceptionally high for an RSI-based strategy, suggesting that some trades might be operating on thin margins.
The strategy's CAGR (Compound Annual Growth Rate) is modest at 0.47, pointing to steady, incremental growth rather than explosive returns. However, the Maximum Drawdown of 74.25% is notably high, which could be a concern for risk-averse traders.
On the risk-adjusted metrics, we see a Sharpe Ratio of 2.65 and a Sortino Ratio of 2.39, both indicating that the strategy generates returns with a reasonable level of consistency relative to its volatility. The Calmar Ratio of 0.63, however, reflects the impact of the high drawdown on long-term performance stability and this number should be taken seriously if you want to proceed testing this algorithm.
The Profit Factor of 1.02 shows that for every dollar risked, there’s only a marginal profit, indicating that gains are nearly balanced with losses. And lastly, with 59.18% of pairs profitable, the strategy shows adaptability across various assets, though not overwhelmingly so.

The performance plot shows a dramatic rise followed by a steep decline in cumulative profit. From early 2020 to mid-2021, the strategy performs impressively, with the cumulative profit (orange line) climbing steadily, supported by regular weekly profits (green bars). However, after peaking around mid-2021, the strategy’s performance takes a turn. The cumulative profit starts to decrease, showing a persistent decline through 2022 and into 2023. Weekly losses (red bars) become more frequent and pronounced, and the strategy struggles to recover its earlier momentum.

The drawdown analysis reveals a critical insight into the strategy's vulnerability during downturns. In the early stages, from 2020 to mid-2021, drawdowns remain relatively mild, fluctuating below the average drawdown level of 25.73% (indicated by the green line). However, after the 2021 bull market top we see a significant shift. Drawdowns begin to escalate sharply, with the red line showing a steady climb that peaks beyond 70% by late 2022. This high drawdown level is a clear indication that while the strategy performs well in choppy or upward-trending markets, it lacks safeguards in prolonged downtrends. And this highlights an area for potential improvement, such as implementing tighter risk management.

The winrate and profit distribution plots provide another view of the strategy’s consistency and variability in returns.
In the winrate distribution plot, we see a median win rate around 0.57, with most values concentrated between 0.52 and 0.62. This reflects a relatively stable win rate with moderate fluctuations, which is a positive sign for reliability.
On the profit distribution plot, the median profit is close to zero, indicating a balance between profitable and unprofitable trades. However, the plot also reveals several outliers in red, representing occasional high losses. This makes it clear that a few large losses significantly impact the overall performance and highlights the strategy’s occasional vulnerability to severe drawdowns. That is consistent with the earlier observed high maximum drawdown.

Eventually this algorithm ends up pretty low on the total Strategy League. This plot also makes it clear that this strategy was lying on the shelf pretty long because the current League is much, much larger at the moment.

The performance comparison charts offer a comprehensive perspective on the strategy relative to other top strategies. You can immediately see that the strategy’s drawdown stands out as a major concern. This level of drawdown dwarfs other strategies and it exposes the portfolio to significant risk. Such high drawdown implies that prolonged losses could quickly erode gains, which may not be sustainable or appealing for risk-averse traders.
Its win rate is stable but not outstanding compared to other strategies, reflecting a balanced but moderate edge in trade success. Similarly, the profit factor hovers around 1, meaning that profits and losses are nearly equal on average, leaving minimal room for compounding returns after accounting for losses.
Also the risk-adjusted metrics like the Sharpe and Sortino ratios do not outshine its peers. These ratios highlight that the strategy’s returns come with considerable volatility, and while profitable, it may not be the most consistent performer relative to its risk.
In conclusion, using this algorithm comes with significant risk. The substantial drawdown indicates that this algorithm may not be suitable for all traders, particularly those who prioritize risk management. To improve its robustness, the strategy proble could lie in its usage of the specific stop loss function as its protective mechanism. Ultimately, ObeliskRSI_v6_1 is an aggressive, quick gaining option in favorable market circumstances that could appeal to traders comfortable with drawdowns but may not meet the needs of those seeking a more balanced or risk-adjusted approach.
And with this conclusion I am at the end of this post. I hope you like this new style of posts for the coming period. I personally think it’s more concise and high level. If the performance of an algorithm is very good, we can always go back to the code and see where the possible strengths and weaknesses are so that we can improve the code if necessary.
For now thank you for reading this post and being a Patron. And I will see you in the next post!
Goodbye!
2024-11-28 17:00:04 +0000 UTC
View Post
2024-11-27 18:52:09 +0000 UTC
View Post

Hi there and welcome to this post where I discuss the ‘Low_BBHO’ algorithm.
You can find this strategy file on github in multiple repositories (you have to be logged in btw.: https://github.com/search?q=Low_BBHO&type=code).
The strategy
This Low_BBHO strategy (created by the author Thorsten) is a example of an algorithmic approach designed around a "buy the dip" philosophy, using Bollinger Bands to identify attractive entry points. It combines Bollinger Bands and a flexible ROI configuration with defined stop-loss settings to enhance the potential for profit and minimize risk.
The strategy is configured to run on a rapid 1-minute timeframe, designed for high-frequency trades. But in this test my lowest timeframe is the 5 minute TF. The choice of this superlow 1 minute timeframe is probably aimed to capture short, potentially profitable movements in price over brief periods.
In terms of return on investment (ROI), the strategy has a detailed configuration that gradually lowers the target ROI over time. It has a initial ROI target of 8.5% as soon as the position is opened and reached. As time progresses, these targets reduce, with smaller ROI thresholds set at 7 minutes (1.1%), 19 minutes (0.7%), and selling out at 40 minutes.
The stop-loss parameter is also well-defined at -26.3%, a large margin that allows the strategy to endure some market fluctuations. However, this limit still acts as a protection mechanism against drastic losses.
The strategy does not employ a trailing stop loss, which means once a trade is in profit, there is no mechanism to progressively lock in gains as the price increases (and also possible skewed backtest results).
The indicators central to the Low_BBHO strategy revolve primarily around Bollinger Bands and the MACD. Additional indicators such as CCI, MFI, and RSI are commented out, perhaps for further exploration or refinement.

Bollinger Bands, calculated here with a standard 20-period window and 2-standard deviation bands, provide a range for assessing price volatility and spotting extremes. The lower band, is used with the entry signal, with the strategy buying when the closing price dips to 98% of this lower boundary.
The MACD indicator is used in the dataframe too but not directly tied to buy or sell conditions, so eventually useless, and will not be explained further anymore.

The entry logic, encapsulated in populate_buy_trend, is straightforward and based purely on Bollinger Bands. It signals a buy when the price is equal to or less than 98% of the lower Bollinger Band value. This conservative buy limit allows the strategy to take advantage of downward price movements, potentially catching a price rebound near its perceived lower extreme.
The exit conditions in populate_sell_trend, on the other hand, is completely empty. This suggests that, by default, the strategy relies only on Freqtrade’s built-in ROI and stop-loss configurations for exits. The lack of indicator-based exit signals could be a double-edged sword: it can simplifying the strategy. But it can also limit the flexibility to respond dynamically to trend reversals or overbought conditions.
Overall the strategy is simple to understand and explain. Let’s find out if this simplicity can be used to it’s advantage and create a good gain in the market.
Backtest results
The Low_BBHO strategy shows steady cumulative profits with minimal losses, excelling in high-frequency trading on the 5 minute timeframe. Wins consistently rise, especially during the 2020-2021 bull market, and continue post-peak, highlighting the strategy's resilience across conditions. Minimal losses and draws reflect effective entry filters, seemingly making it a good choice for capturing consistent gains, even as markets shift.

The "Winrate Distribution" plot shows a relatively wide range of win rates, with a median close to 0.9, indicating that the strategy generally wins around 90% of the time. This high win rate is promising, although the distribution's spread suggests that performance can vary significantly under different market conditions.
The "Profit Distribution" plot, however, reveals a more complex picture. The median profit is slightly positive, there is a notable spread, with a mix of high outliers and some deep losses. This spread indicates that while the strategy has the potential for occasional significant gains, it also encounters periods of substantial losses, which can impact overall profitability.
So it looks like the strategy boasts a strong win rate, but profit outcomes are mixed. The potential for high outliers is promising, but risk management may need to address the frequent smaller losses seen in the distribution.

I found out that I could run this algorithm on all the timeframes I usually test. You can clearly see that this algo is designed to be used on the smaller timeframes since the 5, 15 and 30 minutes have the highest scores.

On the 5-minute timeframe, the strategy shows a strong performance with a total profit of 259%, a high win rate of 81.15%, and a Sharpe ratio of 3.44, indicating good risk-adjusted returns. The maximum drawdown is manageable at 10.87%, and the profit factor of 1.75 suggests the strategy earns $1.75 for every $1 lost, making it a solid choice for high-frequency trading. The high win streak (43) and low loss streak (5) add to the reliability of this timeframe.

This performance comparison chart provides a detailed breakdown of how the Low_BBHO strategy stacks up against other leading strategies across multiple key indicators. Some noticeable mentions from this plot are:
The win percentage, which is notably high and a strong indicator of consistency.
Its low drawdown is another positive attribute. It is not the lowest, but certainly also not the highest. So it minimizes losses effectively.
The profit factor outshines some other, better performing algorithms.
And the way most coins respond to successful trading this algorithm is also worth mentioning.

So all in all, this Low_BBHO algorithm is a stable and consistent trading strategy, and excels in maintaining a high win rate and low drawdown. And this in relation to the really simple strategy rules it has. It looks to be a strategy that is ideal for steady gains in high-frequency trading. However, it leads in overall reliability, it is more conservative in terms of profit maximization and risk-adjusted returns compared to other top-performing strategies.
Before you think about using this algorithm in real life, please remember that you first have to do an extensive backtest AND forward test on your own personal environment because my results do not necessarily mean that this strategy will perform well in your situation as well.
And with these findings I am at the end of this post. I hope you got some useful information from this and if you are going to use this algorithm, maybe you want to add your feedback to this post so that other Patrons can benefit from your information too.
Thank you very much for reading and being a Patron.
And I will see you in the next post.
Goodbye!
2024-11-20 17:00:05 +0000 UTC
View Post

Hi there and welcome to this blog post!
In this post I will compare another 4 SMA Offset strategies that I tested but did not got the time yet to analyse further. As with the previous posts I will do a overview of the algorithms first, and then do a comparison of the performances. Because I use the same pairs and dataset for each of these algorithms I can compare the performances, together with strengths and weaknesses between all these algorithms.
In this test I will do a comparison between the:
Let’s start by reverse engineering what the rules of these algorithms are:
MultiOffsetLamboV0
The strategy’s minimal ROI (return on investment) is quite low at "0": 0.01, which suggests that it aims to capture frequent, small profits rather than holding for extended periods. This kind of configuration is often ideal for high-volatility markets where consistent, small gains can accumulate over time.

In terms of stop-loss, the strategy is set to allow a maximum loss of up to -50% on each trade. This is a deep stop-loss, likely chosen to provide ample room for price fluctuations, allowing the strategy to weather short-term downturns without prematurely exiting. However, the stop-loss threshold could also be interpreted as a need for careful risk management; such a large stop-loss requires confidence in the strategy’s ability to recover from drawdowns, especially for any trader looking to apply this in live trading.
The strategy does not implement a trailing stop-loss function. Trailing stops are often used to lock in profits as price moves favorably, but here, the strategy relies solely on fixed ROI and stop-loss values, reflecting a more static risk-reward management approach.
The intended timeframe for this strategy is 5 minute timeframe.
The indicators, entry signals, and exit signals are crafted to leverage both momentum and trend-following elements, with a particular focus on offset-based calculations.

The populate_indicators method is responsible for adding several calculated indicators to the trading data, which later drive buy and sell decisions. Key indicators here include offset variations of moving averages (MAs) and the Elliott Wave Oscillator (EWO).
The strategy computes both buy and sell thresholds based on multiple moving average types, such as simple (SMA) and exponential (EMA), with custom offsets applied. Each moving average is multiplied by a factor: a low offset for buy signals and a high offset for sell signals. This configuration allows the strategy to adjust entry and exit levels based on dynamic thresholds rather than fixed values, adding a degree of adaptability to market conditions.
The Elliott Wave Oscillator (EWO) is another core component of this strategy. The EWO captures the momentum between two exponentially weighted moving averages, a fast EMA and a slow EMA, and expresses this as a percentage of the closing price. This momentum indicator helps the strategy identify trending conditions.
The entry criteria in the populate_entry_trend method are straightforward. For each moving average type specified, the strategy checks if the current closing price is below the calculated buy offset. Additionally, the EWO must either be lower than a minimum threshold or exceed a maximum threshold, providing a filter for trades based on both bearish and bullish momentum conditions.
The populate_exit_trend function is structured similarly to the entry conditions but in reverse. Trades are exited when the closing price surpasses the specified sell offset for each moving average type, signaling that the price has reached a favorable level to lock in profits.

SMAOffsetProtectOptV0
The SMAOffsetProtectOptV0 strategy builds on similar principles to the previously analyzed strategy, focusing on dynamic offset-based thresholds for buy and sell signals while introducing some unique elements tailored to enhance its trading logic. Its intended to work on the 5 minute timeframe like the previous strategy.

This strategy operates with a minimal ROI target set at "0": 0.01, which signals its design to capture small gains efficiently over possibly shorter timeframes. Like the MultiOffsetLamboV0, it seeks consistent, frequent profits by aiming for modest returns rather than waiting for large price movements. The stop-loss level is also set at -50%, reflecting a tolerance for high volatility, similar to other strategies that aim to avoid premature exits in fluctuating market conditions. However, such a large stop-loss calls for disciplined position sizing to ensure a balanced risk profile.
The code review shows no implementation of a trailing stop-loss.
In the populate_indicators method, SMAOffsetProtectOptV0 uses a combination of moving averages and momentum-based calculations, particularly focusing on the Simple Moving Average (SMA) and Exponential Moving Average (EMA). The moving average offsets are configured by multiplying each by specific low and high offset values, creating flexible thresholds that dynamically respond to market movements. The buy threshold is calculated with a lower offset, while the sell threshold uses a higher one.

An Elliott Wave Oscillator (EWO) is also calculated here, derived from the difference between fast and slow EMAs, providing insight into market momentum. This setup allows the strategy to distinguish between bullish and bearish phases, which are vital for ensuring that trades align with the prevailing trend.

The populate_entry_trend method evaluates buy conditions based on the EWO and the relationship between the close price and the moving average offsets. For each moving average type (e.g., SMA or EMA), a buy signal is considered if the closing price is below the buy threshold and the EWO is within specified high and low bounds. This configuration indicates that the strategy looks for “value zones” where price dips below the moving average but momentum conditions remain favorable.
The exit conditions in populate_exit_trend mirror the entry logic but reverse the criteria. The closing price must exceed the sell threshold of the designated moving average type to trigger a sell. This setup ensures that profits are locked in once prices achieve a certain threshold relative to the moving average, allowing the strategy to capitalize on upward price moves without exposing the position to unnecessary risks.
SMAOffsetOptV1
The SMAOffsetOptV1 strategy that is also supposed to work on the 5 minute timeframe introduces further refinement to the offset-based approach, leveraging moving average configurations to optimize entry and exit points. This version builds on the SMA offset strategies, with additional parameters and improved flexibility. Here’s a look at the different sections of this strategy.
This strategy takes a slightly more structured approach to return on investment (ROI) management. Unlike the previous versions, it has a tiered ROI structure, beginning with a target of 10% for immediate exits, gradually reducing over specific intervals. This structure shows that the strategy aims to capitalize on quick gains when possible but allows trades to run longer with a lower ROI if needed. The ROI schedule includes intervals at 0, 60, 90, and 220 minutes.

For stop-loss, the strategy is set to allow for a -50% loss, maintaining a high tolerance for price fluctuations. This deep stop-loss setting suggests it’s geared towards experienced traders who can handle such risk exposure.
Unlike the other SMA offset strategies analyzed, the SMAOffsetOptV1 strategy includes a trailing stop-loss mechanism. This feature allows the strategy to dynamically adjust its stop-loss level as the trade moves favorably, securing profits while still allowing room for the price to continue rising. This trailing stop provides an extra layer of protection, helping to lock in gains when the price trends positively. However a trailing stop-loss can also skew the backtest results positively or negatively so any comparisons with the previous two versions should be made with this remark in the back of your mind.
In the populate_indicators method, the SMAOffsetOptV1 strategy employs both SMA (Simple Moving Average) and EMA (Exponential Moving Average) to create its primary indicators. Each of these moving averages is adjusted with “offsets,” which are tailored thresholds for identifying buying and selling conditions. The low offset is applied for buy conditions, creating a discounted price threshold, while the high offset applies to sell conditions, setting a premium price level.

The populate_entry_trend method defines entry signals based on the close price in relation to the buy offset of the selected moving average type. For example, if SMA is selected as the buy_trigger, the strategy evaluates whether the closing price dips below the buy offset threshold, indicating a potential value entry point. Additionally, volume checks ensure sufficient liquidity, and the Elliott Wave Oscillator thresholds might be used to confirm the momentum phase.
The exit logic in populate_exit_trend mirrors the entry structure but reverses the conditions. Here, the closing price needs to exceed the designated sell offset for the moving average type specified in sell_trigger, prompting an exit when the price reaches a desirable level.
SMAOffsetProtectOptV1_973
The SMAOffsetProtectOptV1_973 strategy builds on the SMA offset methodology with enhanced buy and sell conditions, coupled with additional protective parameters.
This 5 minute timeframe trading strategy adopts a minimal ROI schedule with two defined targets: a 2% profit threshold for immediate exits and a reduced 1% target after 180 minutes. This approach suggests that the strategy is optimized to secure smaller gains quickly but allows trades to extend if market conditions require. Such a configuration indicates that the strategy aims to capture short-term gains within a manageable risk framework.

For stop-loss, the strategy remains consistent with other SMAOffset configurations, allowing for a maximum loss of -50%. This deep stop-loss threshold allows the strategy to absorb considerable volatility, implying a degree of confidence in its recovery potential. However, this also signals the need for careful risk management, particularly regarding position sizing.
No trailing stop-loss is configured and this strategy relies only on fixed ROI and stop-loss parameters.
The populate_indicators method incorporates a blend of moving averages and the Elliott Wave Oscillator (EWO) to assess market momentum. The strategy primarily uses the Simple Moving Average (SMA) with adjustable offsets: a low offset for buy signals and a high offset for sell signals. These offsets dynamically adjust the thresholds based on the specific market conditions, allowing the strategy to react flexibly to price changes.
Both the EWO and RSI are also configured as additional indicators to base trading signals on.

In addition to the offset-based moving averages and EWO for buy conditions, SMAOffsetProtectOptV1_973 includes the RSI to refine its entry points. Specifically, the strategy requires the RSI to be above a certain threshold before entering a trade, suggesting that it seeks to confirm buying interest and positive momentum in the asset. This RSI condition helps filter out trades during oversold or weak market conditions, ensuring that entries are more likely to align with upward momentum.
While the primary sell conditions rely on the high offset threshold of the SMA and EWO to trigger exits, it appears the strategy does not explicitly use the RSI in the exit conditions. The absence of RSI in the exit criteria keeps the sell decision focused on reaching profit thresholds or favorable price conditions without further filtering, likely aiming to streamline the exit process.
Similarities and Differences
Over all these algorithms I found the following similarities and differences. Especially these differences will play a part in the differences these algorithms will have in the backtest results.
Similarities
Offset-Based Moving Averages: All strategies leverage offset-adjusted moving averages, such as SMA or EMA, to set dynamic thresholds for entry and exit points. By adjusting buy and sell thresholds with offsets, these strategies aim to capture entry opportunities at discounted prices and take profits at premium levels.
Momentum Indicator (EWO): Each strategy uses the Elliott Wave Oscillator (EWO) as a key momentum indicator to determine the general trend. The EWO helps differentiate between bullish and bearish market phases, filtering trades based on momentum alignment with the offset-based entries.
Fixed Stop-Loss: A fixed stop-loss set at -50% is consistent across all strategies, allowing substantial price fluctuation tolerance. This configuration shows confidence in each strategy’s recovery potential during adverse price swings.
Primary Objective of Quick Gains: The ROI configurations suggest that each strategy aims to capture quick, modest gains. While some use tiered ROI targets, the general focus is on frequent small wins rather than long-term holding.
Differences
Trailing Stop-Loss:
RSI Usage:
SMAOffsetProtectOptV1_973 adds an RSI-based condition for entries, requiring the RSI to be above a certain threshold. This extra filter helps confirm bullish momentum before entering trades, making it slightly more selective than the others.
The other strategies, such as MultiOffsetLamboV0 and SMAOffsetOptV1, do not include RSI, focusing on EWO and moving averages for momentum and trend confirmation.
ROI Structure:
SMAOffsetOptV1 includes a tiered ROI table with varying profit targets over time, suggesting it’s optimized for various market scenarios by allowing trades to run longer if immediate profit targets aren’t met.
Other strategies, like SMAOffsetProtectOptV1_973, have simpler ROI setups with fewer intervals, focusing more on capturing quick profits.
Protective Parameters:
SMAOffsetProtectOptV1_973 integrates additional protective parameters, using tighter EWO and RSI thresholds to manage entries, emphasizing risk management. In contrast, MultiOffsetLamboV0 and SMAOffsetOptV1 prioritize offset adjustments for managing entries and exits without as many additional filters.
In essence, the buy and sell rules across these strategies share a common foundation in offset-based thresholds and momentum checks via EWO. However, SMAOffsetProtectOptV1_973 distinguishes itself with RSI integration and additional protections, whereas SMAOffsetOptV1 introduces a trailing stop and a detailed ROI scheme for flexible exits. This makes each strategy unique in balancing entry and exit precision with adaptability to market conditions.
Now that we know all this, how will this reflect in the backtest results of these algorithms. Will they have somewhat similar results or will they perform completely differently?
Backtest results
MultiOffsetLamboV0

This strategy achieved an impressive end balance of 13,670.25 with a profit percentage of 1,267.02% over the backtest period. This high profitability suggests that the 30-minute timeframe effectively captures market trends with favorable entry and exit points. With a win rate of 89.24% across 3,541 trades, the strategy demonstrates a robust ability to identify profitable trades on this timeframe. The high win rate combined with a significant number of trades shows both reliability and consistency in trade signals. This balance suggests that the 30-minute timeframe allows the strategy to identify profitable setups regularly without excessive false positives, a critical factor for sustainable growth.
The maximum winning streak was 71 trades, the maximum losing streak was only 10 trades with an average of 2, demonstrating effective loss control.
A CAGR of 0.92 underscores steady long-term growth on this timeframe. Combined with a maximum drawdown of 10.38%. This moderate drawdown helps limit risk exposure, particularly for traders looking for reliable returns without the stress of significant equity declines.
The Calmar Ratio (8.88), Sortino Ratio (2.93), and Sharpe Ratio (6.25) all point to an outstanding risk-adjusted return profile. The high Calmar Ratio reflects minimal drawdown relative to return, while the Sharpe and Sortino ratios suggest that the strategy achieves returns well above the level of risk, particularly during volatile periods.

This plot provides a layered view of the MultiOffsetLamboV0 strategy's performance over time on the 30-minute timeframe, showcasing cumulative profit, weekly profit/loss, and drawdown data.
The cumulative profit line shows a steady and substantial upward trend throughout the backtest period, particularly accelerating during the 2021 bull market. After the market peak, cumulative profits continue to grow but at a slower rate.
During the 2021 bull market, we observe a consistent and intense series of green bars, indicating frequent profitable weeks that contribute to the rapid rise in cumulative profit. But after 2021, there is a notable increase in red bars, representing weekly losses, although they are typically smaller in magnitude compared to the gains seen during the bull market. This suggests that the strategy faced increased challenges in the post-peak market but still managed to achieve a net profit.
The bottom plot illustrates the drawdown percentage, with the blue dashed line marking the average drawdown of -1.50%.
During stable periods, the drawdown stays close to the average level, rarely exceeding -5%. However, around early 2021 and during periods following the bull market top, we observe some pronounced drawdowns reaching depths of nearly -17%. Despite these dips, the strategy's drawdown generally remains under control, recovering to manageable levels without sustained deep declines.

SMAOffsetProtectOptV0

The 5-minute timeframe for the SMAOffsetProtectOptV0 strategy shows also strong performance across several key metrics. With an end balance of 5,240.69 and a profit of 424.07%, this timeframe achieves good growth, although not as good as its own 30 minute timeframe and that of the Lambo version.
An impressive 88.60% win rate demonstrates the strategy’s consistency on this timeframe. Out of 2,202 trades, a high majority were profitable, suggesting strong signal accuracy. The maximum drawdown of 4.48% is relatively low, reflecting effective risk management. The Calmar Ratio (16.45), Sortino Ratio (4.52), and Sharpe Ratio (7.80) all show excellent risk-adjusted returns, highlighting the strategy's robustness in balancing profit and risk.
With a profit factor of 2.39, the 5-minute timeframe sees profitable trades significantly outweigh losses, reinforcing its effectiveness.

The cumulative profit line shows a strong and consistent upward trajectory throughout most of the backtest period, particularly accelerating during the 2021 bull market period, marked by the dashed line. After the market peak, profit growth plateaus slightly, indicating reduced profitability or fewer trade opportunities in the post-bull period.
The cumulative wins (green line) closely follow the cumulative profit, indicating that most of the strategy’s profit comes from frequent winning trades. This correlation between the two lines highlights the strategy’s high win rate, where the majority of trades yield profits, leading to steady growth in cumulative wins and consistent gains.
During the 2021 bull market period, both cumulative wins and cumulative profit increase rapidly, showing that the strategy capitalizes well on strong uptrends. Post-bull market, the growth in both metrics slows, reflecting a more challenging environment but without significant setbacks. This indicates that the strategy is capable of adapting to varying market conditions, though it thrives most during strong upward trends.

SMAOffsetOptV1

For the SMAOffsetOptV1 strategy, the 5-minute timeframe emerges as the best-performing option. It achieves an end balance of 4,406.28 with a profit percentage of 340.63%, indicating strong growth. This profit percentage is significantly higher than other timeframes, showing the strategy’s effectiveness in capturing gains within short intervals.
With a win rate of 74.67% across 833 trades, the strategy demonstrates solid trade accuracy, albeit lower than some other strategies I've reviewed. Nevertheless, this win rate supports consistent profitability at a high trading frequency.
The maximum winning streak is 29 trades, with an average of 5. Meanwhile, the maximum losing streak is 7 trades, with an average of 2. This streak pattern suggests a reasonable balance between winning and losing sequences, contributing to stable returns over time.
The maximum drawdown of 9.19% is moderate, suggesting effective risk control. The Calmar Ratio (6.95), Sortino Ratio (4.51), and Sharpe Ratio (5.15) indicate strong risk-adjusted performance, affirming that the strategy provides high returns relative to its volatility and downside risk.
The profit factor of 2.68 further emphasizes the strategy’s profitability, as it reflects that winning trades significantly outweigh the losses in terms of value.

The cumulative profit line shows strong growth in early stages, particularly during the 2020-2021 period, where profits rise sharply. However, several plateau phases appear where cumulative profit flattens, indicating periods of minimal or no growth. These plateaus indicate that while SMAOffsetOptV1 is effective during certain market phases, it may lack adaptability to continuously extract gains during sideway or choppy market conditions.
The cumulative wins line follows a similar pattern to the profit line, with rapid growth in the early period followed by flattening in later stages. This suggests that fewer winning trades occur during plateau periods, further underscoring the strategy’s challenges in adapting to certain market cycles where strong trend signals are absent.
The cumulative losses line shows a gradual increase over time but with fewer spikes, indicating that while losses occur, they are generally small and spread out. The cumulative draws line is almost flat, suggesting that most trades reach a clear outcome, either winning or losing.

SMAOffsetProtectOptV1_973

For the SMAOffsetProtectOptV1 strategy, the 30-minute timeframe stands out as the best performer across various metrics.
The algorithm achieves an end balance of 49,287.14 with an impressive profit percentage of 4828.71%. This is by far the highest profit level across all tested timeframes, indicating that this configuration is highly effective in generating returns.
With a win rate of 86.65% and 4,321 trades executed, the strategy demonstrates both accuracy and consistency. A high win rate at such a large volume of trades shows that the strategy is both reliable and active, capitalizing on numerous profitable opportunities.
The maximum winning streak is 87 trades with an average of 10, while the maximum losing streak is 9, with an average of 2. This balance indicates the strategy’s capability to maintain long stretches of profitable trades while keeping losses controlled.
The CAGR of 1.65 shows exceptional growth potential. Combined with a maximum drawdown of 15.19%, the drawdown remains manageable relative to the high returns, indicating effective risk management that doesn’t compromise profitability.
The profit factor of 2.12 confirms that winning trades considerably outweigh losses in terms of magnitude. A Total Score of 467 further highlights the superiority of the 30-minute timeframe, as it is the highest among all configurations.

This plot provides an overview of the SMAOffsetProtectOptV1 strategy's performance on the 30-minute timeframe, highlighting cumulative profit, weekly profit/loss, and drawdown.
The cumulative profit line shows strong upward growth throughout the backtest period, with especially rapid profit accumulation during the 2021 bull market period, indicated by the dashed vertical line. After the peak of the bull market, the growth rate continues but at a steadier pace. This steady rise in cumulative profit beyond the bull peak highlights the strategy's adaptability, allowing it to generate returns consistently even when market conditions change.
The green bars represent profitable weeks, with larger spikes during the bull market period in 2021. This period reflects the strategy's ability to capitalize on strong uptrends, as evidenced by the frequent and high weekly profits. The red bars show weeks with losses. The strategy experiences occasional large losses even during profitable periods, particularly in high-volatility phases. The losses, however, appear controlled in magnitude, and the strategy’s resilience is evident as it recovers quickly, maintaining its cumulative profit trajectory.
The bottom plot shows the drawdown percentage, with a blue dashed line marking the average drawdown of -2.58%.
During the bull market period, drawdowns are relatively mild, rarely exceeding 5%. However, we observe deeper drawdowns both before and after the bull market. The largest drawdowns reach nearly -20% during turbulent periods, reflecting heightened volatility or market corrections where the strategy may experience difficulty in aligning with price movements. After the bull market, drawdowns become more frequent and slightly deeper, suggesting a challenging environment where the strategy’s performance varies. However, it generally stays around the average level, showing resilience by avoiding prolonged or deep equity declines.

Conclusion
Based on this analysis, the best strategy is the SMAOffsetProtectOptV1 on the 30-minute timeframe. This strategy demonstrated the highest profitability, with a remarkable 4828.71% profit, a high win rate of 86.65%, and excellent risk-adjusted returns, shown by its strong Calmar, Sortino, and Sharpe ratios. It effectively balances profit potential and risk, adapting well across different market conditions. The 30-minute timeframe optimizes both trade frequency and profitability, making it a robust choice for consistent, substantial gains.
The MultiOffsetLamboV0 strategy, particularly on the 30-minute timeframe, stands out as a strong second-best choice. With a profit of 1267.02% and a high win rate of 89.24%, this strategy excels in capturing frequent, smaller gains, showcasing both consistency and reliability. It features a moderate drawdown of 10.38% and solid risk-adjusted metrics (Sharpe Ratio of 6.25), making it well-suited for traders looking for steady growth with controlled risk. While it doesn’t reach the extreme profitability of the SMAOffsetProtectOptV1 on the 30-minute timeframe, it performs admirably with a lower risk profile, offering a solid alternative for traders who prefer frequent, smaller trades over longer holding periods.
Now please remember that these tests are executed on my personal environment and that these results are not guaranteed to exist on your environment too. I only show some of the potential of these rather simple strategies and its up to you to do further investigation on your own setup and preferred pairs.
So please DYOR and do dry runs before putting your actual money on the line.
Thank you for following this in-depth analysis! I hope this breakdown helps you in selecting the right strategy for your trading goals.
Until next time, happy trading and stay profitable in this bull market!
Goodbye
2024-11-15 15:33:23 +0000 UTC
View Post

In this post I want to give a glimpse of my future plans. But first a look back on the stuff I did lately.
My Ebook
It's been a while since I did an analysis of a trading algorithm to see if it is worth our time to investigate further for algotrading. For those who missed the last posts, I was very busy finishing my ebook about algotrading for beginners Available on amazon (bit.ly/DCD_Ebook1) and here on Patreon with a discount for Patrons.

Links to videos and posts in Strategy League
I also invested much of my time into creating an overview of the Strategy League including the videos and posts on Patreon about these posts (https://www.dutchalgotrading.com/strategy-league/). This way you have an overview of all the strategies including their respective resources. I hope this will be of considerable convenience for you.

New plots for performance analysis
Last, but not least, I also developed some additional plots for the strategy performance analysis and altered some original plots so that they are more informative. Some of these newer plots are experimental and their usefulness has yet to be discovered. But I hope that you will like them, nonetheless.

Running behind on schedule
All this other work resulted in running behind on my schedule to post a strategy analysis weekly. It also happens to be that I'm running low on (actually working) third party algorithms to try out. Therefore, I decided to make a final sprint to the end of this year and will only make posts that contain the (working) algorithms I once downloaded from the Internet. Most of these are also variations or evolutions of an algorithm that was tested in the past and that I have posted about earlier. I think that creating a separate post of each and every variation of mainly the same algorithm will not add something new to this blog. The underlying principles are basically the same, only the end result will be different (hopefully better).
So, in the upcoming posts you can expect the outputs of the tests I did with analysis of the end results, but I will keep explaining the strategies to mainly the rules of the algorithm and keep the deep dives to a minimum.
And for 2025..?
My current plans for 2025 are to do more tests of strategies that are presented on Youtube (and not so much of these pre-programmed ‘black box’ algorithms anymore) and finally the video on the practical implementation and usage of FreqAI. I postponed that one for much too long because of time restrictions :-s
Hopefully I can provide you with the content you need in the future too and will keep you posted on more developments.
Many thanks for being a Patron!
Goodbye.
2024-11-11 16:58:22 +0000 UTC
View Post
The good news keeps on coming today.
I also have adjusted the strategy league on my website https://www.dutchalgotrading.com/strategy-league/ so that it includes all the trading strategy video's and the Patreon posts that contain the files. So if you think about testing one algorithm, then now the video AND the post are at your serving.
Good luck trading the upcoming BULL MARKET!
:-)
2024-11-08 22:18:07 +0000 UTC
View Post
Today I am proud to announce the launch of my new eBook about Algorithmic Cryptocurrency Trading For Beginners: A Comprehensive Guide to Start With Automated Trading. I have worked over a year to create this book and I am finally finished.
This book contains all the information you will need to start Trading Cryptocurrency with Algorithms and eventually with a trading bot. The contents of the book are written below.
This book aims to be a source of information for starting Algorithmic Traders in Cryptocurrency that also want to use a trading bot (although the information also can be applied to normal trading too) and currently fills a gap that I personally missed over the years in my journey. I hope that this will be a solid foundation for those that are just starting, or are looking for a single source of information about this interesting and profitable field of interest.
The book is initially published as a Amazon Kindle ebook. However for Patrons I also have this book available as a exclusive downloadable PDF that is not only permanently cheaper here, but it also has a temporary extra 20% discount (Code: FIRSTBOOK). As a thank you for your continuing support!
CONTENTS
Foreword………………………………………………………………………………… i
Introduction…………………………………………………………………………. iii
1 – Introduction to the World of Algorithmic Cryptocurrency Trading……………………………………………………………………………………. 1
Introduction to Algorithmic Trading………………………………………………. 1
The Evolution and Rise of Algorithmic Trading in Cryptocurrency………….. 2
Why Algorithmic Trading is Ideal for Cryptocurrencies……………………….. 3
Handling the Volatility…………………………………………………………….. 3
Trading 24/7 Without Losing Sleep……………………………………………… 3
Making Data-Driven Decisions………………………………………………….. 4
Flexibility and Customization……………………………………………………. 4
Taking the Emotions Out of Trading…………………………………………….. 4
2 – Understanding Cryptocurrency – The Foundation of Digital Trading……………………………………………………………………………………. 5
What is Cryptocurrency?…………………………………………………………….. 5
The Birth and Evolution of Cryptocurrency……………………………………… 5
Blockchain Technology – The Backbone of Cryptocurrency………………….. 7
The Advantages of Cryptocurrency Over Traditional Money………………….. 8
Decentralization and Control……………………………………………………. 8
Security and Transparency……………………………………………………….. 8
Lower Transaction Costs…………………………………………………………. 9
Accessibility…………………………………………………………………………. 9
Innovation and Flexibility…………………………………………………………. 9
Key Cryptocurrencies You Should Know About…………………………………. 9
Bitcoin (BTC)………………………………………………………………………. 10
Ethereum (ETH)…………………………………………………………………… 10
Ripple (XRP)……………………………………………………………………….. 10
Litecoin (LTC)……………………………………………………………………… 10
Cardano (ADA)……………………………………………………………………. 11
Polkadot (DOT)……………………………………………………………………. 11
Binance Coin (BNB)……………………………………………………………… 11
Solana (SOL)………………………………………………………………………. 11
Dogecoin (DOGE)…………………………………………………………………. 11
Tether (USDT)……………………………………………………………………… 12
USD Coin (USDC)…………………………………………………………………. 12
Understanding the Categories of Cryptocurrencies………………………….. 12
Currencies…………………………………………………………………………. 13
Smart Contract Platforms (Layer 1)…………………………………………… 13
Layer 2 Solutions…………………………………………………………………. 13
Stablecoins………………………………………………………………………… 13
Decentralized Finance (DeFi) Tokens…………………………………………. 13
Utility Tokens………………………………………………………………………. 14
Governance Tokens………………………………………………………………. 14
Privacy Coins……………………………………………………………………… 14
Meme Coins……………………………………………………………………….. 14
Non-Fungible Tokens (NFTs)……………………………………………………. 14
Real-World Asset Tokens (RWAs)……………………………………………… 15
AI Coins…………………………………………………………………………….. 15
Gaming Coins……………………………………………………………………… 15
3 – What is Algorithmic Trading?…………………………………………….. 17
The Evolution of Algorithmic Trading……………………………………………. 19
The Early Days – From Manual to Automated Trading……………………… 19
The Rise of High-Frequency Trading (HFT)…………………………………… 20
The Advent of Algorithmic Trading in Cryptocurrency……………………… 20
The Democratization of Algorithmic Trading………………………………… 21
The Continuing Evolution……………………………………………………….. 22
Key Concepts in Algorithmic Trading…………………………………………….. 22
Trading Indicators – The Foundation of Algorithmic Strategies…………… 22
Categorization of Trading Indicators………………………………………….. 24
The Role of Artificial Intelligence (AI) in Algorithmic Trading………………. 28
AI-Powered Trading Models…………………………………………………….. 28
Sentiment Analysis………………………………………………………………. 28
Reinforcement Learning………………………………………………………… 28
Automated Risk Management………………………………………………….. 28
Algorithmic Market Making……………………………………………………… 28
Trading Signals – Triggers for Action……………………………………………. 29
Backtesting and Forward Testing – Validating Your Strategy………………. 30
Common Algorithmic Trading Strategies………………………………………… 31
Trend-Following Strategies – Riding the Wave……………………………….. 31
Mean-Reversion Strategies – Betting on a Return to the Average………… 33
Arbitrage Strategies – Exploiting Price Discrepancies……………………… 34
Market-Making Strategies – Providing Liquidity……………………………… 36
Choosing the Right Strategy……………………………………………………. 38
The Tools and Software for Algorithmic Trading……………………………… 38
Trading Platforms and APIs – Your Gateway to the Market………………… 39
CCXT Python Library – A Universal API for Cryptocurrency Exchanges…. 40
Coding Environments – Where Algorithms Come to Life………………….. 42
Backtesting Tools – Validating Your Strategies………………………………. 45
Popular Backtesting Tools for Algorithmic Trading…………………………. 46
Data Providers: The Lifeblood of Algorithmic Trading……………………… 47
Equipping Yourself for Success………………………………………………… 48
The Role of Data in Algorithmic Trading…………………………………………. 48
Types of Data Used in Algorithmic Trading…………………………………… 48
Data Collection – Gathering the Right Information…………………………. 51
Data Quality – The Foundation of Accurate Analysis……………………….. 52
Data Analysis – Turning Raw Data into Actionable Insights……………….. 53
Challenges in Data Collection and Analysis………………………………… 55
Leveraging Data for Competitive Advantage………………………………… 56
Mastering Data for Successful Trading……………………………………….. 57
Challenges and Risks of Algorithmic Trading………………………………….. 57
Overfitting – The Pitfall of Overly Tailored Algorithms………………………. 58
Latency – The Hidden Risk of Delayed Execution…………………………… 59
Market Impact – Balancing Order Size and Market Stability………………. 60
Continuous Monitoring and Optimization – The Key to Long-Term Success……………………………………………………………………………………….. 61
Navigating the Complexities of Algorithmic Trading……………………….. 62
4 – Risk Management and Bias in Trading…………………………………. 63
What is Risk Management?…………………………………………………….. 63
Importance of Risk Management in Algorithmic Trading………………….. 63
The Role of Risk Management in Trading Success………………………………. 64
Types of Risks in Algorithmic Trading…………………………………………….. 65
Market Risk………………………………………………………………………… 66
Liquidity Risk………………………………………………………………………. 67
Execution Risk…………………………………………………………………….. 67
Systemic Risk……………………………………………………………………… 67
Technology and Operational Risk……………………………………………… 68
Counterparty Risk………………………………………………………………… 69
Core Principles of Risk Management in Algorithmic Trading………………… 69
Position Sizing and Leverage Control…………………………………………. 70
Risk-Reward Ratios and Setting Profit Targets………………………………. 70
Stop Losses and Take Profits…………………………………………………… 71
Diversification and Hedging…………………………………………………….. 71
Risk Allocation Across Strategies……………………………………………… 72
Quantitative Approaches to Risk Management…………………………………… 72
Volatility Management…………………………………………………………… 72
Value at Risk (VaR)……………………………………………………………….. 73
Drawdown Control and Maximum Loss Limits……………………………… 73
Sharpe Ratio and Risk-Adjusted Returns…………………………………….. 74
Monte Carlo Simulations and Scenario Analysis…………………………… 74
Risk Management Tools and Technologies………………………………………. 75
Developing and Implementing a Risk Management Plan………………………… 75
Designing a Risk Management Strategy for Your Algorithm………………. 75
Integrating Risk Management into Algorithm Development………………. 76
Risk Monitoring and Adjustments……………………………………………… 76
Disaster Recovery and Contingency Planning………………………………. 77
Psychological Aspects of Risk Management…………………………………….. 78
Understanding Risk Tolerance and Trader Psychology…………………….. 78
The Impact of Overconfidence and Fear on Risk…………………………… 78
Consistency and Discipline in Risk Management………………………….. 79
Understanding Biases in Algorithmic Trading………………………………….. 80
Confirmation Bias………………………………………………………………… 80
Survivorship Bias…………………………………………………………………. 80
Lookahead Bias…………………………………………………………………… 81
Overfitting………………………………………………………………………….. 81
Anchoring Bias……………………………………………………………………. 81
Recency Bias………………………………………………………………………. 81
Hindsight Bias…………………………………………………………………….. 82
Loss Aversion……………………………………………………………………… 82
Herding Bias……………………………………………………………………….. 82
Availability Bias…………………………………………………………………… 83
Self-Attribution Bias……………………………………………………………… 83
Endowment Effect……………………………………………………………….. 83
Disposition Effect…………………………………………………………………. 84
Gambler’s Fallacy………………………………………………………………… 84
Framing Effect…………………………………………………………………….. 84
Sunk Cost Fallacy………………………………………………………………… 84
Embracing Risk Management as an Ongoing Process………………………….. 85
Why Risk Management is Essential…………………………………………… 85
Encouragement to Continuously Review and Adapt Risk Management.. 85
5 – Creating your Algorithmic Trading Bot…………………………….. 87
Creating your own cloud based server………………………………………….. 87
Creating a Cloud Service Provider account…………………………………. 87
Finding out the location of the Exchange…………………………………….. 89
Creating your own Cloud server……………………………………………….. 90
Connecting to the server through SSH……………………………………….. 95
Securing the server………………………………………………………………… 100
Changing the hostname……………………………………………………….. 100
Create normal user and disable root user………………………………….. 101
Install and configure a firewall……………………………………………….. 105
Hardening the SSH server…………………………………………………….. 107
Update the system……………………………………………………………… 110
Enabling automatic updates………………………………………………….. 112
Configure the timeserver………………………………………………………. 113
Installing the trading bot…………………………………………………………. 116
Introduction to Freqtrade……………………………………………………… 116
Key Features of Freqtrade…………………………………………………….. 117
Why Freqtrade is Ideal for Beginners………………………………………… 117
Caveats of using Freqtrade……………………………………………………. 118
Installing Freqtrade: A Step-by-Step Guide (Linux)……………………….. 119
Installing Freqtrade: A Step-by-Step Guide (Docker – on Linux)……….. 128
Post-Installation Activities……………………………………………………….. 132
Activity 1 – Pairslists…………………………………………………………….. 132
Activity 2 – Downloading data…………………………………………………. 136
Other Post-Installation Activities…………………………………………….. 139
Understanding the Freqtrade Configuration…………………………………. 140
Breakdown of Freqtrade’s Sample Strategy…………………………………… 150
Freqtrade as a Systemd Service…………………………………………………… 167
Modifying the config.json File…………………………………………………. 167
Creating the freqtrade.service File…………………………………………… 169
Enabling Freqtrade as a Service……………………………………………… 170
Freqtrade as a Docker Service…………………………………………………… 173
Multi-Bot Orchestration………………………………………………………….. 177
Multi-Bot Orchestration with Systemd……………………………………… 177
Multi-Bot Orchestration with Docker………………………………………… 178
Monitoring and Maintaining Your Freqtrade Bot…………………………….. 180
Monitoring Your Bot’s logs…………………………………………………….. 180
Troubleshooting Common Issues……………………………………………. 181
Setting Up Maintenance Routines…………………………………………… 181
6 – Strategy Development and Coding…………………………………… 183
The Creative Process of Developing a New Trading Algorithm…………….. 183
Writing the Rules of the Trade…………………………………………………… 184
Creating a Swing Trade Strategy…………………………………………………. 185
Technical Indicators……………………………………………………………. 185
Entry Rules (Buying Signals)…………………………………………………… 186
Exit Rules (Selling Signals)…………………………………………………….. 187
Stop Loss Settings………………………………………………………………. 188
Overall Strategy Summary…………………………………………………….. 189
Creating a Freqtrade Strategy File………………………………………………. 189
Making a copy of the sample file…………………………………………….. 189
Strategy file edits………………………………………………………………… 193
Adding Hyperparameter Optimization Settings………………………………… 200
7 – Backtesting, Analysis, Optimization and Forward Testing… 206
Introduction to testing and analyzing………………………………………….. 206
Setting Up Backtesting in Freqtrade…………………………………………….. 206
Backtesting Your Strategy with Freqtrade…………………………………….. 207
Checking the Data and Strategies…………………………………………… 207
Executing a Simple Backtest………………………………………………….. 209
Getting Your First Backtest Output………………………………………….. 214
Other Useful Backtest Command Options………………………………… 218
Analyzing Your Trading Strategies: Key Metrics to Watch………………….. 221
Visualizing Backtest Data with the Bot Software……………………………… 230
Freqtrade Plotting functions………………………………………………….. 230
Other Visualisation Suggestions………………………………………………… 236
Equity Curves……………………………………………………………………. 236
Drawdown Charts………………………………………………………………. 237
Combining Visualizations……………………………………………………… 237
Performance Heatmaps……………………………………………………….. 238
Distribution of Returns…………………………………………………………. 239
Rolling Volatility…………………………………………………………………. 240
Rolling Risk Ratio’s……………………………………………………………… 240
Interpreting Visualizations…………………………………………………….. 241
Optimization and Continuous Improvement Through Backtesting…………. 241
Hyperparameter optimization………………………………………………… 241
The Usage of Spaces in Hyperopt……………………………………………. 242
How do We Measure Optimization “Success”…………………………….. 243
Running Hyperparameter Optimization…………………………………….. 244
Comparing the Optimized Results…………………………………………… 251
Common Backtesting Mistakes and How to Avoid Them………………………. 252
Data Snooping Bias…………………………………………………………….. 252
Overfitting………………………………………………………………………… 253
Ignoring Transaction Costs……………………………………………………. 253
Inadequate Data Quality and Coverage…………………………………….. 254
Ignoring Market Regimes………………………………………………………. 254
Small Sample Sizes…………………………………………………………….. 254
Forward testing…………………………………………………………………….. 255
Fail Fast, Fail Often………………………………………………………………… 257
8 – Comparing and Evaluating Multiple Trading Strategies……. 259
The Importance of Strategy Comparison……………………………………….. 259
Determining Your Scoring Criteria……………………………………………… 260
Using Freqtrade’s Backtest output……………………………………………… 260
Creating the Scoring System……………………………………………………… 261
Building a Spreadsheet for Strategy Comparison…………………………….. 261
Setting Up the Spreadsheet……………………………………………………….. 262
Implementing the Scoring System………………………………………………… 262
Calculating the Total Score……………………………………………………… 264
Timeframe comparison……………………………………………………………… 265
Analyzing and Interpreting the Results…………………………………………. 265
Comparing multiple trading strategies………………………………………….. 266
Taking the next step…………………………………………………………………. 267
Fine-Tuning and Adjusting the Scoring System………………………………… 267
9 – Connecting Your Trading Bot to an Exchange…………………. 269
Creating a subaccount…………………………………………………………….. 269
Creating the API key and secret on the sub account………………………….. 277
Entering the API key and secret in the configuration file……………………. 283
Set the bot’s runmode from Dry-run to Live……………………………………. 283
Starting the bot with the API key…………………………………………………. 284
Checking on the Freqtrade Web interface……………………………………… 284
10 – Legal, Ethical and Tax Considerations in Algorithmic Trading………………………………………………………………………………… 287
Understanding the Regulatory Environment………………………………….. 287
Ethical Implications of Automated Trading…………………………………….. 287
Best Practices for Compliance…………………………………………………… 288
Tax Implications of Algorithmic Trading……………………………………….. 289
11 – Future Trends and Continuous Learning in Algorithmic Trading………………………………………………………………………………… 292
Emerging Technologies in Trading………………………………………………. 292
Adapting to Market Evolution……………………………………………………. 293
The Importance of Continuous Learning……………………………………….. 293
Navigating the Regulatory Landscape………………………………………….. 294
Preparing for the Future of Algorithmic Trading…………………………….. 295
12 – Final Thoughts and Next Steps……………………………………….. 296
Recap of Key Takeaways……………………………………………………………. 296
Your Journey Continues…………………………………………………………… 298
More learning………………………………………………………………………. 299
Books on Algorithmic Trading and Cryptocurrency………………………. 299
Academic Papers on Algorithmic Trading………………………………….. 300
Websites and Online Resources…………………………………………….. 301
Books on Machine Learning and Data Science……………………………. 301
Thank You!…………………………………………………………………………… 302
About DutchCryptoDad…………………………………………………………… 302
Glossary of Key Terms………………………………………………………….. 305
Configuration files and other stuff……………………………………. 311
Obelisk_Ichimoku_ZEMA_v1 config file………………………………………… 311
cat config_bot1.json……………………………………………………………. 311
cat /etc/systemd/system/freqbot1.service………………………………… 312
ClucMay72018……………………………………………………………………… 313
cat config_bot2.json……………………………………………………………. 313
cat /etc/systemd/system/freqbot2.service………………………………… 315
Docker Compose file Bot 1……………………………………………………….. 315
/opt/freqbot1/user_data/config_freqbot.json……………………………… 316
Docker Compose file Bot 2……………………………………………………….. 318
/opt/freqbot2/user_data/config_freqbot.json……………………………… 318
SMA_MACD_RSI Strategy File……………………………………………………. 321
Adjusted SMA_MACD_RSI strategy for Hyperopt…………………………….. 331
2024-11-08 13:02:59 +0000 UTC
View Post
No posts or video's because i have a holiday. Nonetheless I am super stoked about a possible new all time high for Bitcoin. Also an update on a project I talked about a long time ago. I am almost finished with my ebook about algorihmic trading for beginners. It was not as easy as I thought. But I hope to get it finished before Christmas this year.
For now, enjoy the Halloween 2024 pump!
2024-10-29 18:41:10 +0000 UTC
View Post

Introduction
Hi everybody and welcome to a Patreon Exclusive blog post about a bunch of NFIX trading strategies I recently tested. Most of these were downloadable from multiple Github repositories and I tested them on my backtesting setup. With these tests I can compare the results with those of other strategy tests to see if they really make a difference.
Which versions
The versions I’d like to discuss in this post are the following:
Just like the SMA offset strategies, these variations and iterations of the same base NFIX strategy are numerous. It’s highly possible that in the future I will present you with other versions of this algorithm. As long as the results are worth mentioning I will come back to you with these possible future versions.
I will not go into the nitty gritty of the code of these algorithms, since I’ve discussed these a couple of times ago in the past. So if you want do a deeper dive into the inner workings of the NFIX code, then I recommend you to read these articles: https://www.patreon.com/posts/89663923 and https://www.patreon.com/posts/93961037
Besides that, keeping track of all these variations and changes is an almost impossible job and investigation in the inner workings of one of those versions is only recommended if you are really interested in exploiting the algorithm further.
Backtest results
So for now let’s discuss the end results of the versions mentioned above piece by piece.
Nostalgia
All the NFIX variations only work on the 5 minute timeframe and this version is no exception.

Already there is a good result that I can present with this version. An 2870 % profit with 86% win rate . 83% of the pairs I use in the backtest seem to like this trading strategy. Although the maximum drawdown of 25% is high, it still manages to attain high Sharpe, Sortino and Calmar ratios.

The algorithm reveals a steady increase in cumulative wins, showing that the strategy consistently generates profitable trades. Cumulative profit surged during the 2021 bull market but experienced volatility and a dip afterward, stabilizing at a slower pace. Despite this, cumulative losses remained low, indicating good capital preservation. The minimal number of draws suggests the strategy rarely results in indecisive trades. Overall, it performs well in bullish conditions but could benefit from better risk management during market corrections.
Early on, the drawdowns are minimal, remaining below 5% until mid-2021. After the bull market peak, drawdowns increase sharply, reaching over 20%, with the average drawdown sitting at around 9.76%. This indicates that the strategy struggled significantly during market corrections, highlighting the need for improved risk management to prevent such large declines in capital.

The win rate distribution shows a median close to 0.9, indicating a high probability of profitable trades, though some weeks dip as low as 40%. Meanwhile, the profit distribution highlights that most weeks deliver moderate profits, with a few extreme outliers (both positive and negative). While there are strong winning weeks, the presence of large losses suggests that the strategy could benefit from better risk controls to avoid significant drawdowns.

The comparison charts show that the Nostalgia strategy excels in total score and profit percentage, ranking highest among the strategies. However, it falls short in critical metrics like drawdown, and interestingly enough still Sharpe ratio, and Sortino ratio, indicating higher risk relative to returns. Other strategies, such as NFISMOHO_WIP and NASOSv4, outperform Nostalgia in terms of risk-adjusted returns (Sharpe, Sortino), profit factor, and drawdown. This suggests that while Nostalgia is highly profitable, it comes with significantly more volatility and risk than some of the other top strategies.

NostalgiaForInfinityNext
The NostalgiaForInfinityNext chart shows strong cumulative profit growth up until mid-2021, especially during the bull market, where weekly profits (green bars) are frequent and substantial. However, after the bull market peak, cumulative profit stabilizes, and weekly performance becomes more volatile with some losses (red bars) mixed in. Although profits continue, they are smaller and less consistent, indicating the strategy may struggle in less bullish or choppier market conditions. Overall, the strategy performs exceptionally well in a bull market but shows signs of instability during more challenging periods.

One remarkable aspect of these backtest results is the incredibly high win rate of 95.35%, which is highly unusual for most trading strategies. Additionally, the maximum winning streak of 340 trades highlights the strategy's consistency during favorable conditions. However, despite the strong performance, the maximum drawdown of 13.2% indicates that the strategy can still experience significant temporary losses (although not as much as the Nostalgia version), even though it maintains a solid profit factor of 2.08 and a high Calmar ratio of 13.85, showing good risk-adjusted returns.


Initially, drawdowns are minimal, staying below 2% until mid-2021. However, after the peak of the bull market, there are significant increases in drawdown, reaching over 8% at multiple points in 2022. The average drawdown of 2.67% is relatively low overall, but the sharp spikes during bearish or volatile periods highlight that the strategy struggles with risk management when market conditions worsen. This suggests the strategy is vulnerable to larger losses during market corrections or downturns and could benefit from more robust protective measures. In relation to the Nostalgia version it is still better performing.
This chart shows the drawdown analysis of the strategy over time. Initially, drawdowns are minimal, staying below 2% until mid-2021. However, after the peak of the bull market, there are significant increases in drawdown, reaching over 8% at multiple points in 2022. The average drawdown of 2.67% is relatively low overall, but the sharp spikes during bearish or volatile periods highlight that the strategy struggles with risk management when market conditions worsen. This suggests the strategy is vulnerable to larger losses during market corrections or downturns and could benefit from more robust protective measures.

The winrate distribution on the left shows that the strategy performs consistently well, with most weekly win rates hovering around 100%. However, there are a few outliers where the win rate drops significantly, even as low as 40%, indicating some periods of underperformance. The profit distribution on the right reveals that most weekly profits are clustered around modest levels, though there are occasional large profits and losses, as shown by the outliers. While the strategy generally delivers steady returns, these outliers suggest some risk of volatility in profits during certain weeks.

The NostalgiaForInfinityNext strategy outperforms other strategies across several key metrics. It ranks highest in profit factor, pairs with profit percentage, and win percentage, showcasing strong profitability and trade success. However, its drawdown is still relatively high compared to other strategies, indicating greater risk during market downturns. In terms of risk-adjusted returns, it has a lower Sharpe and Sortino ratio, in comparison to some other strategies, like NFISMOHO_WIP, perform better in these areas. While NostalgiaForInfinityNext shines in overall performance and trade execution, it could benefit from improvements in managing drawdowns and reducing risk.
NostalgiaForInfinityNextGen

The backtest results for the Nostalgiaforinfinitynextgen strategy show impressive performance metrics. The win rate is exceptionally high at 93.54%, indicating that most trades are successful. The strategy also has a solid profit factor of 3.08, meaning for every dollar risked, the return is more than triple, which is a strong risk-reward ratio. The maximum drawdown is 10.66%, which is somewhat high but still manageable given the high win rate and profitability. The strategy's Calmar ratio of 4.41 and Sharpe ratio of 3.66 demonstrate strong risk-adjusted returns, meaning the strategy performs well even when accounting for risk. With a total score of 307 and a high percentage of profitable pairs at 91.84%, the strategy shows broad applicability across different assets. Overall, it's a high-performing strategy with strong profitability and risk management, though it could benefit from reducing the drawdown further.

This chart shows a strong cumulative profit growth, especially before mid-2021, where both cumulative wins (green line) and profit (orange line) sharply increase. After the bull market top (yellow line), the growth stabilizes, with fewer significant gains but still positive. The number of cumulative losses (red line) remains low, indicating a high win-to-loss ratio. The flat lines post-2021 suggest the strategy is less effective during more volatile or bearish market conditions but still manages to preserve gains without major losses. Overall, this strategy performs well in bullish markets but slows down in more challenging conditions.
This drawdown chart shows that the NostalgiaForInfinityNextGen strategy maintains relatively low drawdowns throughout the tested period. The average drawdown is 0.64%, which is impressively low, indicating excellent risk management. There are some minor spikes in drawdown, particularly during mid-2021, which coincide with market volatility. However, none of these drawdowns exceed 1.75%, and the strategy quickly recovers. Overall, the strategy demonstrates a strong ability to limit losses, making it a stable option in both bullish and bearish market phases.


The NostalgiaForInfinityNextGen strategy stands out in most performance metrics. It leads in total score, profit percentage, and win percentage, demonstrating its dominance in profitability and successful trades. Its profit factor is also the highest, reflecting efficient risk-return management. In terms of risk, it maintains a lower drawdown compared to competing strategies, indicating better protection during losses. Additionally, its Calmar ratio and Sharpe ratio are competitive, showing strong risk-adjusted returns. However, other strategies, such as NFISMOHO_WIP, show slightly higher scores in CAGR and Sortino ratio, which suggests room for improvement in long-term performance and downside risk management. Overall, this strategy performs exceptionally well across most metrics.

NostalgiaForInfinityNextV7155

The Nostalgiaforinfinitynextv7155 strategy demonstrates a strong performance with a profit percentage of 1169.93% and an impressive win rate of 94.11%, reflecting consistent profitability. The maximum winning streak is 107 trades, and the average win streak is 19, showing excellent trading momentum. The maximum drawdown of 12.1% indicates moderate risk, which is well managed given the Calmar ratio of 11.01 and Sharpe ratio of 5.15, both highlighting solid risk-adjusted returns. The profit factor of 2.39 indicates strong profitability relative to losses. With a CAGR of 1.33, the strategy demonstrates steady long-term growth, making it a well-rounded approach with a balance of risk and reward.

This chart demonstrates strong cumulative performance for the NostalgiaForInfinityNextV7155 strategy. The cumulative wins (green line) show consistent growth, with a steep rise leading up to the 2021 bull market and stabilizing thereafter. The cumulative profit (orange line) mirrors this growth, showing rapid gains before mid-2021 and maintaining a steady increase post-bull market. The cumulative losses (red line) remain minimal, indicating very few losing trades, and there are virtually no draws (blue line). This suggests the strategy consistently generates profitable trades and manages risk effectively, even during more volatile market conditions following the peak in 2021. Overall, this strategy exhibits strong, stable growth with minimal losses.

This drawdown chart for the NostalgiaForInfinityNextV7155 strategy shows relatively low drawdowns for the first half of the period, remaining under 2% until mid-2021. After the bull market peak, the drawdowns become more frequent and severe, reaching above 8% at certain points. The average drawdown of 4.24% indicates that, while the strategy is generally effective at managing risk, it does experience more significant losses in volatile or bearish market conditions. The recovery from these drawdowns, particularly in late 2022, shows that the strategy can bounce back but may benefit from stronger risk management measures during market downturns.

This chart shows the win/loss ratio of the NostalgiaForInfinityNextV7155 strategy over time. The strategy experiences strong win/loss ratios during the 2020 to mid-2021 period, with several weeks reaching ratios above 30, indicating that winning trades significantly outnumber losses. After the 2021 bull market peak, there is a noticeable decline in the win/loss ratio, with more volatility and lower ratios. Despite this, the strategy still produces more winning weeks than losing ones, as indicated by the positive ratio spikes in 2022 and early 2023. Overall, the strategy demonstrates excellent performance during bullish market phases, though it becomes less dominant in post-bull market conditions, while still maintaining a favorable win/loss balance.

The win rate distribution on the left shows that the strategy has a strong and consistent performance, with most weekly win rates clustering between 80% and 100%. However, a few outliers dip below 60%, and one extreme outlier touches 0%, indicating some weeks of underperformance. On the right, the profit distribution shows that while the majority of weekly profits are moderate, there are several outliers where profits exceed 1000, as well as a few weeks with losses exceeding -400. This suggests that while the strategy is generally profitable, there are occasional weeks of significant volatility, both on the upside and downside.


NostalgiaForInfinityV6

The Nostalgiaforinfinityv6 strategy shows strong performance based on these backtest results. It has an impressive profit percentage of 2418.49% and a win rate of 82.37%, meaning that over 80% of trades are successful. With a maximum winning streak of 52 and an average of 8 wins per streak, the strategy consistently delivers profitable trades. The maximum drawdown is 7.12%, which is relatively low, indicating good risk management. The Calmar ratio of 27.07 and Sharpe ratio of 8.34 both suggest excellent risk-adjusted returns. Additionally, the profit factor of 2.48 further highlights the strategy's profitability, making it a high-performing option for generating consistent returns with controlled risk.

This chart shows a robust performance for the NostalgiaForInfinityV6 strategy. The cumulative wins (green line) rise sharply, particularly during the 2020 to mid-2021 period, reflecting a significant number of profitable trades. The cumulative profit (orange line) closely mirrors the win trajectory, with a rapid increase during the same period, indicating that the strategy capitalized well on market conditions. After the 2021 bull market peak (yellow line), the profit curve stabilizes but continues to grow steadily. The cumulative losses (red line) remain low and increase at a much slower pace compared to the wins, showing that the strategy avoids frequent or large losses. Overall, this strategy delivers consistent profits with limited downside, making it highly effective, particularly in bullish markets.

This drawdown chart for the NostalgiaForInfinityV6 strategy shows generally low levels of drawdown throughout most of the period. The average drawdown sits at a very modest 1.54%, indicating that losses are well-managed. There are only a few notable spikes, particularly in mid-2021 and again in late 2022, where drawdowns exceed 6%. Despite these occasional peaks, the strategy quickly recovers, and the drawdown levels remain low overall. The chart reflects that the strategy effectively limits significant losses, even during more volatile periods, making it a strong performer in risk management.

The win rate distribution for the NostalgiaForInfinityV6 strategy shows that most weekly win rates are concentrated between 70% and 100%, with a median around 80%, indicating a high probability of profitable trades. There are a few outliers where the win rate drops as low as 0%, but these are rare occurrences. The profit distribution reveals that while most weeks show moderate profits, there are several notable outliers where profits exceed 1000, demonstrating that the strategy can capture large gains during favorable market conditions. A few weeks exhibit losses, but these are generally limited, with only a couple of extreme outliers reaching losses around -1000. Overall, the strategy shows a strong and consistent win rate, with the potential for high profitability in certain weeks.

The NostalgiaForInfinityV6 strategy stands out in many key metrics compared to other top strategies. In terms of profit percentage and win percentage, it performs exceptionally well, showcasing its ability to generate profits and win a high percentage of trades. The drawdown is relatively low compared to other strategies, demonstrating effective risk management. The strategy also excels in risk-adjusted metrics, with top marks in Sortino ratio indicating that it delivers returns efficiently while minimizing risk. It also has the highest profit factor, meaning it generates strong returns relative to losses. Other strategies, like NFISMOHO_WIP, show slightly better CAGR, but overall, NostalgiaForInfinityV6 excels in profitability, risk control, and consistency.

Overall conclusion
Among the various NostalgiaForInfinity strategy variations you've tested and analyzed, the NostalgiaForInfinityV6 strategy appears to have the best potential for future profitable trades. Here's why:
Consistent Profitability: V6 shows an exceptional profit percentage (2418.49%) with a high win rate of 82.37%, which suggests it can deliver consistent profits. Its ability to win more than 80% of trades indicates it has a strong edge in the market.
Risk Management: The drawdown metrics for V6 are well-controlled. With an average drawdown of 1.54% and a maximum drawdown of just 7.12%, it effectively limits losses, even during volatile market conditions. This makes it a safer strategy, especially for long-term deployment.
Risk-Adjusted Returns: V6 outperforms other variations in critical risk-adjusted metrics like Calmar ratio (27.07), Sharpe ratio (8.34), and Sortino ratio (6.23). These figures suggest that V6 delivers strong returns without exposing the portfolio to excessive risk, making it highly efficient.
Profit Factor and Consistency: The profit factor of 2.48 means that for every dollar risked, the strategy earns $2.48. This high ratio highlights the profitability of V6 relative to the losses it incurs. Moreover, the strategy performs well consistently across different market conditions, as indicated by the pairs with profit percentage (87.76%), showing that it works well on a broad range of trading pairs.
Recovery and Resilience: Despite some occasional drawdown spikes, V6 shows the ability to quickly recover, as seen in its rapid recovery post-bull market in late 2021. This resilience is a crucial factor for sustained profitability in the unpredictable cryptocurrency markets.
Why V6 over Other Variants?
While other strategies like V7155 and NextGen show strong profit percentages and win rates, they tend to have higher drawdowns or exhibit more volatility in post-bull market conditions. The V6 variant strikes a better balance between high profitability, strong win rates, and exceptional risk management, making it more resilient across market conditions. Its superior risk-adjusted performance and controlled drawdown make it more likely to sustain profitable trades in the future.
In conclusion, NostalgiaForInfinityV6 has the best overall metrics to continue delivering profitable trades while minimizing risk, positioning it as the most robust strategy for future trading.
So with this analysis I’m at the end of this exclusive post. All the backtest files, the strategy code, plots and other outputs are included as downloadable files in this post. You can use this analysis and these files for your own research and I hope you will have a profitable trading algorithm in hands with one of these NFIX variants.
Please leave any questions or comments below if you have any.
For now this is the end of the blog post and I want to express my gratitude to all you Patrons. Many thanks and I will see you in the nest post.
Goodbye!
2024-10-23 16:00:07 +0000 UTC
View Post
In this video I will make no exception when it comes to presenting trading strategies that have the potential to make us money in the crypto market even if they are adaptions from other versions. So if you want inspiration to improve your own algorithm, then keep on watching this video.
The Strategy
Just like the popular Nostalgia for Infinity or NFIX trading algorithm, there can be multiple adaptations on the same base strategy rules which can add significant improvements to the original baseline. This time the author @Rallipanos presents another iteration of his (or hers) own trading algorithm. On my setup it showed promising results, so I therefore I want to present you these results.
Just like other versions, this code can be found on Github to download and use.

Like I always say, all the kudo’s and compliments go to the original author of the trading algorithm. I’m just the guy that tests this out and show the promising results on the Youtube.
Lets find out what’s actually happening in this spot trading only algorithm. and try to understand it’s parameters and rules so that we can understand a little bit what makes it tick and why it does it’s buys and sells
https://raw.githubusercontent.com/syuraj/freq-test/12243c6e3ebf9a245cca012b5d5e35b9e49aae91/user_data/strategies_orig_updater/NotAnotherSMAOffsetStrategy.py

After the import of the necessary libraries its time to define some parameter settings and the first custom indicator.
These parameter settings are used later in the strategy as the default settings on which to make trades on.
The Elliot Wave Oscillator here is created. We’ll see later if it is also actually used in the code.
The next part defined the interface version and since we are already at version three I know that this is an old code. Hopefully it still remains profitable because sometimes older algorithms will lose their edge.
The ROI table will take profits if after a certain amount of time the strategy has the configured profits reached. Here at 21,5 percent at any time, 3 percent at 40 minutes 1.6 percent at 87 minutes and after 201 minutes if will just end its trade if there are no profits made. To me this already seems that the parameters are found after a hyperoptimizing setting since they are not nice round numbers. But I could be mistaken ofcourse.
The Stoploss is set at 35 percent, so after entering the trade, its possible that after a 35 percent loss the algorithm will exit the trade here.
The SMA Offset settings here define the ranges in which the optimal settings should be sought if you want to hyperoptimize this trading strategy.
It searches for the optimal sma lengths and low and high offsets if you are going to optimize this algorithm.
The next section here shows that a trailing stop has been set. Of which I am not very fond of since it can influence the backtest results.
Furthermore the proposed timeframe is set here. And initially the 5 minute timeframe should be the best one. Then the informative timeframe is set. In this case the one hour timeframe.
Some startup candle counts and the plot configuration here, that plots the MA buy and sell lines if you want to create a visual output of the backtest results of a pair.
But the real interesting thing starts at the populate indicators method here.
In this part of the strategy, there are several key technical indicators calculated that will help with the buy and sell decisions.
First, the Exponential Moving Averages, or EMAs are calculated, for both buying and selling signals.
Next, there is the Hull Moving Average, a 50-period average that helps smooth out price movements. Along with a 100-period EMA and a short-term 9-period Simple Moving Average. Probably to capture short-term price trends.
For momentum, the Elliot Wave Oscillator, or EWO, is calculated. This indicator was defined earlier in this code and it measures the difference between two EMAs which gives us insight into market momentum.
Finally, the Relative Strength Index, or RSI, is defined in in three different timeframes—14, 4, and 20 periods. Probably to assess overbought or oversold conditions and help us time our entries and exits.
Let’s discuss the buy and sell rules next:
There are three separate buy signals created. EWO1, EWO2 and EWOLOW.
Each of these rules consists of further individual buy rules.
I’ll only discuss the first rule here, the others can be a good homework assignment for you to find out what they do.
So the buy1 signal gets active when the rsi is below 35, the close price is below a threshold where the MA buy line with the length that has been set in the hyperparameter section is multiplied by the offset value also configured in the hyperparameter section.
Then the Elliot wave value should be above the EWO high threshold
The RSI should be below the RSI threshold
There should be at least volume detected
And finally the close price should be below the SMA sell times its threshold value too.
I believe that The intention behind this set of buy rules is to identify a strong buying opportunity when the market is showing signs of being oversold but with momentum indicating a potential upward movement.
Now try to find out for yourself what the intention is for these other two buy signals…
The sell signals are also separated in two different sell conditions, each with its own rules. Besides the ROI and stop loss ofcourse.
The first rule of the first sell conditions states to sell when the close price is above the SMA9, and when the close price is above the configures sma sell length times the offset.
Also the RSI indicator should be above 50, the volume should be above 0 and the rsi fast should be above the rsi slow indicator.
The second sell rule is almost the same, but here the close price should be below the hma 30 instead of using the RSI.
Or when the hull moving average times 1.149 is lower or even than the ema 100
Or when the close price is higher or even higher then the ema 100 times 0.951
Lookahead analysis & Recursive analysis

Now before I did a backtest I also did lookahead bias analysis and a recursive analysis and these are the results.
So let’s now continue with the backtest and let me show you the results I got on my setup.
Backtest results
NotAnotherSMAOffsetStrategy
The first backtest results I want to show you are that of the strategy where the trailing stop loss is active. You see that the profits made by this trading strategy are pretty good. With an overall hypothetical 3126 win percentage, a very respectable 75 percent win rate and only a 5 percent drawdown. Also 93 percent of the pairs seem to respond well to this algorithm.
This results in a equity curve that you see now. Nice steady upward movements. Here and there a small drawdown. But further nothing to worry about.
I also tested this strategy without using a trailing stop loss to see if this was of great influence of the strategy. But surprisingly, here the results were even better. So I’ll discuss these results instead of those with TSL activated.
NoTSL version

The win profits ended up even higher. The win percentage got a little bit lower just like the drawdown and pairs ratio. But the other performance indicators scored a little bit higher so eventually this overall score also ended up higher.
But the differences are minimal. The equity curve has almost the same admirable rise to a higher end result.
And the drawdown’s biggest spike is in this case just over 5 percent with an average drawdown of even lower than 1 percent.
Furthermore, most weeks offer a positive results and only when the last bear market was in full swing there were some weeks with negative results.
The box plots of the win distribution and the profit distribution always give good insights in the past performance over the dataset I use.
The win rate distribution shows a relatively tight spread, with most trades achieving a win rate between 60% and 85%, suggesting moderate consistency in successful trades. There are some outliers at 20% and even 0%, but these are rare occasions.
On the profit distribution side, the majority of weekly profits cluster around a small range, indicating relatively stable returns, but there are notable outliers both on the high end (around 12,000 – apparently a superlucky week in trading) and the low end
(around -2,000). This suggests that the strategy has the potential for large gains but it also carries some risk of significant losses during certain periods.

So comparing the endresult with other very successful trading strategies shows that it can certainly match itself with the big boys. It might not be the highest gainer but
considering its steady rise its certainly worth your attention and further investigation.
Also some of the performance indicators show promising results and sometimes have even better scores than the ones that are currently in the top 10 of best hypothetical performers. Like Calmar, Sortino and especially the Sharpe ratio, profit factor and pairs ratio.
So you see, sometimes its worth taking the time to check out another version or iteration of an already well known strategy. You might even add your own specific indicator or trading rule to the equation and it could perform even better. If you do, then please add this to the comments below so that others can check out on your work as well.
For me this algo is interesting enough to do a forward test with and I will do this in the future. I might even present you with the findings after a while after I have taken this algorithm to the test.
Now I hope that you have enough information about this trading strategy and have added this to your arsenal too. Or at least take it into consideration for testing.
I think I have enough said about the strategy.
So this is it for this post and I will see you in the next one.
Goodbye!
2024-10-19 16:05:01 +0000 UTC
View Post
Hi there, welcome back to another strategy breakdown and testing post.
This time, we’re taking a look at the SMAOffsetOptV1—a strategy that’s built around simple yet effective moving average techniques. This isn’t one of those overcomplicated algorithms, but don't let its simplicity fool you. With a mix of SMA and EMA signals, it packs a punch when it comes to optimizing short-term trades.
So, what makes this strategy interesting? The SMAOffsetOptV1 uses customizable offsets to fine-tune when it enters and exits trades. You’ve got your typical buy/sell triggers based on price movement around the SMA and EMA lines, but with the added flexibility of adjusting these parameters to fit market conditions. Whether you're aiming for quick profits or testing a longer hold, this strategy has some built-in options for both.
In this post, we’ll break down the logic behind how this strategy works, look at the settings that make it tick, and of course, go over the results from the backtests. Spoiler alert: while the strategy has solid foundations, there’s always room for tweaks depending on your risk tolerance and trading goals. Let's dive in and see if SMAOffsetOptV1 fits your trading style!
The Strategy
The SMAOffsetOptV1 strategy is a short-term trading algorithm that leverages Simple Moving Averages (SMA) and Exponential Moving Averages (EMA) to time entries and exits. By applying customizable offsets to these moving averages, the strategy aims to capture price momentum while optimizing risk with built-in ROI targets and a dynamic stoploss system. It's designed for flexibility and fine-tuning, making it suitable for both quick trades and more conservative holds.
You can find the strategy on Github if you search for it on it’s name.
I’ll include the link to that search too so that you can download this algo directly from github.
https://github.com/search?q=SMAOffsetOptV1.py&type=code
Let’s click on the first one here to see the contents of the file and check out how the algorithm works:
https://github.com/AhmedSakrr/freqtrade-strategies-2/blob/5ef016e64aca93ef1831fc297acd3c827c599415/user_data/strategies/SMAOffsetOptV1.py#L4
The raw file link
https://raw.githubusercontent.com/AhmedSakrr/freqtrade-strategies-2/5ef016e64aca93ef1831fc297acd3c827c599415/user_data/strategies/SMAOffsetOptV1.py
The first thing that I’d like to mention is that the author of this code is @tirail
Therefore all the kudos and compliments go to this person. I’m just testing it out and present you the analysis on my backtesting environment. Hopefully this strategy has a high probability to be profitable.
Now let’s focus on the code itself.
The first thing there is to see is this ma_types dictionary. Here there are two moving averages configured. Later in this code we’ll see why this part is here.

The strategy is ready for hyperparameter optimization of the SMA on the buy side and EMA on the sell side. This other section below also has information about the ranges in which the optimal parameters have to be found.
Furthermore the strategy has a stop loss of 50% set. Which is quite large and will give trades a lot of breathing room to eventually, and hopefully, go higher again.
Then there is a ROI table configured that has time based take profits set at multiple points in time. In this case at the 60, 90 and 220 minute mark.
Furthermore there is a trailing stop loss set that might be of influence on the backtest results you see later. So keep this in mind and always test on your own setup to see how well the algo performs over there.
The strategy is supposed to be working best on the 5 minute timeframe and we’ll see later if this is really the case here.
Also there is a custom stop loss configured but it’s also disabled with this line: use_custom_stoploss = False

In the populate indicators method the indicators are configured on which the buy and sell signals will work.
As you can see there are only two indicators configured to be entered into the dataframe.
An MA offset buy indicator and a MA offset sell indicator. Let’s see what is happening over here because this is quite interesting:
dataframe['ma_offset_buy'] = ma_types[self.buy_trigger.value](dataframe, int(self.base_nb_candles_buy.value)) * self.low_offset.value
dataframe['ma_offset_sell'] = ma_types[self.sell_trigger.value](dataframe, int(self.base_nb_candles_sell.value)) * self.high_offset.value
The buy offset first uses the ma type. And the types of MA are in the dictionary we found at the beginning of this strategy.

The actual use of which kind of MA is determined in the hyperspace parameter settings next to the base_nb_candles_buy value and the offset for the calculation. The base nb candles is just a fancy description for the length of these moving averages.
These values are also written down in the section for hyperoptimizing. And in that part of the code the ranges are also determined in which the optimal parameters has to be found if you want to do hyperparameter optimization for this strategy.


Then there is the “* self.low_offset.value” and this is the offset boundary where the moving average is multiplied by.
In the creation of the ma_offsett_sell column in the dataframe is the same calculation. The MA type, its base candles buy value and the high offset candle are all determined by the initial hyperparameter setting and also set for optimizing in the opzimization settings section.

So initially the settings for these ma offse buy and sell calculations are in the buy and sell hyperspace settings. With hyperparameter optimization optimized values can be found for your strategy, but you’ll then have to be aware that you are introducing curve fitting bias in your strategy that might cause suboptimal future behavior for the strategy.
As for the final buy and sell signals these are determined in this final section:

The main condition for triggering a buy is when the price crosses above the ma_offset_buy (an adjusted moving average). This is evaluated using qtpylib.crossed_above, which detects if the price has crossed from below to above the adjusted moving average (i.e., from a dip or low point). The buy condition also checks if the trading volume is greater than zero to ensure the market is active.

The sell condition is triggered when the price crosses below the ma_offset_sell. This condition is evaluated using qtpylib.crossed_below.
Similar to the buy logic, this checks for a cross but in the opposite direction (indicating the price has peaked and is now starting to fall).
It also ensures that there is trading activity by checking if the volume is greater than zero. So in other words, the strategy looks to sell when the price, which has been above the adjusted moving average, starts to drop back below it. This is often a sign that the upward momentum is ending and a potential price drop might occur.
Let’s test this supersimple strategy to see of this has potential for future trading opportunities.
Backtest results
As it stands, the originally configured 5 minute strategy has indeed the best cards in hand for profitability.

Out of the box this algorithm scored 338 points and got a hypothetical 341 percent return over the backtest period. It also has a respectable 75 percent win rate. And with an average of 5 consecutive wins over 2 consecutive losses it is also easy on the nerves.
If we take a look at the equity curve then we see more of the characteristics of this trading strategy. On a 5 minute timeframe this is not the most active trading strategy, which we can see at these flat lines over several weeks. But when it comes to detecting a profitable trade, then it certainly catches this.


This also has a positive impact on the drawdown curve. Which remains flat most of the times with here and there a spike upwards. The maximum drawdown detected at backtesting was 9 percent at most.

Lets take a closer look at the winrate and profit distribution.
The boxplot of the winrate distribution on the left shows a very high winrate, close to 1.0 (100%) for the majority of trades, indicating that most trades are profitable. However, the presence of a small number of lower winrate results suggests occasional losses or less frequent success in certain weeks.
The profit distribution on the right reveals that while the majority of weekly profits are small and clustered close to the median, there are a few significant outliers (dots above the box) representing large profitable trades. This indicates that although the strategy is generally consistent, it occasionally captures much larger profits. However, the strategy's profitability seems to rely on these few outliers to boost overall returns.
So overall this strategy might not be the highest scoring type in comparison with other, more advanced trading algorithms. But I think this will make a good foundation for building other trading rules on.

At the moment the amount of trading signals it gets on the 5 minute timeframe is way too low. Optimizing this with Hyperopt might seem to be a good idea. But keep remember that you’ll introduce biases here too. Additional trading rules might prevent this and help to get a higher quantity and quality of trading signals.

As for now I think this is enough information about this trading algorithm you can freely download from github. Thanks for watching and I’ll see you in the next post.
Goodbye!
2024-10-12 15:45:01 +0000 UTC
View Post
![]()
Introduction
Welcome back to another deep dive into advanced algorithmic trading strategies designed for the Freqtrade trading bot. In today's post, I'll be exploring a sophisticated and highly customizable strategy known as NFIX_BB_RPB. This strategy is a variant of the widely respected NostalgiaForInfinityX (NFI) strategy, created by the developer iterativ, and has been adapted to further enhance its performance in specific market conditions.
The NFIX_BB_RPB strategy leverages a variety of advanced technical indicators and custom logic to optimize trade entries and exits. With a strong focus on both risk management and profitability, this strategy is designed to cater to traders who are serious about maximizing their returns while minimizing exposure to market volatility. Whether you're a seasoned trader looking to refine your current approach or someone who is exploring automated trading for the first time, this strategy offers a powerful toolkit to help you navigate the complexities of the cryptocurrency markets.
In the sections that follow, I'll do a high level overview of the key components of the NFIX_BB_RPB strategy. Since I already did some work on other versions on the NFIX algorithm.
I'll also try to find out how the strategy is designed to manage slippage and control risk, ensuring that it remains robust in a variety of market conditions.
So, let’s get started by unpacking the logic and design of this advanced trading algorithm.
The strategy code
I will do a high level overview of the code, since explaining 8267 lines of code is almost impossible for a blog post.
Also I consider these NFIX algorithms like “black box” algo’s, since there are so many parameters, indicators and other cogs and wheels in this code, that it is impossible for an outsider do explain or comprehend what’s going on and which relations there are between these buy and sell parameters.
So here it goes with the high level overview…

This section of the code sets up the foundational environment for the NFIX_BB_RPB trading strategy. It includes the necessary imports, such as technical analysis libraries (numpy, talib, pandas_ta), and utilities specific to the Freqtrade bot, ensuring that all required tools and functions are available for the strategy to run efficiently. The code also includes logging setup for debugging purposes and a check to ensure that the pandas_ta module is installed, which is critical for the strategy's operation. Additionally, the section provides general recommendations for optimal strategy performance, such as trade configuration and pair selection, and details on how to manage specific trades and pairs for hold support. The comments also include donation and referral links, serving as an optional way for users to support the strategy’s developer.
And fortunately for the developer, people where kind enough to send him some donations.



In this section, the NFIX_BB_RPB strategy establishes the foundational parameters that guide its trading behavior on the Freqtrade platform. Let's break down some of the key elements:
The strategy operates on a 5-minute timeframe, making it agile and responsive to short-term market movements. While it's designed to capitalize on quick opportunities, the strategy also takes into account longer-term market trends by incorporating additional timeframes, such as 1-hour and 1-day, to inform its decisions.
Risk management is a core focus of this strategy. Although the conventional stoploss is set to a deep value of -99%, effectively allowing for maximum flexibility, this is balanced by a dynamic custom stoploss function. This custom stoploss tightens as trades become more profitable, helping to lock in gains while allowing successful trades to run their course.
The strategy also includes sophisticated trade entry conditions, including slippage protection to avoid unfavorable market conditions. By confirming that slippage is within acceptable limits before entering a trade, the strategy ensures that it doesn't get caught in the wrong side of a volatile move.
For those who like to have more control over their trades, the strategy offers a "hold support" feature. This allows specific trades to be held until they reach a desired profit level, providing a way to customize the strategy’s behavior according to your risk tolerance.

Buy and Sell Parameters: Fine-Tuning Trade Conditions
In this section, the NFIX_BB_RPB strategy outlines an extensive array of parameters that govern the buy and sell conditions, providing a high degree of customization and control over trading decisions.
Buy Conditions:
The strategy includes a comprehensive set of 55 buy conditions, each of which can be individually enabled or disabled. These conditions are designed to capture a wide range of market scenarios, ensuring that the strategy can adapt to various trading environments. Each condition is associated with specific metrics (like win rates and timeframes), giving you the flexibility to optimize the strategy based on historical performance or current market conditions. By enabling or disabling these conditions, traders can fine-tune the strategy to focus on particular signals that align with their trading goals.
Sell Conditions:
While the snippet provided focuses heavily on buy conditions, the strategy also includes configurable sell conditions. These conditions allow for precise exit strategies, ensuring that profits are captured effectively and losses are minimized. Like the buy conditions, sell parameters can be toggled to suit different market conditions or risk appetites.
Protection Parameters:
To safeguard against unfavorable trades, the strategy includes "buy protection parameters." These settings utilize indicators like EMAs (Exponential Moving Averages) and SMA (Simple Moving Averages) across different timeframes to filter out high-risk trades. For example, conditions like "close above EMA" or "SMA200 rising" help ensure that trades are only entered when the market shows sufficient strength or trend alignment, reducing the likelihood of entering during a market downturn or high volatility period. And mind you, there are A LOT of protection parameters set…

In this section, the NFIX_BB_RPB strategy introduces its sell condition logic and sets up several caching mechanisms to optimize its performance and functionality.
Sell Conditions: The strategy begins by enabling a specific sell condition (sell_condition_1_enable = True). While this snippet only shows one sell condition being activated, it's clear that the strategy allows for customizable sell logic, which can be expanded upon based on the trader’s preferences. This sell condition likely ties into the broader framework of the strategy, controlling when and how positions are exited.
Hold Trades Cache and Target Profit Cache: These caches are crucial for improving the efficiency of the strategy. By storing frequently accessed data like hold trades configurations and target profits, the strategy minimizes the need for repetitive data loading and computation, thereby speeding up execution.
The __init__ method initializes these caches, ensuring that they are ready for use as soon as the strategy is deployed. If the target profit cache hasn't changed, it’s saved to avoid unnecessary updates, which helps maintain performance.
Hold Trades Configuration: The strategy includes functions (get_hold_trades_config_file and load_hold_trades_config) that manage the hold trades configuration file. These functions ensure that the correct configuration file is loaded from the expected directory, and they handle scenarios where the file might need to be moved or updated. This flexibility ensures that the strategy can adapt to different user environments and setups.
Whitelist Tracking: The whitelist_tracker function monitors changes in the coin whitelist, which is a list of trading pairs the strategy is allowed to trade. If there are changes, the strategy updates its internal metrics and ensures that Bitcoin (BTC) is prioritized in data tracking. This ensures that the strategy always has the most current information and can adjust its trading logic accordingly.

Top Traded Pairs: The top_traded_list method updates the list of the most traded cryptocurrency pairs by analyzing their traded volume over the daily timeframe. It compiles this data into a dataframe, which is then used to identify and rank the top traded coins based on their volume. The strategy uses this information to prioritize trades in these high-volume pairs, which are typically more liquid and less volatile, making them safer and more predictable for trading.
Top Grossing Pairs: Similarly, the top_grossing_list method focuses on identifying the top grossing pairs, calculated based on the percentage change in their closing prices. This method ranks the coins that have shown the highest returns over a specified period, helping the strategy to target assets that have recently demonstrated strong performance, which might indicate continuing trends.
Additional Functions: The strategy also includes helper functions like is_top_coin, is_support, and is_resistance, which further refine trading decisions by checking whether a coin belongs to the top ranked list or identifying support and resistance levels. These functions contribute to more strategic entry and exit points by considering market structures and key levels.
Bot Loop and Data Refresh: The bot_loop_start method integrates the coin metrics into the main trading loop, ensuring that the strategy updates its metrics and configuration files at the start of each bot iteration. This keeps the strategy aligned with the latest market data and configurations, allowing it to make informed trading decisions in real-time.

Sell Signals: The sell_signals function incorporates multiple technical indicators, such as RSI (Relative Strength Index), Bollinger Bands, and moving averages (EMA, SMA), to generate sell signals. The strategy checks conditions like whether the RSI is overbought (e.g., above 79 or 80) and whether the price has consistently closed above the upper Bollinger Band across several candles. These conditions help determine whether the asset is likely overextended, signaling a potential reversal or a good point to exit the trade while locking in profits.
The function also distinguishes between different market scenarios, such as whether the price is above or below the 200-period EMA, to tailor the sell signal appropriately. This granularity ensures that the strategy can adapt to various market conditions, whether trending or ranging.
Stoploss Logic: The sell_stoploss function provides an additional layer of risk management by determining when to exit trades that have moved into a loss. It uses a combination of indicators like the Chaikin Money Flow (CMF), ATR (Average True Range) thresholds, and EMA relationships to identify when a trade is unlikely to recover and should be closed to minimize losses.
The stoploss logic also accounts for the time a trade has been open, further refining when to trigger an exit. This helps avoid holding onto losing positions for too long, which could otherwise lead to deeper drawdowns.

The sell_over_main function in the NFIX_BB_RPB strategy is designed to optimize sell decisions based on a combination of profit thresholds and technical indicators. This function carefully evaluates whether it's time to exit a trade by comparing the current profit against predefined levels and analyzing the market conditions.

The sell_under_main function is designed to optimize sell decisions when the asset's price is below the 200-period Exponential Moving Average (EMA200), indicating a bearish market condition. This function systematically evaluates whether to exit a trade based on the current profit level and specific market indicators.

The sell_r function is a complex strategy that determines whether to sell an asset based on various technical indicators and specific profit conditions. This function is particularly detailed, offering multiple scenarios under which a sell signal might be triggered depending on the asset's performance and market conditions.
You can see that a lot of hard work has put into all these rules and I personally wonder if there is documentation that describes all these specific settings and the thoughts behind these.

The sell_r function is a also complex strategy that determines whether to sell an asset based on various technical indicators and specific profit conditions. This function is particularly detailed, offering multiple scenarios under which a sell signal might be triggered depending on the asset's performance and market conditions.
The same thoughts I have about these settings. Does anybody of the developers keep track of all these settings…

The sell_pump_stoploss Function is designed to trigger a sell action if a trade is experiencing losses and certain conditions suggest that the price pump is losing momentum. It acts as a protective measure to minimize further losses in a scenario where an asset that was pumped is now declining.
Whereas the sell_pivot Function is intended to sell an asset when its price is significantly above a key resistance level, suggesting that the asset may have reached or is near its peak. It aims to capitalize on high profits before a potential reversal.
Now the sell_long_mode Function function aggregates multiple sell signals, including standard signals, stop-losses, and time-based profit-taking triggers, to optimize the timing of exiting a trade. It is used in scenarios where a trade has been held for a longer period.
And finally the sell_quick_mode Function is intended for short-term trades where quick profit-taking is desired. It triggers sell signals based on rapid changes in market conditions or technical indicators that suggest a reversal might occur soon.

The custom_sell function is designed to evaluate various sell strategies and determine the optimal time to exit a trade. It considers a range of conditions, including the performance of the trade, the current market conditions, and specific trading strategies or modes.
Also, the range_percent_change function calculates the percentage change in price over a specified range, either from the highest high to the lowest low (HL) or from the highest open to the lowest close (OC). It helps assess the volatility or range of price movements over a given period.
And finally the top_percent_change function calculates the percentage change from the current close price to the maximum open price over a specified range. This metric helps identify how much the current price has moved from a peak within a given period.

In any sophisticated trading strategy, gathering and analyzing data across multiple timeframes is crucial. The informative_pairs function serves this purpose by compiling a comprehensive list of trading pairs, each associated with different timeframes. This approach ensures that the strategy has access to data from various perspectives, allowing it to adapt to different market conditions.
To dive deeper into the market's long-term trends, the informative_1d_indicators function calculates various technical indicators on the daily timeframe. These indicators help in identifying significant price levels and broader market movements, which are essential for making informed long-term trading decisions.
For traders looking to understand the market on a more immediate level, the informative_1h_indicators function plays a pivotal role. By computing technical indicators on the hourly timeframe, it offers a medium-term view of market conditions. This perspective is particularly useful for traders who need to react to changes within a shorter time window.
Similarly, the informative_15m_indicators function provides insights into the market’s short-term dynamics. By focusing on the 15-minute timeframe, it equips traders with the data needed for quick decision-making, capturing the nuances of the market's short-term fluctuations.
When it comes to the primary analysis and decision-making process, the normal_tf_indicators function takes center stage. It calculates the technical indicators on the normal trading timeframe, serving as the backbone of the strategy's core analysis.
In some cases, it is necessary to look at resampled timeframes, which is where the resampled_tf_indicators function comes in. This function computes indicators on resampled data, allowing the strategy to use alternative views that can reveal different patterns and opportunities.
The strategy also pays special attention to Bitcoin (BTC), given its significant influence on the broader cryptocurrency market. The base_tf_btc_indicators function generates BTC-specific indicators on the base timeframe, offering a focused analysis of how BTC’s movements affect trading pairs.
For a broader market perspective, the info_tf_btc_indicators function calculates BTC-related indicators on an informative timeframe. This helps in assessing the overall market trends that impact BTC, providing valuable context for trading decisions.
Finally, for those looking at the long-term outlook for BTC, the daily_tf_btc_indicators function offers daily timeframe insights into BTC’s price movements. By computing daily indicators specifically for BTC, this function helps traders understand the long-term trends and potential future movements of the leading cryptocurrency.

the populate_buy_trend function plays a crucial role by defining and applying various conditions under which a trade is considered favorable. This function is designed to evaluate a wide array of conditions, each tailored to capture specific market scenarios, and determine whether or not a buy signal should be generated.
To begin with, the function sets up an empty list of conditions and initializes a buy_tag for each row in the dataframe, which represents the trading data. This tag is later used to identify which specific condition led to a buy signal, aiding in both strategy refinement and performance analysis.
The function then iterates through a series of predefined conditions, each represented by an index number. For each index, the function constructs a list of "buy protection" checks, which act as filters to ensure that the market environment is suitable for buying. These protections include criteria such as the price being above key moving averages, low volatility thresholds, and ensuring that the market isn't in a downtrend. These are the basic safeguards that each condition must satisfy before a buy signal can even be considered.
Once these protections are confirmed, the function dives into the specific logic for each condition. These conditions are tailored for different market scenarios, such as detecting local dips in a semi-swing trading context, identifying uptrends or downtrends, and reacting to short-term signals like changes in momentum or relative strength index (RSI) values. Each condition is carefully crafted with its unique set of indicators, ensuring the strategy can adapt to various market phases.
For instance, some conditions might focus on buying after a local dip in an uptrend, while others might be designed to catch deeper dips during more volatile market phases. The logic often includes checks like whether the current price is below certain moving averages, whether the RSI indicates oversold conditions, or if specific momentum indicators suggest a potential reversal.
After all conditions are evaluated, the function compiles the results and assigns a buy_tag to the rows that meet the criteria. If any of these conditions are satisfied, the function marks the corresponding row in the dataframe with a buy signal. This structured approach ensures that the strategy remains flexible yet disciplined, capable of responding to a wide array of market signals while protecting against unfavorable conditions.
Ultimately, this function acts as the brain of the trading strategy's buy logic, continuously scanning the market for opportunities that align with the strategy's predefined rules, while carefully managing risk through its layered protections.

In a robust trading strategy, selling is as crucial as buying. The populate_sell_trend function, though simple in this context, is a placeholder designed to mark the conditions under which a sell signal would be triggered. In this specific strategy, the function is configured to default to not selling by setting the sell column in the dataframe to 0.
The sell signals in this strategy are not generated within the populate_sell_trend function itself but are instead handled through a combination of different methods and conditions across the strategy.
Here’s where the sell signals and logic actually occur:
Custom Sell Logic in custom_sell: The custom_sell method is the primary place where various sell conditions are evaluated. It calls multiple sell-related functions, each checking different market conditions and indicators to decide whether to trigger a sell.
For example, it calls functions like sell_long_mode, sell_quick_mode, sell_signals, sell_stoploss, sell_over_main, sell_under_main, sell_pivot, sell_r, sell_trail, and sell_dec_main, each of which implements specific conditions for selling based on technical indicators or strategy-specific rules.
Stoploss and Trailing Logic: The strategy also incorporates stoploss mechanisms (sell_stoploss) and trailing stoplosses (sell_trail), which automatically trigger a sell when certain loss thresholds are reached or when the profit begins to decline from its peak by a certain percentage.
Hold Trade Logic: The shouldhold_trade function influences whether a sell signal is followed through or not. If the strategy decides that a trade should be held for potential higher profits, it overrides the sell signal.
Sell Reason in confirm_trade_exit: The confirm_trade_exit function checks the conditions right before placing a sell order, potentially overriding any sell signals if specific hold conditions are met.
The actual decision to sell, therefore, occurs as a result of these combined mechanisms rather than through a single function. The populate_sell_trend function’s simplicity reflects that it’s not used in this strategy to trigger sells; instead, the other methods mentioned above drive the selling process.
On the other hand, the confirm_trade_exit function introduces a more sophisticated layer of decision-making right before a sell order is placed. This function is designed to ensure that the trade should indeed be exited, factoring in specific conditions that might justify holding onto the trade a bit longer, even if a sell signal has been generated.
The strategy leverages a method called shouldhold_trade to evaluate whether a trade should be held based on predefined conditions stored in a cache. This cache holds data about specific trades or pairs that the strategy aims to hold until a certain profit level is reached. If these conditions are met, the trade is held, otherwise, the sell is confirmed.
For example, if a trade is flagged for holding, and the current profit ratio hasn't reached the desired threshold, the strategy will refrain from selling. This approach allows the strategy to maximize gains by avoiding premature exits, which is particularly useful in volatile markets where temporary dips might not reflect the trade's long-term potential.
With this intelligent selling strategy in place, the next logical step is to analyze how this approach performs in real-world scenarios. Therefore, I’ll transition into presenting the backtest results, where we’ll see how these carefully crafted buy and sell mechanisms translate into tangible trading outcomes. This analysis will provide insights into the effectiveness of the strategy, highlighting its strengths and areas for improvement.
Backtest results

The strategy ended with a balance of $5113.14, which represents an impressive profit percentage of 411.31%. This indicates a significant return on investment over the backtest period. A win rate of 84.05% further emphasizes the strategy's strong performance, showing that out of the 1342 trades executed, the majority were profitable.
The winning streak metrics show that the longest streak of consecutive wins was 53, with an average winning streak of 8 trades. On the flip side, the maximum losing streak was 10, with an average losing streak of just 2 trades, indicating a relatively stable and consistent performance.
The compound annual growth rate (CAGR) of 0.72 suggests steady growth over the backtest period, while the maximum drawdown of 8.22% reflects the largest peak-to-trough decline, highlighting the strategy's ability to manage risk effectively.
Key risk-adjusted return metrics such as the Calmar Ratio (8.79), Sortino Ratio (2.99), and Sharpe Ratio (5.88) are all strong, demonstrating that the strategy has managed to deliver high returns while minimizing risk. The Profit Factor of 2.78 reinforces the strategy's efficiency, showing that for every dollar risked, $2.78 was gained.
The strategy also covered 87.76% of the available trading pairs, ensuring broad market participation and diversification. The total score of 329.0 provides a quantifiable measure of the strategy’s overall performance during the backtest.
In conclusion, the Nfix_bb_rpb Strategy has shown remarkable results in the backtest, combining high profitability with strong risk management. However, it is important to remember that past performance is not indicative of future results and always do your own research on your own setup and trading pairs before any forward testing and real trading.

The equity curve shown in the graph illustrates a consistent and strong upward growth, particularly from mid-2020 onwards. The cumulative profit line (in orange) demonstrates a rapid acceleration during 2021, reflecting the strategy's ability to capture substantial gains during that period. After this surge, the growth stabilizes with smaller fluctuations, indicating steady profitability with controlled drawdowns. The presence of both weekly profits (green bars) and occasional losses (red bars) highlights the strategy’s resilience, effectively navigating market corrections while maintaining an overall positive trend.
To get more into details in these profits and losses, I also have this next plot developed:

The profit/loss chart presents a detailed view of the strategy's weekly performance over time. The green bars indicate weekly profits, while the red bars represent losses. The orange line tracks the mean profit/loss, providing a smooth overview of the strategy’s profitability trend.
In the early phase, particularly in 2020, the strategy experienced moderate gains with some sporadic losses. The performance sharply increased around mid-2020, with significant profit spikes, indicating periods where the strategy capitalized on favorable market conditions. However, starting from mid-2021, there is a visible decline in the mean profit/loss, showing that the strategy faced more challenging conditions, leading to increased volatility and some drawdowns, as reflected in the red bars.
Despite these fluctuations, the strategy maintained an overall positive performance, with a general upward trend in profit/loss, especially towards the end of the period, demonstrating resilience and adaptability in different market phases. This analysis ties directly into the backtest results, where the overall profit percentage and win rate reflect the strategy's long-term effectiveness despite short-term volatility.

The boxplot results provide a concise overview of the strategy's win rate and profit distribution.
On the left, the win rate distribution is depicted, showing that the strategy consistently maintains a high win rate, hovering close to 1.0 (or 100%), indicating a strong probability of closing trades in profit.
On the right, the profit distribution boxplot reveals that the majority of weekly profits are centered around a moderate range, with a few outliers both on the higher and lower ends. These outliers, indicated by the red dots, show instances of exceptionally high profits or losses, which are less frequent but still significant. The overall distribution suggests a strategy that, while generally stable, can occasionally capture large gains or encounter notable losses, contributing to its overall performance profile.

The comparative analysis of the Nfix_bb_rpb strategy against other top strategies reveals several strengths and areas of concern. Notably, the Nfix_bb_rpb strategy stands out with the highest total score, indicating its overall effectiveness in generating profits. It also excels in maintaining a high win percentage and profit factor, which are crucial for consistent trading success. Also, the strategy's drawdown is relatively low compared to other strategies, which is positive.
However, it lags in metrics like Sharpe and Sortino ratios, which suggest that while profitable, the strategy may involve a higher level of risk relative to returns. Additionally, its performance in the Omega Ratio and ES_CVaR metrics indicates that it may not be as resilient in adverse market conditions compared to other strategies like MacheteV8b.
In conclusion, while Nfix_bb_rpb is clearly a strong performer in terms of profitability and overall score, it does come with trade-offs in risk management, suggesting that while it can generate significant profits, it may do so with higher volatility and risk. This strategy might be suitable for those with a higher risk tolerance, but more conservative traders might prefer strategies that offer better risk-adjusted returns.

Strategy League

Nonetheless, this algorithmic trading strategy has potential and in the grand scheme of things it ends up in the top 25% of best trading algorithms found so far.
It could be worth a try to see if this ‘out-of-the-box’ algorithm better fits your setup and preferred trading pairs. And if so, then it could be worthwhile to do a forward test of a couple of months to see how it performs in real market circumstances.
Conclusion
In conclusion, the Nfix_bb_rpb strategy demonstrates impressive profitability, boasting a high win rate and substantial total score. However, it’s essential to recognize the trade-offs in terms of risk management, as indicated by its lower performance in some of the more nuanced metrics like the Sharpe ratio and ES_CVaR. This strategy is undoubtedly a strong contender for those who prioritize returns, but it may require a higher risk appetite to fully capitalize on its strengths.
As always, I want to extend a heartfelt thank you to all of you for your continued support and trust. Your backing allows me to dive deep into these strategies, refine them, and bring you insights that help us all navigate the complex world of trading. Stay tuned for more updates and keep those questions and suggestions coming!
Happy trading, and thank you for being part of this journey!
Goodbye!!
2024-10-11 15:00:02 +0000 UTC
View Post
Introduction
In this post I’m trying to reproduce a strategy that was recently uploaded and has much attention on Youtube. The strategy is called RSI Cobra and according to the Youtube statistics it is very popular. So let’s jump on the popularity bandwagon and explore this trading strategies results on Cryptocurrency trading.
The strategy
So as I said in the intro of this video. This algorithm has a tremendous popularity and has 23k views at the moment of creating this video. So there should be something that makes this algo extremely popular within the trading community.
I will get straight to the point and will just start with the indicators and trading signals that are mentioned in the video.
According to the video this strategy should be fit for Cryptocurrency and it makes use of a couple of very simple indicators:
Something that indicates a inclining or declining trend.
A couple of simple moving averages that together form a banded simple moving average. Comparable with the Bollinger Bands or Keltner bands.
The center of the band is the 50 day simple moving average, calculated on the close price of the candles. The upper band is calculated as the simple moving average but here it uses the high price of the candles. And for the lower band the simple moving average of the low price of the candles is used.
Why it is called the Cobra is not mentioned in the video but it sounds cool. So why not.
Furthermore the 14 day RSI indicator is used
And an 50 day moving average on this RSI indicator
According to the original video the rules of entry and exit are as follows:
The price should be upward sloping for longs and downward sloping for shorts
Price is rising and should be above the Cobra moving average for longs or the close price is below this cobra band for shorts.
The RSI's 50 SMA should be above the 50 level for longs and below the 50 level for short trades.
The RSI 14 should also be above 50 for longs and below 50 for shorts.
The real signal for longs is when the RSI dip below its 50 SMA and then goes above it again. Then we open a trade at the next candle after this cross.
To go short the RSI should get above its 50 SMA first and then dip below it again for the trading signal to go short.
The stop loss is set below the last swing low for longs or above the last swing high for shorts
But as for the sell levels, these are not explained as far as I could analyze the video. For some reason these were always indicated at the next highest or lowest swing levels. Also the R:R is unknown in this video.
Also there is no scenario proposed where the take profit is never hit but all the original signals for entering a trade stop signalling. This is what I call “trade signal lost” by the way…



So for some of these rules I had to make some assumptions and add my own custom rules. But not much. Most of the original rules were kept.
Coding into an algorithm
I first started to code these trading rules into a trading algorithm in a Jupyter notebook.
From there I could test out the correctness of the signals.
The first thing I did is to create a pandas dataframe so that I can add my trading signals to it.

The next thing to do is add the indicators like the RSI, Rsi’s moving average, and a couple of simple moving averages to create this Cobra band.

Then I asked ChatGPT to create me a function where stop loss and take profit points are determined. Since the strategy does not have exit signals based on the used indicators for entry signals.
So eventually I ended up with this function to determine the entry and exit signals based on the initial entries. Now since there is no data given on the risk to reward level for this strategy, I assume a Risk Reward setting of 1 to 2. So I risk 1 dollar for 2 dollars gain. Hopefully that will be enough to get some good returns based on the risk we take. I coded this into the stoploss function to have more flexibility choosing the right R and R settings.

Now since the first rule of the trading algorithm is to determine if a market is rising or falling, I had to come up with some sort of indicator to detect this. Eventually I chose to use a linear regression indicator to determine this.

Then there is the thing where RSI crossing above or below its moving average has to be detected for entering a long or short trade. For this I had to revert to the following function where crosses can be detected.

I also created a bunch of counters to see which subset of signal parameters provides which amount of signals. In this case we should look for a balanced amount of high quality signals that can get us into trades that provide us with positive returns.


Now these counters only show the amount of signals created for long trades only. And only on the BTC USDT pair. Over the dataset I used for this dataframe, you see that I only have 24 long signals if I use all the parameters for at trading signal. If I leave the RSI cross above its SMA out of the equation, then I suddenly have 524 signals. At first I thought that this was an indication on how well the RSI cross filters trades to hopefully get the highest quality signals.
But eventually I deviated a little bit from the strategy because instead of a cross over or down I will let the algorithm enter the trade if the RSI is just above its SMA. And not exactly at the cross since these can occur at moments where the other signals are not there. But they happen one day before or after the cross occurred. And that would lead to a missed signal.

So with this knowledge I coded this into a Python file that is also useable with the backtesting engine of Freqtrade. Let’s backtest this trading strategy to see if it comes close to that claim of 98 percent accuracy.
Backtest results
I backtested this strategy with two different files. One there I only do spot trading and one where I do futures trading.
Futures results original strategy
The results you see on the screen here come from the tests on futures trading where you go long and short. These results should reflect the original strategy most since long and short signals are proposed.
And I must say that I am somewhat surprised and disappointed at the same time as well. Because it seems that this trading strategy indeed made a hypothetical gain over the backtest data of over 3500 percent. But the disappointment comes from the given data that not a single indicator has a 98 percent accuracy. It’s far from that actually…

Now of course the first thing that comes into my mind is the possibility of a coding error or the fact that some crucial missing information I had to do an educated guess on trading rules. Besides my own decision to do only trades above the RSI Moving average and not the exact crossover. But I never thought that this could be of such influence that the numbers you see here are not even close to 98 percent is surprising to say the least.

As for the weekly performance, we can see clearly that this strategy really gets bashed when bear market circumstances arise. The strategy does not make the best use of its abilities to enter shorts when markets go lower. Although I cannot say how the spot only version will perform yet. My current impression is that the stop loss gets hit more often than intended and therefore causes more losses than wins. So I tested with other settings to see if these proved to be more optimized, but unfortunately that was not the case. Som ore investigation is certainly needed here.
The influence of the bad performance also has its impact on the drawdown, that at some point had a maximum of almost 50 percent.


The plot on the left shows the distribution of win rates for a trading strategy. The median is around 40 percent, with the interquartile range (IQR) between 20 and 60 percent. There are some outliers, with a maximum at 1.0. So the strategy has moderate success, with occasional perfect runs but more often hovers around a 40% success rate. Which was visible in the table.
The right plot displays the profit distribution. The median profit is slightly negative, with the IQR spanning between around -1000 and +1000. There are several outliers, extending profits up to over 10,000. You tell by this that the strategy is somewhat inconsistent, with a winrate around 40%, occasional strong profits, but mostly modest gains or losses. And this can be the cause of the tight stop loss setting as a result of the last lowest swing candle setting as the stop loss in the strategy.
Spot results original strategy
The test where only spot trades are allowed show the following backtest results over the timeframes I usually test.

Again it’s almost the same picture here. No number ever reaches the 98 percent mark. Just like the futures trading version it does make money but at the expense of your nerves because a drawdown of 48 percent and a maximum lose streak of 33 losses after another is a nail biting experience.

The equity curve here looks even worse than the futures version. But for some reason spot trading only causes a higher peak to about 10.000 usdt profits and with the drawdown still ends higher in this backtest experiment. Still this is not the curve I get exited about though.
You might have guessed the drawdown plot here too. Some sharp peaks that get higher where the bear market proceeds further

The box plots always tell an interesting thing about the nature of the trades.

In this case the median winrate is around 30 percent, slightly lower than the previous plot, indicating this strategy wins less often.
The central range (IQR) is between 20 and 40 percent, which shows that most weeks have a low winrate. Nonetheless, there are also outliers at 100 percent And this indicates a few highly successful weeks with nearly all trades being profitable. These highly successful weeks might explain the steep peak in the equity curve.
Unfortunately the median profit is near zero, and this indicates that over time, the strategy neither consistently gains nor loses much money. And the interquartile range (IQR) is tightly packed between -1000 and 1000, which suggests that most weeks see small profits or losses.
So if I compare these boxes with those of the futures trading version then this strategy performs less consistently than the previous one in terms of winrate, with most weeks hovering around a 30% success rate. But the rare, highly profitable weeks might be the cause that this version eventually ends up with a higher end balance . And the risk of occasional large losses is also present here too.
Conclusion and Ending
So what should we conclude after doing a backtest of this trading strategy?
Well considering this is a test on my personal setup and there is no way of telling what or how the original video uploader came to his conclusions of 98 percent accuracy I can only tell you something about my personal results.
I admit I’m a little bit jealous on the amount of subscribers, views and feedback this youtuber has on his trading video’s. Considering there is no way to verify and confirm the findings that are presented. I hope I could ever reach that audience with my humble set of video’s but I also realise that .
I tried to stay as closely as possible to the original strategy and I think I came pretty close to that.
But eventually the endresults count and both these tests show that the proposed strategy only has mediocre returns in comparison to the other algorithms I tested so far.


While the end score of the futures trading version is a little bit higher than that of the spot trading one because of its better risk management abilities, I still believe that this proposed strategy lacks certain higher level risk management features or specific setting to improve this.
But since the original poster of the video is not clear on these other trading rules or shows any real results on which he claimes the 98 percent accuracy, we probably have to find out ourselves where and how we can tweak this strategy for better performances. For me at least I learned a lot coding this strategy and have gained some new tools for future algorithms.
And with this end conclusion I am at the end of this post. Thanks for supporting me and I’ll see you in the next one.
https://youtu.be/Fqs2NP4WOLM
Goodbye!


2024-10-05 16:00:16 +0000 UTC
View Post
![]()
Introduction
In this blog post, I'll be exploring a sophisticated algorithmic trading strategy designed by STASH68, known as the MultiMA_TSL5.
This strategy is built for the Freqtrade trading bot, utilizing multiple moving averages and a comprehensive set of buy and sell conditions, all finely tuned to optimize trade entries and exits. The MultiMA_TSL5 strategy integrates several advanced indicators, including the Hull Moving Average (HMA), Exponential Moving Average (EMA), and the Profit Maximizer (PMAX), to identify profitable trading opportunities in volatile markets.
Let's delve into the details of this strategy to understand how it operates and what makes it a potentially valuable addition to your trading arsenal.
The Strategies code
Let’s walk over the code first, like I usually do, and try to reverse engineer what the authors trading idea is to get an edge in the market.
Let me begin first with the remark section. As said, this code is made by Stash86 and if you like his/hers work, then there are several ways to donate.

I explored some of these donation addresses, but it seems that the author is not very active on Patreon.

Also there also has been no donations send to the BTC address, ever…

Let me try to find out why this is the case and explore the code further. Maybe the algorithm isn’t that good after all…

The strategy begins by importing necessary libraries and modules. These include common technical analysis libraries like qtpylib, numpy, and talib for indicator calculations.
DataFrame and Series are imported from pandas for data manipulation. DecimalParameter, IntParameter, and other similar imports are used to define adjustable parameters for the strategy, which allows for optimization during backtesting.
Logging and threading imports are included for debugging and potentially managing asynchronous tasks within the strategy.

The MultiMA_TSL5 class inherits from IStrategy, making it a valid Freqtrade strategy.
Also the version method returns the strategy's version, helpful for tracking updates and the use of the correct version of Freqtrade.
INTERFACE_VERSION = 3 ensures compatibility with the Freqtrade bot's current interface version. By the way, I still backtest on version 2023.07. So if you experience any problems with this strategy, than check your version since newer versions deprecated some older strategies functions…
The minimal_roi dictionary defines the return on investment targets, with "0": 100.0 indicating that the strategy will try to hold the position until it achieves a 100% profit, reflecting an aggressive profit-taking approach.
The buy_params and sell_params dictionaries store parameters that control the behavior of the strategy's buy and sell signals. For the buy conditions, parameters like base_nb_candles_buy_hma define the number of periods to consider when calculating the HMA, while low_offset_hma adjusts the entry threshold.
Similarly, the sell parameters like base_nb_candles_sell_ema define the EMA's length for sell signals, and high_offset_ema modifies the threshold for exiting trades.
These parameters allow fine-tuning of the strategy, optimizing for different market conditions.

Protection parameters are designed to safeguard against prolonged losses or significant drawdowns.
low_profit_lookback sets the lookback period for evaluating trades, and low_profit_min_req sets the minimum required profit during this period.
max_drawdown_allowed and similar parameters limit the maximum acceptable drawdown, while stoploss_guard_lookback manages the time window for stop-loss evaluation.
These parameters are critical for risk management, ensuring that the strategy stops trading when market conditions are unfavorable.

The protections property defines a list of protection mechanisms that the strategy uses to avoid poor trading periods. Each protection is implemented as a method, such as LowProfitPairs or MaxDrawdown, specifying how and when trading should be halted. These protections are dynamically adjusted based on the parameters defined earlier, helping the strategy to automatically respond to adverse market conditions.

The populate_indicators_1d, populate_indicators_1h, and populate_indicators_15m methods calculate various technical indicators on different timeframes. These methods use decorators like @informative('1d'), which tell Freqtrade that these indicators are to be calculated on daily, hourly, or 15-minute timeframes, respectively.
For example, in populate_indicators_1d, the strategy checks if the volume has been consistently positive over a set number of periods, ensuring that there's sufficient liquidity in the market. This multi-timeframe approach helps the strategy capture broader trends and validate signals across different time horizons.

The populate_indicators function calculates and stores various technical indicators that will later be used to determine the entry and exit points for trades.
Heiken Ashi Candles: The function begins by generating Heiken Ashi candles, which are a modified version of traditional candlesticks that smooth out price movements and make trends easier to identify. These candles are particularly useful in reducing market noise, helping the strategy to focus on the underlying trend rather than getting distracted by minor price fluctuations.
Profit Maximizer (PMAX): The strategy uses the PMAX indicator, which is a variation of the Parabolic SAR and moving averages, to define key support and resistance levels. PMAX helps in identifying whether the market is trending upwards or downwards. This indicator is crucial for both entry and exit decisions, as it determines the direction of the trend.
Relative Strength Xtra (RSX): The RSX is a refined version of the RSI, offering smoother and more accurate signals. The strategy uses two RSX values with different periods to capture both short-term and longer-term momentum. These values help the strategy gauge the strength of the trend and filter out weak or false signals.
Hull and Exponential Moving Averages (HMA and EMA): Multiple Hull and Exponential Moving Averages are calculated with different time periods and offsets. These averages are used to identify potential buy and sell signals based on the relationship between current price levels and these smoothed averages. The combination of HMA and EMA ensures that the strategy is sensitive to both rapid and gradual price movements.

The populate_entry_trend method generates buy signals by evaluating a series of conditions based on the indicators previously calculated. If these conditions are met, it marks the corresponding points in the DataFrame with an enter_long signal.
What I do find interesting is the way the author has programmed the following things into this buy signal function.
One example is its use of data from multiple timeframes. The strategy compares moving averages across different timeframes (15 minutes and 1 hour) to ensure that the broader market trend aligns with the shorter-term signals. This helps in filtering out trades that might look promising on a short-term chart but are not supported by the overall market direction.
Also the strategy looks for confluence among several indicators before deciding to enter a trade. For instance, it checks if the current price is below specific moving averages (like HMA and EMA) and if the PMAX indicator suggests a downward trend. It also requires that the RSX indicators are below certain thresholds, indicating that the market is not yet overbought and has room to move upwards.
And finally he strategy ensures that there is sufficient market activity (as indicated by low volume volatility) before entering a trade. This helps avoid entering trades during periods of low liquidity, which can be riskier.

The populate_exit_trend method similarly checks for sell signals, ensuring that trades are exited at the appropriate time.
And I can say almost the same thing about the exit signals here.
The strategy uses a set of EMAs with different periods and offsets to generate sell signals. For example, a sell signal might be triggered when the current price rises above a certain EMA and the PMAX indicates that the trend is weakening. This suggests that the upward momentum might be fading, and it's time to exit the trade.
Like the entry strategy, the exit strategy also relies on multiple layers of conditions. It checks several different EMAs and combines them with the PMAX and volume conditions to decide whether to exit. This layered approach ensures that the strategy only exits trades when there is strong evidence that the market conditions are no longer favorable.
In general, the exit logic is designed to protect against significant losses by triggering exits when the indicators suggest that the market is turning against the trade. By doing so, it helps in preserving gains and avoiding situations where a profitable trade turns into a loss.
To me this all looks like a pretty well thought out sophisticated trading algorithm that we can learn from.
However the proof is in the pudding and no matter how sophisticated an algorithm looks, to me its more important that it performs well in comparison to the other trading strategies that I’ve tested earlier.
So let’s backtest this baby and find out…
Backtest results
The backtest results for the MultiMA_TSL5 strategy, tested on the 5-minute timeframe only because of the informative timeframes, present a mixed performance, showcasing both strengths and areas for potential improvement.

End Balance: The strategy achieved an end balance of 1270.72, reflecting a profit of 27.07% over the backtesting period. It’s not astronomical, and quite disappointing, considering some of the other strategies that work on this short 5 minute timeframe.
Trades: The amount of trades is exceptionally low for a 5 minute timeframe. Backtested over a longer period. It looks like this algorithm does not manage to generate lot’s of trading signals on the 5 minute timeframe to get higher trading results and this is the most important thing I noticed from all these numbers.
Win Rate: The strategy boasts a 63.47% win rate, meaning that nearly two-thirds of the trades were profitable. This is a positive indicator, suggesting that the strategy can identify winning trades more often than not.
Max Drawdown: The maximum drawdown recorded was 3.43%, which is exceptionally low. This indicates that while the strategy does experience losses, it manages to keep them under control, preventing significant depletion of the trading account during downturns. I am curious about the equity curve here!
CAGR (Compound Annual Growth Rate): Although the CAGR is a modest 0.08, it is important to note that this figure is based on a 5-minute timeframe. For short-term trading strategies, a low CAGR is not unusual, as these strategies typically aim for frequent, smaller gains rather than long-term compounding.
The strategy achieved a Total Score of 179.0, with 71.43% of the tested pairs showing positive results. This suggests that the strategy is broadly applicable across different market conditions and trading pairs, although it may require further optimization to improve its performance. Especially the way it generates signals.

The equity curve for the MultiMA_TSL5 strategy, as shown in the plot, reveals several insights into the strategy's performance over the backtesting period. While the strategy does demonstrate some periods of profitability, there are clear areas where it struggles, particularly when compared to other 5-minute trading strategies.
The strategy begins with a rather flat performance from early 2020 until around mid-2020, where both the cumulative profit (yellow line) and cumulative wins (green line) show little to no movement. This stagnation period indicates that the strategy was unable to capture significant trading opportunities during this time, which could be a result of market conditions not aligning with the strategy’s parameters.
A noticeable spike in cumulative profit and wins occurs around late 2020 to early 2021, coinciding with the significant bull market that drove up prices across the cryptocurrency market. During this period, the strategy performed well, as indicated by the steep rise in the yellow and green lines. This suggests that the MultiMA_TSL5 strategy is well-suited to capitalize on strong bullish trends.
One of the most significant criticisms of the MultiMA_TSL5 strategy is its apparent lack of adaptability to changing market conditions. While it performed well during the bull market, its inability to sustain profitability post-peak is concerning. This suggests that the strategy might be too heavily reliant on strong trending conditions and may not be robust enough to navigate sideways or bearish markets effectively.

Winrate Distribution: The strategy's winrate hovers around 60%, but it shows significant variability, ranging from 40% to 80% across different periods. While it can achieve high win rates, the performance is inconsistent, with potential for both perfect wins and complete losses.
Profit Distribution: The strategy’s median profit is close to zero, indicating a tendency to break even. While there are occasional significant gains, these are offset by frequent small profits and losses, along with the risk of notable losses, highlighting the strategy's inconsistent profitability.
The winrate and profit distribution plots reveal a strategy that is capable of delivering decent win rates but struggles with consistent profitability. The high variability in outcomes, combined with the risk of significant losses, suggests that the MultiMA_TSL5 strategy may require further refinement to improve its reliability and reduce the frequency of extreme negative results. For traders considering this strategy, these insights underline the importance of cautious implementation and continuous monitoring, especially in volatile markets.

The comparison of the performance with other trading algorithms is shown in the plot above. As you can see, the line stays flat in relation to other trading algorithms like the combined NFIv6 SMA strategy (that I will analyze in another video and Patreon post).
Strategy League
And If I compare the overall performance indicators of this strategy with these other, way better performing algorithms, then you might guess what my final conclusion is about this algorithm…

The MultiMA_TSL5 strategy, when compared to other tested strategies, falls short in several critical areas. It generates lower profits, has a modest win rate, and maintains a low number of trades, which is particularly problematic for a short-term trading strategy. While its drawdown is well-managed, the overall performance metrics indicate that this strategy is not as competitive as others, especially in a fast-moving market environment where frequent trading and higher profit potential are key. Significant adjustments or a reevaluation of the strategy's core components may be necessary to enhance its viability.
Conclusion and Final Thoughts on the MultiMA_TSL5 Strategy
After thoroughly examining the MultiMA_TSL5 strategy, it’s evident that while it has some strengths, particularly in controlling drawdowns, it falls short in other critical areas, especially for a 5-minute trading strategy. The performance metrics reveal a strategy that is somewhat conservative, possibly too much so for the dynamic and fast-paced environment it’s intended for. The lower profit percentage, combined with a modest win rate and an alarmingly low number of trades, suggests that the strategy might be missing out on opportunities or not fully capitalizing on market movements.
Compared to other strategies that have been tested, MultiMA_TSL5 lags behind in generating consistent and substantial returns. The profit factor and Omega ratio further underline its struggle to achieve profitability. These issues, coupled with its underwhelming total score, indicate that while the strategy has a foundation that could be built upon, it currently doesn’t match up well against more robust alternatives.
However on the Strategy League it still ends up in the middle of the list because of its strength of keeping its gains.

Lessons Learned and Recommendations
The results from this backtest highlight several key takeaways for traders and strategy developers:
Frequency Matters in Short Timeframes: A low trade count for a 5-minute strategy can be a red flag. The strategy needs to be more active to capture the numerous small opportunities that arise within such short intervals.
Profit Consistency Over Raw Win Rate: While a decent win rate is crucial, it’s more important for those wins to translate into substantial and consistent profits. The MultiMA_TSL5 strategy shows that a decent win rate alone isn’t enough if the profits are too modest or inconsistent.
Final Thoughts
The MultiMA_TSL5 strategy serves as a reminder that even well-constructed strategies can struggle if they aren't finely tuned to the specific demands of the market they are designed for. For those who are considering this strategy, it may require significant optimization or might serve better as a base for further development rather than a final product ready for live trading.
I appreciate your continued support and engagement with these posts.
Remember, the journey to finding a robust and profitable trading algorithm is often iterative, involving continual testing, learning, and adaptation. I hope this analysis has provided valuable insights, and I look forward to sharing more in the future as we continue to explore and refine trading strategies together.
Until the next time,
Goodbye!!
2024-10-04 07:00:02 +0000 UTC
View Post
In 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!!
2024-09-27 09:00:02 +0000 UTC
View Post
Introduction
I am currently working hard on another side project for my audience, that I will keep secret for now. But during the preparations for that project I got a trading Idea that looked very interesting to me to build on further. So in this video I will present you the findings of that experiment.
The premise of this trading idea is that the Crypto Fear and Greed index can be an indicator that can supply you with signals for entering and exiting the market.
For those of you who that do now know what the fear and greed index is. It is a lagging indicator. This index is also made up of several other parameters like volatility, volume, social media analysis, trend information and other data. And you can find this indicator on this page: Crypto Fear & Greed Index - Bitcoin Sentiment - Alternative.me

The whole idea of my strategy is based on this Fear and Greed index. And since this indicator is built from other information, you should be aware that this is a lagging indicator and mostly fit for higher timeframes and trend trading.
The index is low when markets are very bearish and contain a lot of fear. But the indicator can also measure high values when markets are parabolic and bullish and everybody gets greedy. In other words the indicator shifts between fear and greed.

So I thought to myself, “Why not use the F&G index to determine my investment or trading decisions?”
And this is exactly what I want to present in this video, a test to find out if this could be a good indicator for trading, or at least if it could be some sort of baseline that you can combine with other entry or exit signals.
So I started up my Jupyter notebook and my trusty programming companion ChatGPT. And I started to code to see if I could make something that I could use with the automated backtesting engine. This way I can use my testing dataset and can also compare the results with all the other algorithms I already have tested. You have to have some sort of baseline to compare the results with is my modest opinion.
The strategy
As you already might know you can go absolutely crazy with all kinds of parameters and confirmation indicators. But I deliberately kept the strategy super simple here. That would at least give some information that I am onto something special here. You can always build further on this base algorithm and try to squeeze the maximum out of the backtest data. But then you will introduce curve fitting bias and that might lead to disappointing future results when you are actually trading.

My strategy rules are therefore as follows:
The scale of the Fear and Greed index goes from 0 to 100. So to enter the market, the Fear and Greed index should be at 50 or above.
Or in other words, the markets should be at least above the neutral boundary.
To determine if the Index is going upwards or downwards I will make use of a 100 period simple moving average over the same Fear and Greed index. 100 is arbitrarily chosen. I could have chosen 50 or 200 or Hyperoptimized the best setting. But this is a nice simple number and a baseline for further development. No special meanings.
Anyway, if the index is above its moving average it is upwards moving and if it is below its moving average it is going down. And thus for the second signal the F&G index should be above its 100 period moving average.
There are also some exit signals.
Other exit signals are the stop loss, which is set so sell at 25 percent loss. Giving the trade enough breathing room I hope.
And the other exit signal is set if I have 1000 percent profit. Mostly to disable the ROI setting of the backtesting engine. But it could well be that coins have a 1000 percent gain. Which flows directly into my trading account at that moment.
Some code
I will spare you the complete process of my code writing but will only show you the most important parts of the code that I used for testing.
The information for the fear and greed index does not come from the candlestick information I usually use with these backtests. But Instead I have to download this data from the alternative.me site API. The function that downloads the data then also has to process that data so that it matches that of the dataframe that is used in the backtesting engine.

When the actual indicators are called, the fear and greed function is used to get the data and then merge it into the dataframe that is used to determine the trading signals.

Once everything is added nicely to the dataframe the actual entry and exit signals are configured in the populate entry and exit trend.



So you see it’s a super easy trading strategy. And in other words an interesting experiment with absolutely no guarantees but lots of fun to make. Let’s start the real test to see if I’m on the correct path and see the results later (after this shameless plug).
Backtest results
As I expected, the daily timeframe seems to have the best cards in hand. With a win percentage of 2440 it looks like we have a reasonable foundation in hands to build on further. The win percentage of trades is slightly below 50 percent and with a maximum drawdown of around 22 percent losses are still manageable. The Sharpe ratio however is on the low side and only 33 percent of the pairs seem to like this way of trading. Which is also not too optimistic.

The pairs that have profits under my specific circumstances are the following:

I assume that the reason why there are so much pairs that did not even open a trade is because my settings only allow 10 open positions at the same time. So if after the signal that the Fear and greed index is above 50 and its moving average, then all positions will be opened immediately. Because I do not use the individual data of pairs in this algorithm. That might be a negative aspect of the current setup. But more refinement can be added by adding extra signals that look into each individual pair data.

Another thing what I also did is to configure my trading bot to open a position for each pair. This way the strategy opens a position for every pair configured and there are no missed opportunities if other pairs might perform better. I just hypothetically trade them all if I get Fear and Greed signals.
In this case I have to configure the bot’s settings to allow a maximum of 50 trades open at the same time. I also gave it 10 times more funds to that there was money to trade with.
Now please do not look at the end balance here because I have completely deviated from my standard way of testing. And take this as input for further investigation and no advice whatsoever.


Since this is more an indication of the workings of this baseline indicator for starting to trade on.
It also gives insights to the answer of the question about when to actually start your trading bot.
For trading it is not only the time in the market that’s important but also timing when to enter the market. You would not be the fist one that bought crypto at the top of the last bull cycle because you timed wrongly.
And it would be a painful experience to see your investments losing 50 percent of its initial worth. So the timing to start trading by hand or starting a trading bot is certainly a good question and these test results might give an answer to that.
Now Trading both long and short should theoretically be the better option here. But this ability also depends on where you live at the moment and the regulations you have to comply with.
Anyway, considering that this is more of a try out instead of a serious backtest that you are used from me. I will only show you briefly the plots with comparisons against the best scoring trading strategies during my final thoughts.

Endings and looking back
Let’s wrap this post up with my cautious conclusion that The Fear and Greed Index could be a good baseline indicator on which you can build the rest of your trading strategy on.

It looks to be a tool that can help you determine if markets are ready to step in for longer term investment or for spot trading for long positions.
You could also do the reverse for when you want to trade on fear and go short when the Index indicates this.
But I didn’t test this out since I am limited in possibilities due to my countries regulations. However you are always welcome to test this out and add your findings to the comments section below.


As I said in the beginning of this post. This was more of a rough trading Idea that I wanted to show you.
Since this indicator is not bound to a certain pair it’s probably a good idea to add some other indicators or rules to the strategy. For example, you can add the EMA 50 and open trades when the price is above this line. Or add the RSI indicator and add some market strength to the equation where you only trade if it is above 50 or 55. The possibilities are limitless here and it’s only your own imagination that holds you back developing a good trading or investment strategy.
Or you can just YOLO into all your favorite coins at the moment the indicator flips to greed.
In any case, Just remember to do your own research, backtest and forward test for enough time before starting to do actual trading this strategy.
For now I think I have enough information about this idea and will quickly go further with my other project.
See you in the next post,
Goodbye!
2024-09-23 20:16:12 +0000 UTC
View Post
![]()
The first strategy of which I cannot explain its trading results.
Introduction
Hello my dear Patrons and welcome to another analysis of a trading algorithm in this Patreon exclusive post.
is time I tested multiple strategies that are called NASOS. There can be many versions found on Github and during my initial backtests the version 4 is the number performed the best on my backtesting setup.
However there is something strange happening with this algoritm that I simply cannot explain for the first time I do all these tests.
Let’s first show you the source of this file and how it’s build…
Where to find it
As many other trading algorithms, this strategy is available on GitHub. If you search for the NASOSv4 file, then you will probably find lots of repositories that contain this file.
https://github.com/search?q=nasosv4&type=code

Let’s open the file and admire its contents…
The strategy
At the top of the file we can already find the first warning. You should set the trailing stop and custom stop loss parameters to true when live trading. And set the custom stop loss function to false when backtesting.
I will backtest this original file as it is here initially and then do a second test with the TSL disabled.
In this file the custom stop loss is already set to false here.
A coder called Rallipanos made this algorithm and someone called pluxury also dit something with the code. It’s not my code, im just testing it to see if it is worthwhile for further investigation and maybe live trading. The trading idea and workings come from these great minds and I am just reverse engineering what they had in mind with this algorithm.
So let’s continue…
The first section shows us the hyperspace parameters, so we already know we can set multiple indicators to optimize this strategy. However, I will not do this since my last experiences are that further optimization only worsens the performance.

Then we have the well-know Elliot oscillator, that seems to be present and used in most of the well performing strategies.
And after that the ROI table and Stop loss. Which has currently been set to sell at 15 percent loss if a trade goes bad.

Then we have some more hyperparameters to optimize for the indicators that are used in this strategy

And then there are the trailing stop loss settings and the time frame that indicates that this algo has been built for the 5 minute timeframe.
After this we discover some interesting methods.
The first one is the custom stop loss, that has been disabled by default. But Lets run over it anyway…

This custom stop loss method in the strategy dynamically adjusts the stop loss level based on the current profit of the trade. If the profit exceeds a second, higher threshold, the method uses a fixed stop loss plus any additional profit beyond this threshold.
Between two profit thresholds, it linearly interpolates the stop loss value. And below the lower threshold, it enforces a hard stop loss level. So this method aims to protect gains while allowing some room for price fluctuation, especially when profits are higher.

This confirm_trade_exit function in the strategy evaluates additional conditions to confirm or prevent a trade’s exit based on the last candle's data. It checks for specific price conditions against moving averages, like the hma and ema and tries to manages slippage by limiting the number of retries if the exit price is worse than expected.

Next we have the informative_1h_indicators function . This function is designed to fetch and potentially calculate additional indicators from a higher, 1-hour timeframe to inform decisions made on the primary trading timeframe. But as far as I can tell it seems to be a placeholder code, because almost all these calculations are commented out.

Now this normal_tf_indicators function computes various technical indicators for the primary trading timeframe. It calculates exponential moving averages (EMAs) for different numbers of candles specified in the buy and sell parameters, a Hull moving average, and multiple RSI values to track short and long-term momentum and trend directions within the trading strategy.
And the populate_indicators method orchestrates the incorporation of technical indicators into the trading strategy by merging the higher timeframe (1-hour) indicators from informative_1h_indicators with the primary timeframe indicators computed in normal_tf_indicators.
So that I think the purpose here is that it first gathers any relevant higher timeframe data to enrich the strategy's context. And after that it applies the primary timeframe calculations to provide a comprehensive set of indicators. And this all is used to drive buy and sell decisions within the strategy.

The populate_buy_trend method in the strategy defines the conditions under which a buy signal is generated.
You can see that it evaluates multiple technical indicators like RSI and EWO values, alongside specific price conditions relative to moving averages, to determine suitable entry points.
There are different conditions defined for different trading scenarios, and each of these scenarios is tagged distinctly (e.g., 'ewo1', 'ewo2', 'ewolow'). If you take a look at the output of the backtest, then you will see these buy reasons back. So you also have information which buy conditions occur most or have the highest profits.
Additionally, there's a dynamic check to avoid buying if the potential profit, as defined by a threshold relative to recent price highs, is not met. That method ensures that all specified conditions are met before signaling a buy, with additional provisions to cancel signals under certain situations through a series of "don't buy" conditions.

Now finally there is the populate_sell_trend method .
This method outlines the conditions under which a sell signal is triggered in the strategy. It uses a combination of price conditions relative to specific moving averages, RSI values, and volume to identify potential exit points.
Also in this case, conditions are grouped to capture scenarios where the price exceeds certain thresholds or when fast and slow RSI readings indicate a change in momentum, that might suggest a sell. Only when one or more predefined scenarios are satisfied the open position in question will be closed.
Lookahead bias
Now before I continue I also checked this algorithm on possible lookahead bias. But the built in function could not detect any as you can see.
Also I will show you later the difference in performance with and without the trailing stoploss set. So you can also take this bias into consideration when you decide to use this algo.

Backtest results TSL version
At the end of last year I discovered, what I thought, was the best trading algorithm. And I could not imagine that I would find even better performing trading strategies for my trading bot.
But as with many things in life, you can get pleasantly surprised.
And with the results of this trading strategy, the limits are again stretched beyond my expectations.
This trading strategy shows extremely good hypothetical trading results.
Just like the MacheteV8b, this algo could trade over 1.1 million hypothetical dollars together.
It has an over 90 percent win rate and max drawdown of 11 percent.
87 percent of the pairs I use seem to get positive results with this algorithm.
Only a Calmar ratio of 84 looks to be suspicious to me. But let’s not let that spoil the fun.

Let’s see how the equity curve looks like…

The over 1.1 million USDT has been reached by means of this journey of the equity curve.
What’s so special is that after the previous bull market top, there is almost no decline. The curve and the wins keep on going.
The drawdown profile over the plotted timeperiod looks like this:

Some peaks around 6 percent drawdown and an average drawdown of a very admirable 2 percent. Note that the 11 percent drawdown in the table has occurred before the plots timeperiod.
The mean profit /loss over the complete backtest shows that it’s mostly positive. Only around the end of 2022 it gets negative.
Also some weeks show very good profits. Like the week where almost 150.000 dollar has been traded. Now ofcourse there are also negative weeks, but these are manageable, although losses of over 25000 dollar would be a lot of pain. No matter how what happened before.
Furthermore, the win rate distribution and profit distribution box plots are as follows.

The box plot on the left shows a high median winrate, just below 1.0, suggesting that the strategy frequently wins a majority of its trades.
The interquartile range (IQR) is very compact, spanning from around 0.9 to just below 1.0. And this indicates a consistent performance in terms of winrate.
Now, there are several outliers below the box. And these indicate weeks where the winrate significantly dropped below the typical range. That is also what we saw in the previous plot.
The profit distribution boxplot shows a wider range of values compared to the winrate distribution. And these profits vary significantly from week to week.
The IQR is centered around a median close to zero, suggesting that in many weeks the strategy neither makes nor loses a significant amount of money.
The outliers in this plot indicate that there are weeks where the profit is exceptionally high, as much as around 150,000, as well as weeks where the strategy incurs losses, around -25,000.
All of this ends up in an indicator overview that looks like this:

The colum is the highest or almost the highest where it should be high. Like win percentage sharpe, calmar and cagr.
And the lowest or one of the lowest where it should be low. Like the drawdown.
This all results in a profit comparison plot between the top 10 best performing strategies that looks like this:

Where the NASOS performs the best of all. Even better than the MacheteV8b results.
And you already guessed it ofcourse. With these results, this trading algorithm ends up at the top spot of the Strategy League.
A worthy position of this trading algorithm with its spectacular results.

Backtest results NoTSL version
But here comes the strange and unexpected part.
Sometimes life can also throw you a curveball and you cannot explain why this happens...
:-\
As you might already know, I’m not a great fan of the Trailing stop loss function in backtesting. Since it can add a positive bias to the trading results. Using TSL can make a strategy more favorable because of it’s biased positive results.
It could very well be that these positive results will not occur in real trading.
So I also tested this trading strategy without the TSL enabled and it got the following SHOCKING results back…

With a devastating equity curve.

To verify this difference I did a second test on another dataset and other pairs.
On two machines with each their own setup.
Machine 1


Machine 2


Now what on earth is going on here????
Again the backtest results between the TSL and NoTSL versions are these:


How can the disablement of a trailing stop loss setting give such a large difference in this particular trading algorithm?
Also, look at the amount of trades here…
8383 trades with TSL enabled and 198 with TSL disabled.
How come?
Well one thing that shows in the other individual tests is that with the TSL enabled, the average duration of winners is 3 hours and losers have duration of around 17:25 hours.

But with TSL disabled these numbers suddenly change significantly.
214 days duration for winners and 45 days for losers. Why this sudden difference here??

If you see this colordiff here, then only these lines are different between the files:

The secret may be in the first two lines of this code:

Here Backtesting should have trailing stop = True and custom stop loss = False
But in live trading it should be the reverse…
Unfortunately the Freqtrade documentation (https://www.freqtrade.io/en/latest/stoploss/#trailing-stop-loss) does not warn about the usage of trailing stops in backtesting.
Also there’s nothing that the custom stop loss says (https://www.freqtrade.io/en/2021.2/strategy-advanced/#trailing-stoploss-with-positive-offset) about the difference in results between backtesting and live (forward) testing.
There is also no real explanation found in the ‘Assumptions’ documentation section(https://www.freqtrade.io/en/2021.2/strategy-advanced/#trailing-stoploss-with-positive-offset).
Except that:
Trailing stoploss
High happens first - adjusting stoploss
Low uses the adjusted stoploss (so sells with large high-low difference are backtested correctly)
ROI applies before trailing-stop, ensuring profits are "top-capped" at ROI if both ROI and trailing stop applies
But this still does not explain to me why there are such big differences here. So this remains a total mystery to me. Maybe somebody else can explain what’s going on here..?
For me now the only way to check to see if this a valid strategy or not, is to add it to my forward testing trading bot to see what the actual performances will be under ‘live’ conditions.
For now I will leave the results in my strategy league for what they are and if forward testing shows that this strategy is really bad, then I’ll remove the results. So not to misinform other people in the future.
Ending
So with this exceptinal conclusion I am at the end of this post.
Again, maybe somebody can explain this large difference if he/she tests this on their own setup. And if you did, then please add your findings to the comments section of this post.
This is it for me now, and I will see you in the next post.
Goodbye!
2024-09-20 14:00:01 +0000 UTC
View Post

In this postI an going to do something different, and that is to try and simulate an interesting Trading strategy that I watched recently on Youtube. The original video is from the TraderDNA channel and the video is claimes a 98 percent win rate.
[98% WIN] "VOLUME EXPLOSION" Trading with WADDAH ATTAR - Identifying the Most Profitable Trends on https://www.youtube.com/watch?v=VcpD-t3SCJI
I tried to code this strategy into an algorithm for automatic backtesting to see if it really can attain this claimed winrate. Or that we have to be a little bit more critical to what that video claims.
Let’s test that out next…
The strategy
In my journey for trading algorithms I came across the Waddah Attar Explosion a long time ago in this video: https://www.youtube.com/watch?v=_RODYoAEDCU
From that moment on I always wanted to investigate the WAE indicator for it’s probability because I found it very interesting and hoped to find a trustworthy signalling indicator here.
There are also a lot of other video’s that explain and test this indicator too: https://www.youtube.com/results?search_query=waddah+attar+explosion+indicator
And I thought it would be time to do a test myself to see if it performs as good as all the other video’s you see in the list.
I also came across this video: [98% WIN] "VOLUME EXPLOSION" Trading with WADDAH ATTAR - Identifying the Most Profitable Trends on https://www.youtube.com/watch?v=VcpD-t3SCJI
And it explained quite well what this indicator does and how it should be used. I could have picked any of these other videos in the list, but I chose to do this one.
So after watching that video – that has a great explanation on the usage the indicator by the way - I really wanted to create an algorithm with which I could test that indicator and the proposed strategy that was explained there.
Unfortunately I have to immediately put myself a little bit on the defense here because the original video presents quite a few of different approaches to the Waddah Attar trading strategy. But is not specific on the settings of the WAE, If a Tradingview indicator is used, timeframe tested or any other information why the video states an 98% win rate and the testing methodology to claim this result. Only that it can be used on a multitude of asset classes.
Not to mention the fact that no actual trading results were shown. So it could well be that with 98% of wins you’d still have an empty trading account. And you can watch my earlier strategy testing video’s on what I mean by this.
Anyway, I had to be a little bit more creative in some aspects, especially with the exit signals. This has also has something to do with the backtesting engine and the limitations of the trading bot that I use by the way.
Nonetheless I think I came close enough to have a somewhat reasonable Idea of the real performance of that strategy.
So let me explain how my algorithm looks like.
The most simplistic version of the proposed strategy in the original video is to buy when the volume bar turns bullish and rises above the explosion line.
The sell signal is the moment where the first bearish bar appears – indicating that the trend ends. And it does not have to be above the explosion line here.

However, If is show you recent price action on the Bitcoin daily timeframe. you can immediately see that there is a difference in the clean and clear Waddah Attar Explosion image of the video and the one on TradingView. That one looks a bit more messy and has grean and red bars in between these bullish and bearish moves all the time. And may cause premature endings of the trade in these cases.

According to the original video I also have to add some more indicators here to filter out the noise.
The narrator suggests to use two moving averages to determine trending markets. The 20 EMA and the 50 EMA to be precise.

Besides the WAE and the two EMA’s there is also proposed to use the 25 CCI indicator.


So in total this algorithm will have the following rules:
For bullish trades:
Waddah Attar Explosion indicator should be green and move above the explosion line
The 20 EMA is above the 50 EMA and the price is above both lines
And the 25 length CCI should above the center line.

The bearish trades have the following rules:
Waddah Attar Explosion indicator should be red and move above the explosion line
The 20 EMA is below the 50 EMA and the price is below both lines
And the 25 length CCI is below the center line.

In that video the following exit signals are proposed. The exit signal for long trades happens when a bearish volume candle appears after the entry and for shorts when a bullish volume candle appears after the entry of a short trade.
And there is also a risk:reward type of profit taking mentioned. But for me it was unclear which risk:reward setting was used because it is not explained further.
And also most of the time the reward was drawn at the exact top of the bullish or bearish move. Which in actual trading is not always the case.
But I gave it the benefit of the doubt and I decided to use the earlier shown opposite candle methodology for exiting the trade. I cannot say if this was the way for the 98 percent win rate and I am also a bit limited in the possibilities for Risk reward trading with my backtesting engine. But still I think I come pretty close to the original proposed trading strategy.

The Code
DON"T WORRY ALL THE CODE FILES ARE ARE IN THE ATTACHMENTS OF THIS POST BELOW!
I coded this all into a Python algorithm to do a fully automatic backtest with my backtesting engine. And as you might already know, this helps me doing backtesting large amounts of data in a reasonable amount of time, and also preventing the human factor of subjective alternate decision making per entry or exit. Making the test clinical and objective.
So I made code for long and short futures trading.

And one file for doing only spot trading. Trying to find out which of these two has the best overall probability to make money in the market.

So let’s turn to the results of these backtests and see if we really can get close to 98% win rate with a decent profit here.
Backtest results
The results I show here are attained on my specific setup, with my preferred cryptocurrency pairs to test with and over the longest possible dataset I could manage to get. So I did not expect to get the exact numbers as stated in the video. And if you are testing this on your setup, then I expect you will see a difference too.
But I also expected to see at least some similarities or some close proximities to the numbers of the original video.
However these are the results of the backtests I got and you can check and verify all the stuff I do here because I upload all my work, including the code files, the output of the results and my complete setup to Patreon. You can replicate my work on your own computer if you like. This way I hope to be fully transparent in what I do. You may even point me to the possible mistakes I made in the comments section because that helps the community to prevent the same errors and we can all learn from each other. So please click like, subscribe and comment to this channel to learn and find the best trading algorithm for your situation.
Spot trading
In spot trading, we only do long trades and wil not short the market. So we potentially miss 50% of the trading opportunities in the market. Some countries prohibit shorting the market so it is always a good exercise to see what Spot trading can potentially bring us.
In the case of the Waddah Attar Explosion strategy, the 4 hour timeframe seems to have the best cards in hand.

But we all can immediately see that a 98% winrate is out of the question here. It can barely attain a winrate of 34.6 percent. And to be honest that is pretty much in line with most trend trading strategies I tested so far. It still manages to have a win percentage of 1410. And also the drawdown is reasonable here. 61 of my trading pairs respond well to this trading algorithm.
Let’s see what the equity curve looks like.

The curve here has not a steady incline but looks to respond to quick market movements. Which is obvious of course since the indicator literally has the term explosion in the name.
However, slower, more sideways markets tend to make this algo bleed your profits and the proposed filtering EMA and CCI filtering indicators do not do a great job here. So this would be my first point of improvement. Finding out better indicators that filter out bad trades.

This is also confirmed in this drawdown chart. Between the first and second bull market top and during the start of the bear market, the drawdown of the account goes up.

Another mentionable chart here is the win loss ratio. Overall this strategy shows you a lot of losses over time and only some wins. These wins have a higher percentage gain then all these losses. But still the psychological factor of seeing your bot make loss after loss should also taken into account here. How long would you leave your bot running if showed you the maximum 38 losses streak is the real question here.

So overall it is not the best scoring trading algorithm and it’s drawdown is certainly eye catching in comparison with the best scoring algorithms at the time of making this video.
So how would the Futures version of this trading strategy perform. Would it get a winning score of 98 percent here?
Futures results
Let’s start with the positive side. The Futures version, where the algorithm takes long and short trades, does perform better then the spot only version in terms of end balance, win percentage, win streak and eventually the total score over all parameters.

But on the negative side it still does come close to the promised 98 percent win rate. Barely 36 percent of the trades end up positive. The profit factor stays over 1 so eventually the winning trades make this still a profitable trading strategy.

The equity curve experiences much higher and sharper peaks than spot only and trading futures looks more of a rollercoaster ride then a boring steady incline of funds. And I like boring by the way…

This also is reflected in the drawdown curve that has many high peaks and troughs and an average drawdown of around 15 percent.

The win rate and profit distribution plots tell me the following stories:
The boxplot shows that the median win rate is quite low, around 20-25%. The middle 50% of the data (interquartile range) falls between approximately 0.2 and 0.6. So despite the claim of a high win rate (98%), this chart suggests significant variability, with some instances having win rates below 20%, while a few cases approach 100%.
The profit distribution boxplot shows that most of the profits are clustered around the center, with a median profit slightly above zero. There are significant outliers both in the positive and negative directions, with extreme profits going above 3000 and extreme losses going below -2000. This suggests that most trades result in small profits or losses, and there are occasional large wins and losses.

Finally, the comparison of this strategies performance indicators with that of the current best strategies show that the profit factor and the sortino ratio aren’t actually that bad at all. But the drawdown, profit percentage and eventually Sharpe do need to be fixed to make it come close to the best current performing strategies.
Overall conclusion and ending
So after seeing these results, it is hard to believe the original video’s claim of 98 percent win rate. Especially if some crucial facts like time frame, actual trading results, Risk and Reward settings, pairs or markets tested or any of that is not even mentioned. My results aren’t even getting close to that.


Now do my backtest results disqualify that video?
I would argue not since I also did not code each exact step in my algorithm too. Like the proposed Risk reward settings for example. But I also like to be not too critical on myself here, since no additional information on that was given anyway.



Nonetheless I did what I always wanted to do and that is to test out the Waddah Attar Explosion indicator in a trading strategy to discover its added benefits.
In the mean time I am also working on another trading strategy that uses this indicator. And it seems to have better results than the strategy presented in this video.

Please remember to always do your own research and forward test any trading strategy before putting your real money on the line.
In the mean time I will keep on searching for the best trading strategy, maybe I’ll do more of these Youtube examples, and will see you in the next post.
Goodbye!
The Waddah Attar Explosion Trading strategy
Source Youtube Channel: https://www.youtube.com/watch?v=VcpD-t3SCJI





















2024-09-14 17:59:23 +0000 UTC
View Post

Introduction
Welcome my Patrons to yet another blogpost only strategy.
You already must know the message here, blogpost only algorithms do not have the highest scores in the Strategy League. However some do have some remarkable settings or something else special, that wil make it a “Patreon exclusive” 😊
So let’s dive into this algo.
Author and origins
There is no author known for this strategy. But looking at the name and the ASCII art in the code itself. He/She must me a Pokemon fan.

Let’s go high-level over the other code in this file:

Timeframe: The primary timeframe for this strategy is set to '1h' (one hour), which means the strategy will analyze data and make decisions based on one-hour candles.
Informative Timeframe: The strategy also utilizes an informative (secondary) timeframe set to '1d' (one day). This allows the strategy to consider daily data for more comprehensive decision-making.
This strategy has a dynamic ROI setting where it aims for different profit targets depending on how long the trade has been open:
100% ROI after 10080 minutes (one week), targeting a 100% profit.
30% ROI after 2880 minutes (two days).
20% ROI after 1440 minutes (one day).
10% ROI from the start.
Stop Loss: A very aggressive stop loss is set at -99%, which practically means the strategy will hold onto a position unless it is near total loss.
Sell Profit Only: This setting ensures that the strategy will only send a sell signal if the trade is in profit, aligning with the defined ROI targets.
Ignore ROI If Buy Signal: This is set to false, meaning the strategy will respect the ROI settings even if there is a concurrent buy signal, which could help prevent the strategy from holding onto positions too long in the hopes of additional gains.
Indicators

The strategy calculates the 30-day low and high prices from the daily data:
Trading Logic
The buy and sell signals are generated by the code as follows:

Buy Trigger: A buy signal is generated when the hourly close price crosses above the 30-day low from the daily data. This suggests that the asset is bouncing off a significant support level, indicating a potential upward movement.
Sell Trigger: Conversely, a sell signal is triggered when the hourly close price crosses above the 30-day high from the daily data. This setup aims to capture profit at a recent peak, assuming that touching this level might indicate a potential retracement or peak formation.
The Slowbro strategy uses a very straightforward logic based on price action relative to recent highs and lows on a larger timeframe. This method could be particularly effective in markets where historical support and resistance levels are respected. However, the extreme stop loss setting is quite risky as it exposes the trader to potentially significant losses. This aspect, combined with a reliance solely on price crossing historical extremes without additional filters or confirmation indicators, may result in a strategy that could benefit from further refinement and risk management enhancements to avoid large drawdowns during volatile or trending conditions.
Backtest results

The Slowbro strategy's performance on a 5-minute timeframe, as revealed by the backtest, offers us some interesting insights. Here's a critical analysis based on the table you've provided:
A 51.32% profit is not very high and there are certainly many other algo’s that perform way way better. Nonetheless, the strategy boasts an impressive win rate of 91.67%. High win rates are desirable; however, they need to be scrutinized against profit margins to ensure that the winning trades are not just recouping the losses from the fewer losing trades.
The superlow amount of 120 trades on the 5 minute timeframe here tells me that this strategy only makes trades on very rare occasions. If you would load your bot with this algo, then it will be dormant most of the time. Here opportunity costs come into play if you know that there are many other well performing algo’s that are much more active.
In this case the name of the algorithm certainly is applicable. It is very slow on a high frequency timeframe…
Now on the other hand, the maximum consecutive wins and losses has a difference of 100 trades. So if there is a trade on these rare occasions, then it is certainly time to step in. The probabilities are high that the trade is a winner. But beware of the negative aspects aI already told you here.
Lik for example the drawdown. It is high at 69.33%. This is concerning as it implies there is potential for significant losses, which could be distressing for traders, especially when leveraged.
The modest CAGR in conjunction with the Sharpe, Sortino, and Calmar ratios points out that the risk-adjusted returns are not as high as one might expect given the high win rate and profitability percentage. This could be a red flag for potential overfitting or lack of adaptability to different market conditions.
Finally, while the backtest does provide a snapshot of past performance, it's crucial to remember that it does not guarantee future results, especially in the fast-paced environment that a 5-minute timeframe represents. The high win rate may not sustain in live conditions, particularly with slippage and commission considerations.

Conclusion

The visual data corroborates our earlier analysis that while Slowbro is not highly profitable and has a low trading frequency. It may carry higher risk than some other strategies. Its win rate is impressive, but when the performance is adjusted for risk, Slowbro doesn't fare as well. This suggests the strategy may benefit from risk management improvements. Caution should be exercised if considering this strategy for live trading, and continuous monitoring would be essential due to its aggressive approach.
Thanks :-)
To all my patrons, thank you for your support. I hope this critical review provides clarity on the Slowbro strategy's potential and limitations.
Your engagement is invaluable, and I look forward to further exploring and refining trading strategies with you.
Stay tuned for more insights and analyses!
Warm regards and Goodbye!
2024-09-13 10:00:01 +0000 UTC
View Post
In this blog post, we will dive into the EI3v2_tag_cofi_green strategy, a Freqtrade-based trading algorithm that employs various indicators and parameters for generating buy and sell signals. This strategy is an interesting combination of custom indicators, traditional technical analysis tools like RSI, and advanced features such as trailing stop losses and dynamic profit-taking.
Introduction
Before I discuss the strategy code and show its results. I want to do a quick shoutout to tang tang that pointed me to this algorithm.
You can download the algorithm from here or search for it on github: https://github.com/search?q=EI3v2_tag_cofi_green&type=commits

In the code there are two mentions of the original authors here: Rallipanos and some changes made by IcHiAT. So all the kudo’s go to these developers. I’m just the guy who tests the algo on its merits and show you the results in this video.
The strategy
The strategy itself is designed to work on a 5-minute timeframe and also uses higher timeframes (1 hour) to form a more high-level view of the market.
By using a combination of the Exponential Moving Average (EMA), Relative Strength Index (RSI), and the Elliot Wave Oscillator (EWO), it attempts to optimize both entry and exit points to capture profitable trends.
But let me break this code down into sections and discuss every important part on a higher level here for more insights.

Here, we see the ROI (Return on Investment) table. This ROI table is time-based. However if you look closely at it, it has """ in front and behind it. Meaning that this is actualy a Python comment section. The real used ROI is used later on.
In this piece of this strategy are its buy and sell parameters, where the strategy is able to make use hyperparameter optimization if you use this option.
For the people that first hear this. In Freqtrade, hyperoptimization allows traders to automatically search for the most effective parameter values by backtesting thousands of combinations. However it also introduces a bias called curve fitting, so you should be aware that using optimization techniques on past data will not guarantee future success.

Now this section defines a set of protection mechanisms aimed at reducing risk and avoiding unprofitable trades. It includes safeguards like a cooldown period after trades, maximum drawdown limits to halt trading if losses exceed 20%, and various forms of stoploss guards and profit checks to prevent trading when certain conditions—like low profits or excessive drawdowns—are met. So to explain this in short: These protections help mitigate potential losses during volatile or unfavorable market conditions. Let’s hope we never need these…

Ths stop loss has been set to -0.99 which effectively disables the stop loss. From this point on I assume there will be other triggers in the code that provide the exit signals that replace the stop loss.
In this piece the ROI also has been set to 0.99. This means that at 99% profits the algo executes a sell. Locking in 99 percent profit.

However if the developers try to lean on the trailing stop loss here, then they have to be aware that enabling this while doing backtests can skew the output results to a more positive bias then originally is the case. I disabled it in this case to get more reliable results in my test. But remember, the original code has this set to True.
.

In this section of the strategy, several parameters are defined that control the behavior of the algorithm, many of which are optimized to find the most effective values. Overall, these parameters illustrate the complexity and flexibility of the strategy, with the ability to fine-tune almost every aspect of trade execution through optimization. This allows the bot to adapt to different market conditions and enhance performance.

In this small configuration section there is set that the bot may use the first 400 candles. But only trade after them. This is set so that some indicators can process all this information to create the actual indicator output. In this case it is 400 candles of each 5 minutes, so the bot will start really working around 1.5 days after the start.

The pump_dump_protection function is designed to detect sudden, abnormal spikes in trading volume, which are often signs of pump-and-dump schemes. In short, It compares short-term and long-term volume averages to identify unusual volume increases. The function calculates the percentage change in volume over different time frames (24 and 36 hours) and triggers a warning (pnd_volume_warn) when the short-term volume exceeds the long-term volume by more than 5 times. This helps the bot avoid entering trades during potentially manipulated market conditions.

These functions calculate Bitcoin-specific indicators: base_tf_btc_indicators tracks Bitcoin's long-term price trend, while info_tf_btc_indicators computes the 8-period RSI for momentum. Both functions rename columns with a btc_ prefix for easy identification in the data.

In this section the indicators are defined on which the trading algorithm is based. These indicators will be added to the dataframe and then be used in the buy and sell signals later. I will not go over this line by line and this is pretty self-explanatory too I think. So let’s continue with the buy and sell signals:

This populate_buy_trend function defines the logic for generating buy signals. It checks multiple conditions for buying, including whether the price is below certain moving averages, the RSI levels, and the EWO value. It adds signal tags to each buy condition like lambo2, buy1ewo, buy2ewo, and cofi depending on which conditions are met.

An interesting thing is added at the end here. It negates buying opportunities during pump-and-dump warnings or when Bitcoin's RSI is too low, preventing risky trades.
So when these conditions are met, then before this function is finished, the buy signal 1 has been set to 0 again. Which prevents the actual buy. A pretty neat and clever trick that I cannot remember seeing earlier.

The sell settings have a similar pattern as the buy signals. Multiple conditions are set to generate a sell trigger so hopefully these will do the job of exiting without or with minimal losses. Because of the disabled stop-loss setting.

Now to finish this walkthrough. There is also a dca class that is derived from the original EI3 class above. But I will not test this in this video. But you are always welcome to do this yourself and if you want add your findings to the comments section below this video.
I want to start as quickly as possible with the backtests to see how this algo performs.
So if you subscribe to this channel quickly , click the like button of this video and add a few random letters to the comments section like GRT, or THX, or even URGOAT then I can present you with the findings.
Backtest results
So after backtesting this strategy I got the following results back from the engine.
By the way I also tested this algo on possible lookahead bias, but the included command for finding this future snooping did not find any…

This strategy performs pretty well I must say.

The 5 minute timeframe shows the most profitable results with a really optimistic 5935.60% profit and a high win rate of 95.54%. Despite the strong performance, the max drawdown of 47.84% is notable and indicates the strategy can experience significant losses during unfavorable conditions. The Calmar Ratio of 6.10 and Sharpe Ratio of 4.87 suggest a good balance between risk and return over this period, though risk management may need refinement given the drawdown. The given that 65 percent of my used pairs has a favorable response rate might suggest that other pairs can get good results with this algorithm too.

The equity curve shows that wins steadily increase over time, especially from mid-2020 through 2021, reflecting a consistent success rate. However after the 2021 bull market (marked by the yellow dashed line), wins continue to grow, but the profit curve begins to falter. This gives me the impression that divergence between growing wins and falling profits post-bull market might suggests that the profitability of trades decreases significantly in bearish or volatile conditions.

The drawdown analysis shows significant peaks, exceeding 40% in both 2020 and 2021, particularly during volatile market periods. After the 2021 bull market, drawdowns increase in frequency and severity, indicating the strategy's struggle in less favorable conditions. The high average drawdown of 20.45% in this plot range suggests the need for better risk management in my opinion.

The left box plot shows that the winrate is tightly clustered around 95%, indicating consistent success in trades. But outliers exist below 80%, suggesting occasional weeks of poor performance, but these are rare.
The profit distribution shows more variability, with a median profit around 0 and outliers extending to both large gains (above 10,000) and significant losses (down to -20,000).
This highlights that while the strategy wins often, the magnitude of profits and losses can vary greatly, with some weeks experiencing substantial losses despite the high win rate.
So even when the strategy has a strong win rate, profit outcomes are highly variable, reflecting the risk of occasional large losses despite frequent successful trades.

The EI3v2_tag_cofi_green strategy leads in win percentage compared to other strategies, indicating strong winning performance. However, it has the highest drawdown, reflecting significant risk exposure. In addition to this, it also falls short on the profit factor. This suggests that it wins frequently but the size of its profits might not consistently outweigh significant occasional losses.
Nonetheless, these results are still some to be proud of and in this chart there are no strategies anymore that are flatliners in comparison with the best scoring algorithms.

And with these backtest results, this strategy ends up somewhere in the top 20 of best performing algorithms on backtests.
Ending
Now remember that a trading Idea and backtests results only show one half of the complete picture. The next thing you should do, if you are interested in exploring this algo further is to try to find out why it has bad performance under bearish market circumstances.
But most of all a decent forward test under live market circumstances gives you the best information on the actual performance of a trading algorithm. For more information on that you can always see my previous video where I test some of the best algorithms found so far. These tests will show you some hard but honest and sobering evidence on the real performance of some of the best strategies.
For now, this is it. Thank you for being a Patron and see you in the next post.
Goodbye!!
2024-09-06 17:00:00 +0000 UTC
View Post
Introduction
In this post I will present you the tests of a strategy called “RSIDirectionalWithTrendSlow”. It is a Freqtrade strategy designed by Paul Csapak, aiming for discerning traders who prefer to operate within the hourly timeframe. This strategy leverages a combination of Relative Strength Index (RSI) and Exponential Moving Average (EMA) indicators to identify optimal trading signals in the crypto markets.
Beforehand I have to tell you that the original strategy has the trailing stop loss funtion enabled. This feature can be used when real trading, but during backtests it can present results that are overly optimistic and cause a positive bias for the algo to use. While in reality it can very well underperform.
So I tested this strategy with and without the Trailing stop loss so that you can see the differences in results and are able to better decide on whether you want to build on this strategy or not.
This time you might be in for a surprise (at least I was), since the noTSL had a timeframe that performed way better then expected.
So let’s continue…
The Strategy

The strategy operates on a one-hour (1h) chart. This timeframe balances the need for minimizing market noise found in shorter timeframes while providing more trading opportunities than longer timeframes.
Stop Loss: A stop loss is set at -20% to manage risk, allowing trades enough room to maneuver in volatile market conditions without closing too early.
Trailing Stop: Not enabled in this strategy, which could be a point for future optimization to secure profits during favorable trends. However, as I have said, using this while backtesting can lead to unrealistic overoptimistic results.

The indicators used are:
RSI (Relative Strength Index): Configured with a period of 10 (denoted as rsi_slow), which is relatively short. The RSI is used to gauge momentum and identify potential reversals by measuring the speed and change of price movements.
EMA (Exponential Moving Average): Set at a period of 600, the EMA600 acts as a trend filter. Its primary role is to determine the long-term market trend, ensuring that trades align with the general market direction.

As for the trading Logic, buy signal conditions are:

The buy signal is primarily based on the RSI indicator crossing above the threshold of 25, suggesting a shift in momentum from bearish to bullish.
The price must be trading above the EMA600, ensuring that the buy is placed in an established bullish trend.
A volume filter is applied to confirm that the signal is backed by substantial market activity, mitigating the risk of entering on a false signal due to low liquidity.

Sell signal conditions:
A sell signal is generated when the RSI falls below 20, indicating a loss of bullish momentum.
Alternatively, if the price drops below the EMA600, it suggests a potential trend reversal or weakening of the bullish stance, triggering a sell to exit the position.
Backtest results
After testing this trading Idea on my backtest setup for baselining and comparing the results with other strategies, I got the following results:
With TSL Enabled:

With TSL Disabled:

So you already see here a major improvement in the strategies performance, only by disabling the TSL. However here the best timeframe shifts from the 30 minute TF to the 4 hour TF too because of this.
Because of these different timeframes, comparing the other plots is not really usefull, since each timeframe has its own ‘profile’ so to speak.
But to give you something to compare the performances of these two algo’s I present you the plots that are created by Freqtrade over multiple performance indicators.
With TSL:

Without TSL:

The big difference here is that on the 4 hour there are apparantly one majow pump of Doge catched, that made this timeframe perform much better. The Timeframe enabled version shows a much more controlled rise.
Conclusion
After seeing both these charts I have no real trust in both versions of this algorithm. Therefore I will present you the results and findings of my backtest in Blogpost form. To prevent you from the mistake or investment of time to investigate, this algorithm.

Thank you for reading and I will see you in the next post!
Goodbye
2024-09-06 09:00:01 +0000 UTC
View Post
Introduction
Hello, everyone! In this post, I'll dive into the "Matoa" trading strategy, an algorithm crafted for the Freqtrade platform by a developer known as STASH68. This strategy employs several complex techniques to make trading decisions in cryptocurrency markets. So, let’s break down how this strategy works and discuss its potential effectiveness and applicability.
Strategy Overview
"Matoa" utilizes a variety of technical indicators and custom logic to determine the optimal times to enter and exit trades on a 5-minute timeframe. It aims to capitalize on short-term market movements by employing a set of rules defined for buying and selling based on the behavior of these indicators.
Key Components of the Strategy
Hull Moving Average (HMA): This is a pivotal element of the buying logic. The strategy uses different lengths and offsets of the HMA to identify potential buying opportunities when the price is favorable compared to the HMA.

Exponential Moving Average (EMA): For selling signals, the strategy relies on different configurations of the EMA. The EMA helps determine if the price has reached a point that suggests a profitable exit.
Volatility: The strategy uses standard deviation to measure volatility, which helps in filtering entry points based on the market's stability.

Protections: It includes a cooldown period to avoid re-entering trades too soon after an exit, which helps in risk management.

Entry Conditions
Buying Conditions: The strategy generates a buy signal if:
The current price is less than one of the calculated HMAs.
The market volatility is within specified limits, ensuring the trade is not made in overly volatile conditions.

Each buying rule is accompanied by specific conditions using rolling windows and checks against historical data, ensuring robustness in the trading signals.
Exit Conditions
Selling Conditions: A sell signal is triggered when:

The strategy also incorporates a trailing stop loss, which dynamically adjusts the stop loss level as the price moves favorably, allowing for protected yet flexible exit points.
Advanced Features
Indicator Optimization: Many of the parameters for the indicators used in "Matoa" are optimized through backtesting, which means they have been adjusted to maximize performance based on historical data.
Backtest results
Before we jump in, remember that backtesting is a simulation. Past results don't guarantee future performances, but they can give us valuable insights. So, take this analysis as a learning tool, not a promise of profits.

Let's pull up the results chart and unpack the numbers. The strategy was tested on a 4-hour timeframe, and here's how it panned out:
End Balance: The final balance stood at $1945.35, turning a significant profit from the initial investment.
Profit Percentage: An impressive 94.54% gain! This figure is enough to turn heads in any trading circle. But be aware that there are many other trading strategies that perform way better then this.
Win Rate: More than half of the trades were winners, at 57.71%. A win rate above 50% is often considered good in trading, as it means more wins than losses. But winning trades do not say the complete story, its also a matter of keeping those gains. And we will explore that further down this post.
Maximum Winning and Losing Trade: The strategy's biggest winner brought in 15 times the risk, while the biggest loser cost 8 times the risk. This ratio of winners to losers is crucial as it speaks to potential risk management.
Compound Annual Growth Rate (CAGR): At 0.14%, it's relatively low, suggesting this strategy may not be the best for those seeking aggressive annual growth.
Maximum Drawdown: This sits at 8.64%, indicating the largest drop from a peak to a trough during the backtesting period. It's moderate, showing a controlled level of risk.
Calmar Ratio: At 1.57, it shows a decent return compared to the drawdown risk.
Sortino Ratio: This is at 2.26, which suggests that the strategy provided a good return on the risk taken, considering only the negative volatility.
Sharpe Ratio: At 0.67, it's a bit on the lower end. The higher this ratio, the better the risk-adjusted returns, so there might be room for improvement.
Profit Factor: At 1.44, the strategy earns $1.44 for every dollar lost, which is a solid indicator of its profitability.
Pairs Percentage: 61.22% of pairs were profitable, which is a strong outcome, showing that the
So looking at these results, Matoa seems to be a promising strategy, especially with its high profit percentage and reasonable management of risk. However, the low CAGR may raise questions for long-term growth expectations.
But looking at the end results only tell one part of the complete story, so let me also show you how this algo performs over time:
First up, we have the cumulative wins, draws, and losses chart over a weekly period. You can see from the chart that the cumulative wins (in green) ramped up significantly leading to the bull market peak of 2021.

Moving on to the drawdown analysis chart. The red line indicates the drawdown percentages, which measures the decline from a peak in the equity of the strategy. The average drawdown, displayed by the green line, gives us an indication of the typical losses you might expect during trading.

Now, let's talk about the win/loss ratio chart. The bars represent weeks where the strategy had more wins (in green) than losses (in red), and vice versa. The tall green bars right before the 2021 bull market peak tell us that the strategy was having significantly more wins than losses, aligning well with the cumulative profits chart.

Lastly, we compare Matoa's performance with other top strategies in various categories such as total score, profit factor, and Sharpe ratio. Matoa stands out with a high total score, but when it comes to the Sharpe ratio, which measures risk-adjusted returns, there's room for improvement.

Conclusion
As we come to the end of our analysis, let’s take a moment to critically assess what we've uncovered about the Matoa strategy through our backtesting deep dive. While we saw some impressive peaks and a strategy that capitalized well during the bull run, it's essential to step back and look at the bigger picture.
When compared to other strategies, Matoa shows it has potential, but it doesn't top the charts. The win/loss ratio was healthy in the up-trending market but remember, a strategy is tested by its performance across various market conditions. When we look at the Sharpe ratio, it’s evident that when you adjust for risk, Matoa's returns are not as competitive. This suggests that while Matoa could be a piece of the puzzle, it may not be the cornerstone of a robust trading portfolio.

Additionally, the strategy's Compound Annual Growth Rate (CAGR) is low, which indicates that it might not be the best fit for traders looking for aggressive growth. The drawdown spikes also suggest that it might have periods of significant risk, which could be a red flag for more conservative investors.
It's vital to approach any strategy with a healthy dose of skepticism and consider how it fits within your risk tolerance and investment goals. Matoa, while having its moments, does show that there are better-performing strategies out there that might be more deserving of your capital.
To my patrons, I extend a heartfelt thank you for your support. Your contributions make these deep dives possible, and it’s with your backing that we continue to provide unbiased, critical analyses of crypto trading strategies. Your support is incredibly valued, and I'm excited to bring you even more insights to help you navigate these ever-changing markets.
Remember, no strategy is perfect, and backtesting is just one tool in a trader’s kit. Stay tuned, stay informed, and let's keep striving for those optimal trades.
Until next time, thank you for watching, and thank you for your support.
Goodbye!!
2024-08-30 14:00:01 +0000 UTC
View Post
Prelude
This post contains all the configs, compose files, strategies, freqtrade user files AND ALL TRADING DATABASES WITH THE TRADES of the bots that I used for analyzing and of the video. For your reference and further analysis if you like to do that.
---
In this post I will present you the forward testing results of NINE different trading strategies that I have tested under real cryptocurrency market circumstances.
So if you want to know how some of the best trading strategies perform real live trading conditions, then you cannot miss this video!
Introduction
Hello everybody, and welcome to another video where I dive into algorithmic trading strategies that have the potential to attain live changing money for you.
This time I want to present you with the forward testing results of nine of best performing strategies that I have found so far.
In other words, this is the “proof of the pudding”, the “walk the talk” and the “show me the money” phase where you test a newly found trading strategy, that has been performing well in backtests, and now put it to the test in real world trading to see if it really does what it promised to do.
I do not want to lose money and probably neither do you, so this is a crucial phase in choosing a trading strategy for real live money trading.
Setup
If you have read my earlier posts then you probably know that I like to search for the best trading algorithms that have the highest probability to earn wealth in the future as well.
My main tool for backtesting strategies is the backtesting engine you can find in the Freqtrade trading bot. It is relatively simple to use if you put some effort in learning how to use this bot. And it also provides with lots of helpful information about the performance of a trading strategy.
All the trading strategies that I use therefore also has to be programmed into code so that I can automatically test on multiple assets, on multiple timeframes and with a dataset that spends many years of backtesting data.
By testing a trading strategy this way I can attain multiple advantages like:
I can simulate the most realistic backtest for a trading strategy.
I can prevent the human psychology factor
Also, by changing a trading strategy into a hardcoded algorithm I can prevent that I deviate from my trading strategy while testing
And most important of all, after extensive backtests, I can automatically start with the forward test of multiple strategies at the same time. Which spreads my risks and saves me loads of time too.
The main reasons for concern in these tests are:
Errors in the code’s logic,
Programmed lookahead-bias or
strange, but nonetheless real, market circumstances in the dataset that might causes some results to be overly optimistic or instead make a good trading idea perform terrible.
This is why, after backtesting, you should always forward test a strategy in the real market as well. To see if it really performs this well (or bad) and to get realistic expectations for the future.
Be very aware however that all trading strategies can lose their edge in the market at some point in time. So maintenance of your trading strategy is always recommended after you start to use it in trading.
Technical setup of the bot
In the following slides I show you some of the technical details I have set up on my trading bots to let them test in the real market.
I have configured nine separate trading bot instances. And each bot uses its own trading strategy. The strategies I use are the best performing strategies from the backtests I have done over the last couple of years.
You can find the complete list of trading strategies I tested in the Strategy League that I have published on my website dutch algotrading dot com.
Many of these trading strategies results are also tested and presented in my video’s so if you want to get more details about these well performing trading algorithms, then check out my channel and the strategies playlist there.
Master Swing Trading with the Bollinger Bands Trend Indicator! (youtube.com)
More on which strategies I tested after a moment.
Each bot is allowed to only have three trades open at the same time.
I use a start amount of 1000 USDT with a tradeable balance ratio of 99%
All the best trading algorithms that I have found so far only do spot trading. So shorting is not used in this test.
Also, since I live in the Netherlands, Bybit is the only best option to do this kind of test. No Binance allowed here.
In this test I use the following pairs. These pairs are selected on their marketcap and also on their trading volume over the last year on the Bybit exchange. I wanted to use pairs with liquidity. To get into and out of the market without the least amount of spread. So I created a script to query the exchange on these criteria and got these to use in the test.
"BTC/USDT", "ETH/USDT", "SOL/USDT", "XRP/USDT", "MNT/USDT", "ARB/USDT", "DOGE/USDT", "SUI/USDT", "MATIC/USDT", "AVAX/USDT", "APT/USDT", "LINK/USDT", "PEPE/USDT", "LTC/USDT", "ADA/USDT", "APEX/USDT", "DOT/USDT", "CTC/USDT", "OP/USDT", "BONK/USDT", "SHIB/USDT", "BLUR/USDT", "DYDX/USDT", "BNB/USDT"
Again, all strategies are run with the Freqtrade trading bot.
Some of these bots are configured to be a Linux service. And some are using Docker. Mainly because the algo’s that are run on Docker use deprecated Freqtrade functions, so I had to use a lower software version of the bot here.
The contest and market circumstances
Besides the technical setup and the strategies there is also the broader context of the crypto market environment in which we should judge the results of the forward tests. For that I will use the Crypto total market cap chart on Tradingview, since I trade more than Bitcoin alone with these tests.
https://www.tradingview.com/chart/NmxZSutP/?symbol=TOTAL

I started forward testing trading strategies in March 2024 up until May. So some strategies run longer then others.
By a stroke of coincidence, the first few launched at the peak of the run in 2024, and others on the exact day that another peak was reached in the total crypto market cap.
Overall, the 2024 market has a bearish undertone for the most part. With lower highs and lower lows.
The most important event was the Bitcoin halving event on April 20th. This might trigger the next major bull run in a couple of months. But the periods around earlier halvings have been mostly characterized by sideways action, followed by a supply shock. Followed bij a major bull run.

I think that this time, the total market probably anticipated this move a little bit prematurely and caused a peak before the event. And now we are stuck in a somewhat sideways movement up until today.
So you now know the market circumstances in which the forward tests happened. No major bull or bear trends, but a lot of sideways action with a bearish undertone.
And this context may or may not suit the trading strategy that is tested. Some will thrive in sideways markets and some will only perform best if there are long upward or downward trends.
So this information is something to keep in mind when you see the testresults of these strategies. And it is also something to consider when you yourself test out your own strategy or a 3rd party trading algo.
Strategies and timeframes
So what about the strategies themselves?
Let me now reveal the nine algorithmic trading strategies that I used for these tests.
In random order they are:
ClucMay72018 on the 5 minute timeframe
Obelisk_Ichimoku_ZEMA_v1 on the 5 minute timeframe
BB_RPB_TSL_BI on the 5 minute timeframe
SMAOffsetProtectOptV1 on the 30 minute timeframe
ElliotV8_original_ichiv3_NoTSL on the 5 minute timeframe
NFI5MOHO_WIP on the 5 minute timeframe
MacheteV8b on the 15 minute timeframe
NASOSv4 on the 5 minute timeframe
NASOSv5 on the 5 minute timeframe
Results
I will first present the results of the 7 strategies from the worst to the best. Then I will show you the results of the worst performing trading strategy and finally the strategy that performed the best.
ElliotV8_original_ichiv3_NoTSL
The first strategy I'd quickly like to discuss is the ElliotV8 Ichimoku. In the strategy League this strategy currently ranks within the top 12 of best performers. With high gains, a good win rate and moderate drawdown.
In a forward test however, it performs as one of the worst. At the moment is experiences a loss of 48 USDT.
The fact that is still has a 53 percent win rate with, in total 67 trades, does not help here. This strategy has a profit factor of just 0.79. Which means that on average, it loses money while trading.
And you can see in the Period Breakdown table on the left left, in the profit column, that over all the months it ran, it lost money. So this algo never managed to make any profit in the forward test.
In the cumulative profit chart you see that in the beginning it started positively. But the current market circumstances are not favorable for this algorithm. Why this is the case has to be examined more in depth and trade by trade. Which I will not do in this video.
It's possible that more bullish markets with long parabolic runs fit this strategy better because in backtests it performed well and that should come from somewhere. But for this to find out, I have to test longer and wait for the next bullrun. 
For this moment, this is the result of the forward test.
Let me continue with the next trading strategy.
ClucMay72018
Before I happened to find and test very well performing, but highly complex trading algorithms on the internet, the Clucmay strategy was one of the best performing strategies I had. So for me it was clear that, if I wanted to do a forward test, then this should be one of the algorithms I would include.
Unfortunately, the results of the backtest over a long period of trading data proved to give a different view then what actually was its real time performance.
Until now this algorithm has a negative result of 27 USDT with 60 wins over 35 losses. Giving it a 61% win rate.
In total there were 98 trades where APEX and PEPE were the coins with the majority of trades. 
It’s good to know that the bot started with a losing month but eventually also made some positive months. But as you can see in the period breakdown table. A couple of losing trades can really spread havoc on your balance.
This is also clearly visible in the cumulative profit chart in this final overview.
NFI5MOHO
The NFI5 MOHO, in other words an alternate version of the “Nostalgia for infinity” trading algorithm, is the first that has a modest profit over the forward testing period.
What is remarkable here is that this trading algorithm currently holds the top position in the strategy league. But it does not rank highest in the forward test. 
Between May and August it managed to attain a profit of 115 USDT. With the help of 34 wins over 6 losses, that’s a 85 percent win rate. Really nice work here I must say!
These numbers give us a expectancy ratio of 2.92 and a profit factor of 3.62. 
Also the bot was started in may so it had less time to acquire this amount, which makes it extra special.
June was the only month where this strategy did not perform great, with a minor negative result. But in July it managed to had 10 percent profit over the month. Not bad I must say…
PEPE was again the best coin to trade with here.
Overall you can see at the equity curve in the cumulative profit chart that there was a drawdown at the start of august. Which is not a surprise, since last august’s start was very turbulent and has the last lower low over this bearish period.
A really good performance so far and this makes me curious on how well this trading algorithm would perform if the bull market really started off.
NASOSv5 mod3
Anyway, the next trading strategy with even better results and that started at the same time as the NFI discussed just now, is called the NASOS version 5.
This strategy is also currently one of the best trading algo’s I have found so far. And it stands at a proud number three position in the Strategy League.
Here an unbeatable 15 wins over zero losses gives it a 100% win rate. Not too shabby.
It also manages to attain a profit of 156 USDT in the same period as the NFI5. Mainly because of PEPE again.
From day one it only has green months and as time progressed it managed to gain a higher profit percentage over the months.
But besides these positive things there also hides a potential problem.
Because 15 trades over 4 months is pretty low for a 5 minute timeframe. While others have at least 40 on the 5 minute timeframe.
It could therefore be that these trades are just luck and this is no well balanced trading strategy where more risks are taken but also more profits can be attained.
So keep this in mind when you want to investigate this algo on your own setup.
SMAOffsetProtectOptV1
Moving forward, we come at the SMAOffsetProtectOptV1 trading algorithm.
This forward test started in March so it’s logical that a higher ROI has been gained here.
In total this strategy attained 170 USDT on a 30 minute timeframe, over 27 wins and only 4 losses. The drawdown experienced during this period was slightly over 9 percent.
And PEPE was again the largest contributor to this profit.
The expectancy rate is 5.32 and profit factor 1.82. 
You can see in the period breakdown that there were two months that were outliers. One with a loss and another without any trades for some reason.
Also in April this year the account balance was momentarily under water, but recovered fast and decisively.
So, In short for the first strategy that operates on a higher timeframe, these are numbers that an avid trader can be proud of.
NASOSv4
Now the next trading strategy that I forward tested is the NASOS version 4 on the 5 minute timeframe.
This algorithm has the second place on the strategy league and in this list is also is placed at a well deserved third spot. 
With a slightly higher profit of that of the SMAOffset strategy, 171 USDT, it attained this ROI over a much shorter period of time. Since I started to test this algorithm at the end of May. So well done here…
Until so far this algo has a win rate of 95 percent, caused by 39 wins over only 2 losses. That’s also truly admirable here. The drawdown also is slightly over 5 percent too until now.
The expectancy ratio is 4.18 and the profit factor is 4.11.
What’s funny is that PEPE is also the best performer here. 
Over the months that this algo has been running it only made green numbers each month, with a 6.39 percent overall gain over the month of June.
The cumulative profit curve also shows that after some periods where the line stays flat, sudden increases in profits are gained. And in that turbulent period of August, this bot remained calm and actually did not trade at all. Only to catch new trades after the dip happened.
No financial advice, but if I had to choose an algo for my trading bot at this time, then you’ll know which one I would keep my eye on.
BB_RPB_TSL_BI
But it’s not over yet because I still have three more strategies to discuss here.
The next winning algorithm in my backtest is the Bollinger Real pullback.
This 5 minute strategy attained a 182 USDT ROI with 44 winning trades over 2 losers. That’s again an almost 90 percent win rate here. The drawdown is even better. Only 3.35 percent.
Now to be honest, this strategy was started in march so it had a headstart over the NASOS v4 algorithm. But nonetheless the numbers speak for themselves in this slide.
This time MNT/USDT was the biggest gainer for this algo. But PEPE was close behind with a third spot.
Only in the first month of testing there were negative numbers, but soon after that the profit exploded over the month of march and managed to stay positive over the other months as well.
Which is also clearly shown in the cumulative profit curve of this screen here.
Worst performer
So now we come at the moment where we find out which algo is the worst and which one is the best performer.
Besides good performing trading algo’s there also has to be one that completely fails miserably. Unfortunately this time it is a trading strategy that fails to meet its high expectations…
It was the first trading algorithm that I found that managed to create over a million USDT from 1000 dollars in a backtest. At the time I got those results I was very anxious to test this in real live. Not only because of the high expectations but also because the video where I presented my results got some negative comments as well. Without adding any suggestions to improve the test or explain some of the results. Giving positive criticism so to say.
Anyway, now that I tested this algo and got its real time results it is time to expose the real impostor of this list.
And unfortunately this is the MacheteV8b trading algorithm.
Now to start of with some possible explanations on why this algo performs so badly.
To run this strategy code I had to downgrade the backtesting software to an older version to make some of the deprecated functions run again. That’s why you also do not see some of the information you saw earlier. It just wasn’t available at that point.
In the Performance list with the used pairs you can also see that some coins, like Binance, do in fact respond good to the algorithm. But most others do not. To the point where heavy losses are made.
But the reason that has the highest possibility of causing these losses are hidden in the close reason of most of the trades.
Because every time a loss occurs, it has the close reason “trailing stop loss”. This could be caused by either the build_in trailing stop loss or the optional but available custom stop loss in this algorithmic code.
But since I configured the code to not use the build in trailing_stop_loss is suspect the custom stop loss.


And for some reason this was not detected in the backtest of the strategy.
Custom stop loss should be taken into consideration with backtesting, according to the developers of the bot. See custom stoploss & backtest · Issue #4357 · freqtrade/freqtrade (github.com)
And it is hard to believe this is the real issue. But still it is strange to see that most of the time this trailing stop is triggered and causes a losing trade.
My final thought is that it is another bug in the strategies code or in the software itself. But this should be investigated more thoroughly in the future.
For now it is just a slow bleed to the bottom of your trading account as you can see here.
But to stay positive, we learned a very good lesson here today.
Because if we did not do these forward tests, then we would certainly found this out with real money and thus with real losses.
Best performer
And with this valuable lesson learned we’ve come to the final and best result of this forward test.
Which cryptocurrency trading algorithm has the highest, and above all - proven, potential to make gains in the market?
Until it loses it’s edge ofcourse…
And it is the Obelisk_Ichimoku_ZEMA_v1 algorithm!
Started in March, this algorithm made an ROI over all trades of 311 Tether.
Made with a total of 129 trades on the 5 minute timeframe. With 84 wins and 45 losing trades, that gives it a 65 % win rate.
And an experienced drawdown of around 9 percent.
All recognizable numbers so far.
The algo has an expectancy of 2.42 , so basically the amount you stand to gain (or lose) for each dollar of risk. And a profit factor of 1.6 which is a quantitative evaluation of a strategy’s ability to generate profits relative to losses.
Again Pepe has the best overall performance. 
The period breakdown shows a good start of this forward test with an immediate 11 percent profit in the first month. Only the last month has some weaker numbers.
From the Cumulative profit plot you see that this strategy has regular trades and is very active. Most of the trades end up with a profit. And that’s logical considering its results so far.
The performance of this trading algorithm, under the circumstances the market is currently in is truly admirable. With this algo I am again curious to see what the performance would be if the bull market really takes off.
You still have to remember that this is a test without real stakes.
But you cannot get any closer or get more realistic results then this if you want to simulate a strategies performance in the market.
Conclusion and goodbye
And with this reveal we come at the end of this post.
I hope you learned something valuable from this forward test. Like the importance of it and its uniqueness on Youtube as far as I can tell.
Also it adds valuable insight to which cryptocurrency trading algorithms to investigate further and which to abandon.
Thank you very much for being a supporter and I’ll see you in the next post. Because I will continue to search for the best algorithmic trading strategy for crypto.
Goodbye!
2024-08-30 08:10:54 +0000 UTC
View Post
Introduction
Hello dear readers, this time another trading strategy that I tested, but did not have the superbest results. However this algo is something special since the author has tried to simulate a Tradingview Indicator called “LuxAlgo Supertrend Oscillator”.

The accompanying text in this indicator windows is as follows:
“This oscillator is made of three components, all derived from the SuperTrend indicator. This approach allows the user to easily determine overbought/sold zones, identify whether a retracement is present or if the price is ranging or trending. It also allows for the anticipation of the potential price cross with the SuperTrend.
We provide additional information including whether a signal returned by the SuperTrend was false, as well as the percentage of false signals.
Usage
The indicator is in a range of (-100,100) with values closer to 100/-100 indicating a stronger trend. The main oscillator value above 0 indicates that the price is above the SuperTrend.
It is possible to identify when a retracement is present in a trend. This is often indicated by an oscillator value moving within 50/-50.
Each overbought/oversold level can be used to determine potential exit points.
The indicator also includes two additional oscillators derived from the main oscillator. A smoothed version of the main oscillator (Signal), and a smoothed version of the difference between the Main and Signal oscillators (Histogram), thus making the oscillator part of the indicator more similar to MACD.
One can use the histogram to anticipate when the price might cross the SuperTrend by comparing the sign between the main and histogram. Potential false signals can also be filtered with this method.”
All other information about this Tradingview indicator is located on the following webpage: SuperTrend Oscillator [LuxAlgo] — Indicator by LuxAlgo — TradingView
The author of the Freqtrade Strategy Code is: “viksal1982 viktors.s@gmail.com” and you can contact him if you have any other questions or nice remarks. Compliments are also always nice to get 😊
Strategy code
Anyway, let us concentrate on the code itself. It is a very interesting code since it has to simulate the Tradingview Indicator. Here it is called the the LUX_SuperTrendOscillator function, which computes several components crucial for trend detection and trading decisions. Here's how it works:
Calculating ATR and Price Bands: The function starts by calculating the Average True Range (ATR), which is used to determine market volatility. It then calculates the median price and uses both values to compute the upper (up) and lower (dn) bands.

Dynamic Upper and Lower Bands: The upper and lower bands are adjusted dynamically based on previous values and the price action, helping to track the trend more closely.

Trend Determination: The trend is determined by comparing the closing price with the dynamic bands. If the close is above the upper band, the trend is up, and if below the lower band, the trend is down.

Oscillator and Signal Calculation: The oscillator value is calculated as a normalized difference between the close and a super trend plot (spt). An adaptive moving average (AMA) of the oscillator serves as the signal line.

Histogram for Momentum Visualization: Finally, a histogram is derived from the difference between the oscillator and its signal, indicating the momentum and potential trend reversals.

Buying and Selling Logic
Within the LuxOSC class, which inherits from Freqtrade's IStrategy, the trading signals are generated based on the conditions set by the oscillator and other parameters:
Buy Signal: A buy signal is triggered when the oscillator crosses above a certain threshold and the price is below the super trend line, suggesting a potential bullish reversal.

Sell Signal: Conversely, a sell signal occurs when the oscillator crosses below a designated threshold, indicating a potential bearish turn.

Strategy Parameters and Customization
The strategy parameters such as length, mult, and smooth are adjustable, allowing traders to fine-tune the sensitivity and behavior of the oscillator based on different market conditions. These parameters are used dynamically within the strategy to adapt to the current market volatility and price action.
Good code of this strategy and creating the indicator is not the goal of this exercise ofcourse. The profitability of the complete algorithm under real live market circumstances is the goal here, and backtesting it is the first step in this process.
Backtest results

Let me get straight to the point here, the code looks very interesting, but the potential to make money isn’t there as you can see in the results table.

In the accompanying chart, we have a visual representation of the LuxOSC strategy applied on a 15-minute timeframe, where the performance is measured by win/draw/lose counts and cumulative profit over time. The yellow line denotes cumulative wins, which pleasingly trends upwards over time, while the red line indicates cumulative losses that also rise but at a slower rate. The green line represents cumulative profit and shows a general upward trajectory, suggesting that the strategy, while profitable, does experience fluctuations in performance. Notably, the spikes and troughs in win and loss counts, particularly around the dashed line marking the 2021 bull market top, suggest a strategy sensitive to market volatility. After this point, we observe a pronounced volatility in win counts and a notable dip in cumulative profits, implying the strategy might be over-optimized for the conditions preceding the market peak or that it struggles to adapt to the changing market dynamics post-bull run. The decline in performance after the market's peak raises questions about the strategy's robustness and adaptability to different market phases, emphasizing the importance of continuous optimization and risk management to maintain steady returns.

The drawdown chart before us paints a stark picture of the risks involved in the LuxOSC strategy when applied to a 15-minute trading window. Drawdown, represented by the red line, measures the peak-to-trough decline during a specific recorded period of investment. We observe periods where drawdown spikes dramatically, notably around the 2021 bull market top indicated by the dashed yellow line. This suggests that the strategy may have been significantly impacted by the volatile conditions surrounding the market's peak. While the drawdown does show a general improvement over time, the green line, indicating the average drawdown, remains at a relatively high 42.95%, signaling that potential for large losses has been a consistent trait of this strategy. Such metrics underscore the importance of a comprehensive risk management strategy to mitigate the significant downturns and protect capital.

Here we have a two-panel chart illustrating the performance metrics of the LuxOSC strategy on a weekly period. On the left, the win rate distribution is depicted using a box plot, where the strategy shows a median win rate around 60%. The interquartile range (the height of the box) indicates a relatively consistent win rate performance, with the majority of the data points falling within the 60-80% range, showing a stable probability of individual trade success.
On the right panel, we observe the profit distribution. The spread of the profit data points suggests variability in the outcome of trades, with several outliers indicating substantial losses that could signal the presence of tail risk. Despite a cluster of profitable trades around the median, the tails extending towards significant losses highlight the need for caution. Such an asymmetric distribution with fat tails towards the losses accentuates the potential for infrequent but severe negative outcomes, underscoring the necessity for stringent risk management strategies in trading.

As you can see, the LuxOSC also has an overall 'total_score' that is quite low.
It is one of the better performing algos in the 'win_perc' category. But a high winrate is no guarantee for high profits.
LuxOSC's 'drawdown' is moderately high, suggesting that while the strategy may win often, it is not immune to significant drops in value, which could be concerning for risk-averse traders. The 'profit_perc' and 'profit_factor' also place LuxOSC in a favorable light, showcasing its ability to generate profits and maintain a good ratio of gross profits to gross losses, but nevertheless the overall profit stays low here.
The 'calmar_ratio', 'sortino', and 'sharpe' ratios are crucial for evaluating performance in relation to risk, and here LuxOSC's performance is extremely low. Notably, in the 'ES_CVaR' (Expected Shortfall and Conditional Value at Risk) metric, LuxOSC demonstrates a potential concern, indicating a significant expected loss in the worst-case scenario, which traders should not overlook.

So as you can already guess, the results of this (on and by itself) interesting algo code, is quite disappointing. I’m not entirely sure if this is caused by faulty code or that the strategy is just not favorable to crypto pairs in general.
The idea is interesting and I will certainly take this code into my bamboo_ta module at a certain point in time. But the strategy and the results itself will be archived and I have no plans to use these further.
Anyway, these are the results for this algo. As usual you can use the code at your own risk and learn from it by tweaking it furtner.
But I will leave it at this.
Thanks for reading the post and I will see you in the next one,
Goodbye!
2024-08-23 07:00:01 +0000 UTC
View Post
The Ichess algorithm for trading crypto
Introduction
In this short post I will present the results I got from backtesting the Ichess trading strategy. The strategy is available in the following github repository: PeetCrypto/freqtrade-stuff: Strategies for Freqtrade (github.com). This repository contains many other algorithms too that I tested or one day will test.
The code is also available in other repo’s if you search GitHub: Code search results (github.com) In case the PeetCrypto repository will get offline.
The algorithm is created by @Mablue (Masoud Azizi). A developer of which I tested lots of strategies in the past.
The strategy
The "Ichess" strategy uses various components of the Ichimoku Kinko Hyo indicator, commonly known as the Ichimoku Cloud, combined with additional conditions and scoring systems to determine buy and sell signals in cryptocurrency trading.
The strategy involves computing several signals derived from the Ichimoku Cloud and assigning scores to these signals based on their bullish or bearish implications. A cumulative scoring system is used to integrate these signals over a period, which helps in deciding the trend (bullish or bearish).
Without getting into much detail on each and every line of code, I will describe the key components of this algorithm.
The strategy uses the the Ichimoku Cloud. It utilizes multiple calculations to form a 'cloud' on the trading chart that helps to visualize support, resistance, momentum, and trend direction.
It also uses the Heikin Ashi indicator. This indicator is used to average price data to create a Japanese candlestick chart that filters out market noise.

In the code there is a separate method (function) created that is used for the scoring. Signals derived from the Ichimoku Cloud and price action are scored as follows:
Tk Cross Score (Tenkan and Kijun Cross): Checks the crossing of the Tenkan line over the Kijun line, indicating potential bullish or bearish movements based on their relative positions and intersections with the cloud.
Pk Cross Score (Price and Kijun Cross): Assesses the crossing of the price over the Kijun line, which is a direct signal often used to confirm trends.
Kumo Breakout Score: Identifies breakouts from the cloud, which can suggest strong trend continuations.
Senkou Span Cross Score: Evaluates the crossing of Senkou Span A over Senkou Span B within the cloud, indicating potential trend changes.
Chikou Span Cross Score: Looks at the position of the Chikou Span in relation to the price 26 periods ago, providing insight into market sentiment.

Furthermore, the strategy uses various vectorized functions (np.vectorize) to apply the logic across the dataset efficiently.
And finally these scores are summed up for each time period and accumulated over time to form an Ichimoku_Score.

Median scores and other statistics can be calculated and used to adjust strategy parameters dynamically.
The code is quite extensive for calculating these scores. Eventually the buy and sell signals are calculated in their corresponding methods.
Buy Signal
The buy signal is generated when the fast timeperiod Ichimoku_Score crosses above the slow-moving Ichimoku average, indicating a shift towards a bullish trend.
Sell Signal
The sell signal is triggered when the fast-moving average of the Ichimoku_Score crosses below the slow-moving average Ichimoku scure, suggesting a bearish turn.

Besides these entry and exit signals, let’s not forget that the ROI and stop loss function also will cause an exit signal too.
This strategy is suited for daily timeframes but can be adjusted for other periods depending on trading goals.

Backtest results
The extensive and complicated code has probably taken a lot of time from the author.
Since this is only a post about its results and not a Youtube video is made, you can already guess what the message for this strategy will be.

The profits that were made during the backtest are reasonable. But we already know that much more profits are theoretically made by other algo’s with less complicated structures.
It’s nice that there is almost a 50 percent win rate. But the amount of drawdown and the results of the ratio’s do not make me feel comfortable. Eventually there is a profit factor of 1.11 and slightly more than 50 percent of the pairs fit this strategy according to the results.
The equity curve, which shows the performance over time, does show some promising results.
But the end result does not tell you the whole story here.

Because during a backtest the equity curve is also registered and you can see that this strategy certainly has the potential to have good gains. But the issue here is the drawdown from the peaks.
These occur mostly when crypto is in a bear market.

If there can be some sort of breaks applied to this algotrithm when entering bearish circumstances (for example not trading below the 200 sma according to my earlier post and video about the 200 sma). Perhaps than the end result would probably be much better here.

Overall this might lead to a strategy that performs much better. The Calmar, Sortino and Sharpe ratio might improve much better and the huge drawdown column would decrease as well.
I’m not expecting wonders buy adjusting this algorithm too much though. It mainly is a good excersise in having a trading idea and testing it out if it has a chance to succeed. In this case the idea was good but in reality it did not perform as expected.

So I will end the post here and hope you got some ideas from the code itself. It makes use of different functions to score an indicators performance, which on and by itself are very good ideas. And maybe they can be applied to other trading Ideas you have.
All the output I have from this test is attached as a zip file, so I hope you can download it without errors.
Thank you for your reading and your support!
And I will see you in the next post,
Goodbye!
2024-08-16 07:00:01 +0000 UTC
View Post
FrostAura M21h and M31h strategies
Introduction
In my previous post I presented the FrostAuraM115m strategy. But shortly after posting those results I found another directory with two similar named, but different trading algos too. As a result, the outcome of these two strategies is also much different.
I did not want to keep these two different trading algo’s behind. So here are the result and let me get right down to the code of these two algorithms.
The strategy
First of all, both strategies have unknown origins, but the author was nice enough to leave some comments about the intentions of the algorithms.
The M21h version has the following comment:
The second M31h version has the following comment:

They both have different take profit and stoploss settings too:
M21h

M31h

Now these are small differences. More noticeable is the use of the indicators, already mentioned in the comments section.
M21h
M31h

Buy & sell signals
As a result, the buy and sell signals are also different.
M21h

M31h

As an avid and experienced reverse engineer, you might already know what is happening here.
The only thing that was really different I noticed was the use of a minimum_coin_price as a factor for buying or not buying. Apparently, the author has the idea that there will be a dynamic pair list used for this algo (like the volume pair list).
If you are using a static pair list with a pair used that has a very low price, then that pair would ever be used according to this configuration.
Backtest results
M21h
Let me first show you the results of the FrostAuraM21hStrategy.
The equity curve of this version is very spikey to say the least.
It might respond well to bearish circumstances, but when the bears walk in, then the gained money can be easy lost as well.
This is also noticable in the drawdown curve. Here you can see that there are no safeguards when it comes to losses. And this algorithm can therefore be hard on your psyche. The initial results arent that great in comparison with other algo’s and if you also almost lose all this money, you can argue that this is a bad strategy.

This is also clearly visible in the profits and losses over the weeks. Where the mean profit drops steeply around the half of 2021.
So let me quickly show you the overview of the backtest results of the M21H version and move quickly to the M31h version.

M31h
This chart is much better for the eye and for the hypothetical backtest wallet too.
Although there are also some remarkable things happening here too which do not make me comfortable using this strategy in real time.
To start with a positive thing here, the profits are taken, and the gains are kept. But if you look at the low number of trades there are, then you (or the trading bot you are using) would probably do not much most of the time. Which leads to opportunity costs. 
The drawdown is relatively low but again, considering the low number of trades, there is not much to fear. This is better visible in the next plot where we can see an overview of the weeks that there used for trading.
In earlier tested algorithms, there were trades made every week. Whether they were successful or not. But here it’s clearly visible that the largest part of the time there is no action whatever. 
Of course, it is not obligated to trade every day or every week and there can be periods when there are no trades made if your strategy demands it. But again, the lack of trades can also point to a strategy that is too strict and too risk averse. And scared money does not make money here.
Nonetheless my scores for this version are much better because of this reason.

But we know now that there are better strategies out there that can be profitable and have a low risk of losing it again to the market too.
So, these two strategies do not score the best and therefore also score low in the strategy league as well. 

End
And also, for this Patreon blogpost only, the results are in for these two strategies that I found on GitHub.
You do not have to search for these Python files though, since I will add them to the files that are included in this post. Together with all the other output and logs.
As promised in earlier posts, I will keep the results and posts of strategies that score below average short and concise. So, to not waste your and my time. Extensively analyzing results that will probably never be used after that anyway.
You are always invited to optimize or use parts of this strategy if you like to. But I will continue searching for other, already available strategies and test their results.
Because I still have the feeling that other algorithms will provide us with better results than this one.
This is it for now. Thank you all for being a Patron and I will see you the next time.
Goodbye!
2024-08-07 07:00:00 +0000 UTC
View Post
Look-ahead bias is a subtle yet critical concept to understand when analyzing financial markets, whether you're dealing with equities, stocks, options, forex, or cryptocurrencies. This bias occurs when a strategy is tested using information that would not have been available at the time of trading. In other words, it's like unintentionally peeking into the future when making a decision in the present.
Imagine you're a time traveler with tomorrow's newspaper in your hands today. If you use that future information to make decisions today, you have an unfair advantage, right? That's essentially what look-ahead bias introduces in trading algorithms and financial models. It makes a strategy appear more effective than it truly is because it uses information that wouldn't be accessible in real-time trading.
For example, if an algorithm incorporates the end-of-day price as a signal to make trades at the start of the day, it's indulging in look-ahead bias because, in reality, the end-of-day price wouldn't be known at the start. This bias can lead to overly optimistic backtesting results, making a strategy seem profitable on paper when it might not be in live markets.
It's crucial for traders and analysts to meticulously ensure that their models only use information that would be available at the moment of decision-making to avoid this bias. Proper data alignment, careful construction of historical databases, and strict adherence to chronological order in simulation and backtesting processes are essential steps to prevent look-ahead bias and ensure the integrity and reliability of trading strategies.
By understanding and avoiding look-ahead bias, traders can develop more accurate and realistic models, which is essential for navigating the complex and fast-paced world of financial markets with confidence and success.
The reason for this video is the feedback I got from my last strategy testing video.
There I tested the Machete strategy and people from the community notified me that these unrealistic spectacular results were caused by lookahead bias that this algo has.
And although I explicitly warned about this in the video this feedback made me wonder if there is any way to detect if an algorithm has lookahead bias.
Luckily for us there is a function in Freqtrade bot that helps us with detecting this bias.
It has been introduced in version 2023.6.
I consulted the Freqtrade documentation on this lookahead-analysis and there it also states that it is easy to introduce lookahead bias in your algorithm. But it is hard to decect that you created this bias afterwards. Except for results that maybe look too good to be true.
The documentation even literally states that "If the programmer is not careful or oblivious how things work internally (which sometimes can be really hard to find out) then it will just look into the future making the strategy amazing but not realistic."
So, when testing someone elses algorithm with lots and lots of buy and sell signals, it is even harder to detect lookahead bias.
Hopefully the Freqtrade lookahead-analysis function provides enough information to add an extra warning to the results i have when testing future trading strategies.
Reading the documentation states that:
It will start with a backtest of all pairs to generate a baseline for indicators and entries/exits. After the backtest ran, it will look if the minimum-trade-amount is met and if not cancel the lookahead-analysis for this strategy.After setting the baseline it will then do additional runs for every entry and exit separately. When a verification-backtest is done, it will compare the indicators as the signal (either entry or exit) and report the bias. After all signals have been verified or falsified a result-table will be generated for the user to see.
So what I understand from this is that the function starts by performing a regular backtest, considering all available data to establish a baseline for your strategy's performance.
And after the initial backtest, the function then conducts a series of additional backtests. but, it slightly alters the data each time to simulate real-time conditions. It removes future data that wouldn't be available at the time of trade execution to see if your strategy's performance changes.
The function compares the results of these lookahead backtests with the initial baseline. And if your strategy performs significantly better in the initial backtest (where it had access to all data), it might be because it's using future information, indicating lookahead bias.
Strategies without bias
So what happens if I use this command with a strategy that I suspect does not have lookahead bias?
Since this command is very similar to the backtesting function I used the following command to find out if the next algo code has bias.
freqtrade lookahead-analysis -c user_data/spot_config.json --timerange 20190101- --timeframe 1d -s Low_BB --minimum-trade-amount 5 --lookahead-analysis-exportfilename user_data/logs/low_BB.csv
Well I had to test out a little bit what the exact command should be to give me the correct output and I came up with the following command:
freqtrade lookahead-analysis # The lookahead command
-c # The configuration to use
-s # the name of the strategy itself. If your strategy is in another location, use the --strategy-path option here.
--timerange # not using a timerange would lead to the analysis using all the data
--timeframe # and the timeframe to use.
I suspect that bias should occur on all timeframes since it is baked into the algo. But testing on higher timeframes can lead to faster throughput and therefore faster results.
So as you see, this command can use a lot of commands that are similar of Backtesting.
The command also has the following settings to avoid users accidentally generating false positives.
--cache is forced to "none".
--max-open-trades is forced to be at least equal to the number of pairs.
--dry-run-wallet is forced to be basically infinite (1 billion).
--stake-amount is forced to be a static 10000 (10k).
A nice addition is that lookahead analysis also supports the analysis of freqai strategies.
So let's show the first example where there is no bias detected...
freqtrade lookahead-analysis -c /opt/freqtrade/user_data/spot_config.json --strategy-path /opt/freqtrade/user_data/strategies -s Low_BB --timerange 20190101- --timeframe 1d
freqtrade lookahead-analysis -c user_data/spot_config.json --timerange 20190101- --timeframe 1d -s Low_BB --minimum-trade-amount 5 --lookahead-analysis-exportfilename user_data/logs/low_BB.csv
2024-02-02 09:58:08,528 - freqtrade - INFO - freqtrade 2023.7
2024-02-02 09:58:08,529 - freqtrade.configuration.load_config - INFO - Using config: user_data/spot_config.json ...
2024-02-02 09:58:08,529 - freqtrade.loggers - INFO - Verbosity set to 0
2024-02-02 09:58:08,529 - freqtrade.configuration.configuration - INFO - Parameter -i/--timeframe detected ... Using timeframe: 1d ...
2024-02-02 09:58:08,529 - freqtrade.configuration.configuration - INFO - Parameter --timerange detected: 20190101- ...
2024-02-02 09:58:08,530 - freqtrade.configuration.configuration - INFO - Using user-data directory: /opt/freqtrade/user_data ...
2024-02-02 09:58:08,530 - freqtrade.configuration.configuration - INFO - Using data directory: /opt/freqtrade/user_data/data/binance ...
2024-02-02 09:58:08,530 - freqtrade.configuration.configuration - INFO - Overriding timeframe with Command line argument
2024-02-02 09:58:08,530 - freqtrade.configuration.configuration - INFO - Parameter --cache=day detected ...
2024-02-02 09:58:08,530 - freqtrade.configuration.configuration - INFO - Saving lookahead analysis results into user_data/logs/low_BB.csv ...
2024-02-02 09:58:08,530 - freqtrade.configuration.configuration - INFO - Filter trades by timerange: 20190101-
2024-02-02 09:58:08,530 - freqtrade.configuration.configuration - INFO - Minimum Trade amount: 5
2024-02-02 09:58:08,530 - freqtrade.configuration.configuration - INFO - Path to store lookahead-analysis-results: user_data/logs/low_BB.csv
2024-02-02 09:58:08,530 - freqtrade.exchange.check_exchange - INFO - Checking exchange...
2024-02-02 09:58:08,533 - freqtrade.exchange.check_exchange - INFO - Exchange "binance" is officially supported by the Freqtrade development team.
2024-02-02 09:58:08,533 - freqtrade.configuration.configuration - INFO - Using pairlist from configuration.
2024-02-02 09:58:08,533 - freqtrade.configuration.config_validation - INFO - Validating configuration ...
2024-02-02 09:58:08,534 - freqtrade.optimize.lookahead_analysis_helpers - INFO - Max_open_trades were less than amount of pairs. Set max_open_trades to amount of pairs just to avoid false positives.
<snip>
2024-02-02 09:58:16,367 - freqtrade.optimize.backtesting - INFO - Loading data from 2019-03-21 00:00:00 up to 2019-07-13 00:00:00 (114 days).
2024-02-02 09:58:16,392 - freqtrade.optimize.backtesting - INFO - Loading data from 2019-01-01 00:00:00 up to 2019-07-16 00:00:00 (196 days).
2024-02-02 09:58:16,413 - freqtrade.optimize.backtesting - INFO - Loading data from 2019-01-01 00:00:00 up to 2019-07-16 00:00:00 (196 days).
2024-02-02 09:58:16,439 - freqtrade.optimize.backtesting - INFO - Loading data from 2019-01-01 00:00:00 up to 2019-07-16 00:00:00 (196 days).
2024-02-02 09:58:16,459 - freqtrade.optimize.backtesting - INFO - Loading data from 2019-01-01 00:00:00 up to 2019-07-16 00:00:00 (196 days).
2024-02-02 09:58:16,484 - freqtrade.optimize.backtesting - INFO - Loading data from 2019-01-01 00:00:00 up to 2019-07-16 00:00:00 (196 days).
2024-02-02 09:58:16,504 - freqtrade.optimize.backtesting - INFO - Loading data from 2019-01-01 00:00:00 up to 2019-07-16 00:00:00 (196 days).
2024-02-02 09:58:16,516 - freqtrade.loggers.set_log_levels - INFO - Restoring log verbosity.
2024-02-02 09:58:16,517 - freqtrade.optimize.lookahead_analysis - INFO - Low_BB: no bias detected
2024-02-02 09:58:16,517 - freqtrade.optimize.lookahead_analysis_helpers - INFO - Checking look ahead bias via backtests of Low_BB.py took 8 seconds.
| filename | strategy | has_bias | total_signals | biased_entry_signals | biased_exit_signals | biased_indicators |
|------------+------------+------------+-----------------+------------------------+-----------------------+---------------------|
| Low_BB.py | Low_BB | False | 20 | 0 | 0 | |
2024-02-02 09:58:16,519 - freqtrade.optimize.lookahead_analysis_helpers - INFO - saving user_data/logs/low_BB.csv
cat user_data/logs/low_BB.csv
filename,strategy,has_bias,total_signals,biased_entry_signals,biased_exit_signals,biased_indicators
Low_BB.py,Low_BB,False,20,0,0,
You can see that the output shows that this algorithm has no bias detected.
So in this case I am happy that this algo has been correctly build.
Strategies with bias
Let's now look at an example where a strategy does suffer from lookahead bias.
What does this command show where this bias is located.
Again, I'll use the same command, but this time use another strategy to test.
freqtrade lookahead-analysis -c /opt/freqtrade/user_data/spot_config.json --strategy-path /opt/freqtrade/user_data/strategies --timerange 20190101- --timeframe 1d -s wtc
2024-01-31 10:31:50,201 - freqtrade - INFO - freqtrade 2023.7
2024-01-31 10:31:50,202 - freqtrade.configuration.load_config - INFO - Using config: /opt/freqtrade/user_data/spot_config.json ...
2024-01-31 10:31:50,202 - freqtrade.loggers - INFO - Verbosity set to 0
2024-01-31 10:31:50,202 - freqtrade.configuration.configuration - INFO - Using additional Strategy lookup path: /opt/freqtrade/user_data/strategies
2024-01-31 10:31:50,202 - freqtrade.configuration.configuration - INFO - Parameter -i/--timeframe detected ... Using timeframe: 1d ...
2024-01-31 10:31:50,202 - freqtrade.configuration.configuration - INFO - Parameter --timerange detected: 20190101- ...
2024-01-31 10:31:50,203 - freqtrade.configuration.configuration - INFO - Using user-data directory: /opt/freqtrade/user_data ...
2024-01-31 10:31:50,203 - freqtrade.configuration.configuration - INFO - Using data directory: /opt/freqtrade/user_data/data/binance ...
2024-01-31 10:31:50,203 - freqtrade.configuration.configuration - INFO - Overriding timeframe with Command line argument
2024-01-31 10:31:50,203 - freqtrade.configuration.configuration - INFO - Parameter --cache=day detected ...
2024-01-31 10:31:50,203 - freqtrade.configuration.configuration - INFO - Filter trades by timerange: 20190101-
2024-01-31 10:31:50,203 - freqtrade.exchange.check_exchange - INFO - Checking exchange...
2024-01-31 10:31:50,206 - freqtrade.exchange.check_exchange - INFO - Exchange "binance" is officially supported by the Freqtrade development team.
2024-01-31 10:31:50,206 - freqtrade.configuration.configuration - INFO - Using pairlist from configuration.
2024-01-31 10:31:50,206 - freqtrade.configuration.config_validation - INFO - Validating configuration ...
2024-01-31 10:31:50,207 - freqtrade.optimize.lookahead_analysis_helpers - INFO - Max_open_trades were less than amount of pairs. Set max_open_trades to amount of pairs just to avoid false positives.
2024-01-31 10:31:50,207 - freqtrade.optimize.lookahead_analysis_helpers - INFO - Dry run wallet was not set to 1 billion, pushing it up there just to avoid false positives
2024-01-31 10:31:50,207 - freqtrade.optimize.lookahead_analysis_helpers - INFO - backtest_cache = day detected. Inside lookahead-analysis it is enforced to be 'none'. Changed it to 'none'
2024-01-31 10:31:50,249 - freqtrade.resolvers.iresolver - WARNING - Could not import /opt/freqtrade/user_data/strategies/example-baseline.py.py due to 'invalid syntax (example-baseline.py.py, line 21)'
Add {
"method": "AgeFilter",
"min_days_listed": 30
},
to your pairlists in config (Under StaticPairList)
2024-01-31 10:31:50,256 - NostalgiaForInfinityX - INFO - pandas_ta successfully imported
2024-01-31 10:31:50,264 - freqtrade.resolvers.iresolver - WARNING - Could not import /opt/freqtrade/user_data/strategies/example-baseline.py.py due to 'invalid syntax (example-baseline.py.py, line 21)'
Add {
"method": "AgeFilter",
"min_days_listed": 30
},
to your pairlists in config (Under StaticPairList)
2024-01-31 10:31:50,268 - NostalgiaForInfinityX - INFO - pandas_ta successfully imported
2024-01-31 10:31:50,274 - freqtrade.optimize.lookahead_analysis_helpers - INFO - Bias test of wtc.py started.
2024-01-31 10:31:50,274 - freqtrade.exchange.exchange - INFO - Instance is running with dry_run enabled
<snip>
2024-01-31 10:32:00,804 - freqtrade.optimize.backtesting - INFO - Loading data from 2019-03-15 00:00:00 up to 2020-01-16 00:00:00 (307 days).
2024-01-31 10:32:00,826 - freqtrade.data.history.idatahandler - WARNING - XMR/USDT, spot, 1d, data starts at 2019-03-15 00:00:00
2024-01-31 10:32:00,831 - freqtrade.optimize.backtesting - INFO - Loading data from 2019-03-15 00:00:00 up to 2020-03-10 00:00:00 (361 days).
2024-01-31 10:32:00,866 - freqtrade.optimize.backtesting - INFO - Loading data from 2019-01-01 00:00:00 up to 2019-02-12 00:00:00 (42 days).
2024-01-31 10:32:00,891 - freqtrade.optimize.backtesting - INFO - Loading data from 2019-01-01 00:00:00 up to 2020-03-13 00:00:00 (437 days).
2024-01-31 10:32:00,951 - freqtrade.loggers.set_log_levels - INFO - Restoring log verbosity.
2024-01-31 10:32:00,951 - freqtrade.optimize.lookahead_analysis - INFO - => wtc : bias detected!
2024-01-31 10:32:00,951 - freqtrade.optimize.lookahead_analysis_helpers - INFO - Checking look ahead bias via backtests of wtc.py took 11 seconds.
| filename | strategy | has_bias | total_signals | biased_entry_signals | biased_exit_signals | biased_indicators |
|------------+------------+------------+-----------------+------------------------+-----------------------+----------------------|
| wtc.py | wtc | True | 20 | 17 | 12 | wt1, wt2, slowk, def |
freqtrade lookahead-analysis -c user_data/spot_config.json --timerange 20190101- --timeframe 1d -s wtc --minimum-trade-amount 5 --lookahead-analysis-exportfilename user_data/logs/wtc-lookahead.csv
Export file contains the following information:
cat user_data/logs/wtc-lookahead.csv
filename,strategy,has_bias,total_signals,biased_entry_signals,biased_exit_signals,biased_indicators
wtc.py,wtc,True,20,17,12,"wt1,wt2,slowk,def"
According to the analysis this algorithm unfortunately suffers from lookahead bias.
And the results show there are 17 entry signals and 12 exit signals biased. Now this algo does not have 17 different types of entry signals and also not 12 exit signals configured. So I guess that theses amounts refer to the actual trading signals where the bias has been discovered.
The 'wt1, wt2, slowk and def' indicators seem to have this bias in their code.
So let's open this code and see if there are any hints or clues that provide me with information where this bias has been implemented.
If I take a look at the code, and if i'm correct, then there seems to be a problem in the wavetrend oscillator because that is where the problem indicators are used.
Let me first take a look at the buy and sell signals.
At first sight there seems to be nothing wrong with these signals.
These are just based on where the position is of the indicators in relation to minimum and maximum values. And since a lot of strategies are coded like this, I assume there is no mistake here. Or I should be terribly wrong.
def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
dataframe.loc[
(
(qtpylib.crossed_above(dataframe['wt1'], dataframe['wt2']))
& (dataframe['wt1'].between(self.buy_min0.value, self.buy_max0.value))
& (dataframe['slowk'].between(self.buy_min1.value, self.buy_max1.value))
& (dataframe['def'].between(self.buy_min.value, self.buy_max.value))
),
'buy'] = 1
return dataframe
def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
# print(dataframe['slowk']/dataframe['wt1'])
dataframe.loc[
(
(qtpylib.crossed_below(dataframe['wt1'], dataframe['wt2']))
& (dataframe['wt1'].between(self.sell_min0.value, self.sell_max0.value))
& (dataframe['slowk'].between(self.sell_min1.value, self.sell_max1.value))
& (dataframe['def'].between(self.sell_min.value, self.sell_max.value))
),
'sell'] = 1
return dataframe
So what rests is to check the indicators themselves and hopefully see what seems to be the problem here.
def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
# WAVETREND
try:
ap = (dataframe['high']+dataframe['low'] + dataframe['close'])/3
esa = ta.EMA(ap, 10)
d = ta.EMA((ap - esa).abs(), 10)
ci = (ap - esa).div(0.0015 * d)
tci = ta.EMA(ci, 21)
wt1 = tci
wt2 = ta.SMA(np.nan_to_num(wt1), 4)
dataframe['wt1'], dataframe['wt2'] = wt1, wt2
stoch = ta.STOCH(dataframe, 14)
slowk = stoch['slowk']
dataframe['slowk'] = slowk
# print(dataframe.iloc[:, 6:].keys())
x = dataframe.iloc[:, 6:].values # returns a numpy array
min_max_scaler = preprocessing.MinMaxScaler()
x_scaled = min_max_scaler.fit_transform(x)
dataframe.iloc[:, 6:] = pd.DataFrame(x_scaled)
# print('wt:\t', dataframe['wt'].min(), dataframe['wt'].max())
# print('stoch:\t', dataframe['stoch'].min(), dataframe['stoch'].max())
dataframe['def'] = dataframe['slowk']-dataframe['wt1']
# print('def:\t', dataframe['def'].min(), "\t", dataframe['def'].max())
except:
dataframe['wt1'], dataframe['wt2'], dataframe['def'], dataframe['slowk'] = 0, 10, 100, 1000
return dataframe
wt1 seems to be derived from the TA libraries exponential moving average and some calculations where candles dataframes has been used..
The wt2 is derived from the TA library Simple moving average but also from the wt1 indicator so it seems.
The slowk is derived from the TA libaries Stochastics indicator. And, as far as I can tell not much more.
And the def indicator value is derived from the slowk and wt1 again.
So without delving too deep into this specific problem, the error could be from the way the indicators are created in this code.
And at first I suspected that the creation of the wt1 indicator has something to do with the bias. Perhaps because it is also derived from the dataframe itself through the ap variable. Since the dataframe holds future data as well.
ap = (dataframe['high']+dataframe['low'] + dataframe['close'])/3
Now since we all have the availability of AI, I also asked ChatGPT where this potential problem could be located in the code.
And there I was warned that the MinMaxScaler could be the cause of this bias.
Potential Lookahead Bias
The potential lookahead bias in this function could arise from the scaling operation:
MinMaxScaler: The MinMaxScaler is applied to the entire column(s) of indicators, which involves calculating the minimum and maximum values across the entire dataset. This process inherently uses future data to scale past data, as the scaler takes into account the entire dataset's range to normalize the values. When scaling the indicators this way, the strategy assumes knowledge of future price movements, introducing lookahead bias. In a real-time trading scenario, you wouldn't know the future min and max values of these indicators, so your strategy would be making decisions based on information it wouldn't have in a live trading environment.
How to Fix
To avoid lookahead bias when scaling, you need to ensure that the scaling is done in a rolling or incremental manner that only uses past and current data available at the time of each trade decision. One approach could be to use a rolling window to calculate the min and max values for scaling, ensuring that only historical data up to the current point in time is used for normalization. This way, the strategy remains realistic and doesn't inadvertently "peek" into the future.
So this looks to be very good additional information to go and fix this issue.
Now there was one final thing that I found strange and a bit worrysome. It seems that the Stochastics slowk also suffers from bias according to this check.
stoch = ta.STOCH(dataframe, 14)
slowk = stoch['slowk']
dataframe['slowk'] = slowk
This could mean that using indicators from the TA library also might be incorrect.
This is something to keep into the back of my head and I'll watch this closely if I will use this lookahead detection function more often.
Caveats¶
Besides this wicked problem, this lookahead analysis feature also has some caveats to be aware of, which are described in the documentation.
lookahead-analysis can only verify / falsify the trades it calculated and verified. If the strategy has many different signals / signal types, it's up to you to select appropriate parameters to ensure that all signals have triggered at least once. Not triggered signals will not have been verified. This could lead to a false-negative (the strategy will then be reported as non-biased).lookahead-analysis has access to everything that backtesting has too. Please don't provoke any configs like enabling position stacking. If you decide to do so, then make doubly sure that you won't ever run out of max_open_trades amount and neither leftover money in your wallet.
So please remember this when looking at the results and before making any final conclusions.
Not all strategies work
There is one final remark that I want to make here and that is that not all strategies can be easily checked with this function.
It might be that the algo runs perfectly fine with normal backtests but with the lookahead analysis they error out.
In these cases you will have to figure out where the error is and that can be a problem if you test out complex algorithms that you did not create.
So please be aware that you can experience these issues.
freqtrade lookahead-analysis -c user_data/spot_config.json --timerange 20190101- --timeframe 15m -s MacheteV8b --minimum-trade-amount 1
--lookahead-analysis-exportfilename user_data/logs/MacheteV8b_lookahead.csv
2024-02-02 10:11:37,453 - freqtrade - INFO - freqtrade 2023.7
2024-02-02 10:11:37,454 - freqtrade.configuration.load_config - INFO - Using config: user_data/spot_config.json ...
2024-02-02 10:11:37,454 - freqtrade.loggers - INFO - Verbosity set to 0
2024-02-02 10:11:37,454 - freqtrade.configuration.configuration - INFO - Parameter -i/--timeframe detected ... Using timeframe: 15m ...
2024-02-02 10:11:37,454 - freqtrade.configuration.configuration - INFO - Parameter --timerange detected: 20190101- ...
2024-02-02 10:11:37,454 - freqtrade.configuration.configuration - INFO - Using user-data directory: /opt/freqtrade/user_data ...
2024-02-02 10:11:37,454 - freqtrade.configuration.configuration - INFO - Using data directory: /opt/freqtrade/user_data/data/binance ...
2024-02-02 10:11:37,454 - freqtrade.configuration.configuration - INFO - Overriding timeframe with Command line argument
2024-02-02 10:11:37,454 - freqtrade.configuration.configuration - INFO - Parameter --cache=day detected ...
2024-02-02 10:11:37,454 - freqtrade.configuration.configuration - INFO - Saving lookahead analysis results into user_data/logs/MacheteV8b_lookahead.csv ...
2024-02-02 10:11:37,454 - freqtrade.configuration.configuration - INFO - Filter trades by timerange: 20190101-
2024-02-02 10:11:37,455 - freqtrade.configuration.configuration - INFO - Minimum Trade amount: 1
2024-02-02 10:11:37,455 - freqtrade.configuration.configuration - INFO - Path to store lookahead-analysis-results: user_data/logs/MacheteV8b_lookahead.csv
2024-02-02 10:11:37,455 - freqtrade.exchange.check_exchange - INFO - Checking exchange...
2024-02-02 10:11:37,458 - freqtrade.exchange.check_exchange - INFO - Exchange "binance" is officially supported by the Freqtrade development team.
2024-02-02 10:11:37,458 - freqtrade.configuration.configuration - INFO - Using pairlist from configuration.
2024-02-02 10:11:37,458 - freqtrade.configuration.config_validation - INFO - Validating configuration ...
2024-02-02 10:11:37,459 - freqtrade.optimize.lookahead_analysis_helpers - INFO - Max_open_trades were less than amount of pairs. Set max_open_trades to amount of pairs just to avoid false positives.
2024-02-02 10:11:37,459 - freqtrade.optimize.lookahead_analysis_helpers - INFO - Dry run wallet was not set to 1 billion, pushing it up there just to avoid false positives
2024-02-02 10:11:37,459 - freqtrade.optimize.lookahead_analysis_helpers - INFO - backtest_cache = day detected. Inside lookahead-analysis it is enforced to be 'none'. Changed it to 'none'
2024-02-02 10:11:37,498 - freqtrade.resolvers.iresolver - WARNING - Could not import /opt/freqtrade/user_data/strategies/example-baseline.py.py due to 'invalid syntax (example-baseline.py.py, line 21)'
Add {
"method": "AgeFilter",
"min_days_listed": 30
},
to your pairlists in config (Under StaticPairList)
2024-02-02 10:11:37,504 - NostalgiaForInfinityX - INFO - pandas_ta successfully imported
2024-02-02 10:11:37,511 - freqtrade.optimize.lookahead_analysis_helpers - INFO - Bias test of MacheteV8b.py started.
2024-02-02 10:11:37,512 - freqtrade.exchange.exchange - INFO - Instance is running with dry_run enabled
2024-02-02 10:11:37,512 - freqtrade.exchange.exchange - INFO - Using CCXT 4.0.36
2024-02-02 10:11:37,518 - freqtrade.exchange.exchange - INFO - Using Exchange "Binance"
2024-02-02 10:11:42,491 - freqtrade.resolvers.exchange_resolver - INFO - Using resolved exchange 'Binance'...
2024-02-02 10:11:42,493 - freqtrade.resolvers.iresolver - WARNING - Could not import /opt/freqtrade/user_data/strategies/example-baseline.py.py due to 'invalid syntax (example-baseline.py.py, line 21)'
<snip>
2024-02-02 10:27:51,065 - freqtrade.data.history.idatahandler - WARNING - ZEC/USDT, spot, 1h, data starts at 2019-03-21 04:00:00
2024-02-02 10:27:51,066 - freqtrade.data.history.idatahandler - WARNING - ZEC/USDT, spot, 1h, data ends at 2024-01-01 06:00:00
2024-02-02 10:28:06,680 - freqtrade.strategy.strategy_wrapper - ERROR - Unexpected error 'sroc_inf' calling <bound method MacheteV8b.custom_stoploss of <MacheteV8b.MacheteV8b object at 0x7fa60bab6dd0>>
Traceback (most recent call last):
File "/opt/freqtrade/freqtrade/strategy/strategy_wrapper.py", line 27, in wrapper
return f(*args, **kwargs)
^^^^^^^^^^^^^^^^^^
File "/opt/freqtrade/user_data/strategies/MacheteV8b.py", line 640, in custom_stoploss
sroc = self.custom_trade_info[trade.pair]['sroc_inf'].loc[current_time]['sroc_inf']
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
KeyError: 'sroc_inf'
2024-02-02 10:28:06,681 - freqtrade - ERROR - 'sroc_inf'
End
Now maybe I did not use the lookahead function correctly or am just plain wrong with some of my conclusions.
And I dont mind being corrected, as long as it is criticism that also contains information that can help me and the community understand things better and prevent future mistakes.
But anyway, I think we now have another welcome addition to our toolbox to determine if our algorithmic trading strategy performs without errors and biases.
I am still figuring out how to incorporate this additional information into my backtests and until that moment I keep a close critical eye on these strategies that seem too good to be true. And I hope that you, the viewer, will do this too. You should always be sceptic and do your own research.
And with this conclusion I'm at the end of this video.
Thanks for watching. If you like this content, then please click like, subscribe and give a comment.
And I will see you in the next one.
Goodbye!
2024-08-05 16:00:05 +0000 UTC
View Post