
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:
MultiOffsetLamboV0
SMAOffsetProtectOptV0
SMAOffsetOptV1
SMAOffsetProtectOptV1_973
Let’s start by reverse engineering what the rules of these algorithms are:
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.
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.
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.
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.
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:
SMAOffsetOptV1 is the only strategy with a trailing stop-loss, allowing it to secure gains dynamically as the price trends favorably. Other strategies rely solely on fixed ROI and stop-loss values.
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?
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.
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.
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.
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.
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
Dutch Algotrading
2024-11-22 13:21:36 +0000 UTCTom
2024-11-17 11:18:15 +0000 UTC