Home Artists Posts Import Register

Downloads

Content

Hi there and welcome to this post where I discuss another algorithmic trading strategy. The trading algo is called the MultiMA TLS4 and was created by a person called Stash86. The code makes use of lots of elements that were previously discussed in other posts and some code even does seem to look exactly the same, and with a reason that I will show you a little bit down below.

The author

This time the code has lots of information about the creator (mainly about donations) but also a little bit about the elements that are used in the code itself. He has a Github site on this location https://github.com/stash86 where the trading code is located in this repo https://github.com/stash86/MultiMA_TSL. There are lots of ways to show your support to the creator mentioned in the code. There is even a Patreon page for the creator, so you can see, there is no reason why this time credits could be given where credits are due. These are the ways to do it.

The Strategy

The algo is a complex Freqtrade trading strategy, involving multiple technical indicators and conditional logic to determine buy and sell signals for trading cryptocurrencies. It literally has elements that were inspired by the folowing other people:

The algorithm uses the following core components:

In the code they are as follows (below and further in this post I only show snippets, the original code is included as a attachment to this post):

The strategy includes parameters for tuning each moving average and oscillator, which can be optimized based on historical data to maximize performance.

buy_params = { "base_nb_candles_buy_ema": 32, "base_nb_candles_buy_ema2": 73, "low_offset_ema": 1.014, "low_offset_ema2": 1.054,

There are also protections like cooldown periods to avoid frequent trading based on recent action.

This strategy is designed for a 5-minute timeframe, making it suitable for high-frequency trading.

It includes a comprehensive set of conditions and indicators that allow it to adapt to different market conditions, potentially reducing risk and capturing short-term profit opportunities.

More in the code itself :-)

The buy trend

In the populate_buy_trend function of the provided Freqtrade strategy, the buy signals are determined based on a series of complex conditions that utilize various technical indicators. This section of the code orchestrates when to signal a buy based on the alignment of these conditions. Let's break it down into its key parts to understand each component:

Exponential Moving Averages (EMA):

Conditional checks to see if optimization flags for buying or selling EMA are enabled (optimize_buy_ema, optimize_sell_ema, etc.). If they are, the strategy calculates the EMA values offset by specific multipliers to create threshold values that the current price should meet for a potential buy signal.

Volume Weighted Moving Averages (VWMA):

Similar checks and calculations are made for VWMA if their respective optimization flags are enabled. These calculations consider both price and volume, giving a weighted significance to periods with higher volume.

Volatility Checks: The strategy calculates standard deviation over a rolling window to measure volatility, then checks if this volatility is within specified thresholds to avoid buying in overly volatile conditions.

Constructing Buy Conditions

Each buy condition involves checking if the current price is below the calculated EMA or VWMA thresholds. Additionally, conditions often include other filters such as the price being below a threshold value calculated by a function labeled as pm (possibly a custom indicator related to PMAX mentioned in the comments).

Specific Buy Conditions

HMA Condition: The code checks if the current price is below the HMA (Hull Moving Average) threshold and other conditions like RSI and a custom 'pm' value being below certain thresholds.

VWMA Conditions: There are several VWMA-related conditions. Each checks if the current price is below different VWMA thresholds with additional conditions involving the 'pm' value and RSI indicators.

Combined Buy Logic

The strategy combines these conditions using logical OR, meaning if any condition is true, a buy signal is considered. However, an additional set of checks (add_check) is applied:

Live Data Check: Ensures the data being used is sufficient and up-to-date.

Age Filter: Makes sure the trading data meets a minimum 'age' requirement, likely to avoid trading on newly listed tokens with insufficient price history.

Comprehensive Condition: Combines checks against EMA, volatility, RSI, EWO (Elliott Wave Oscillator), and RSX (Real Smoothed Index) to further filter the buy signals. This includes checking if the price is below certain thresholds, whether the market condition (as indicated by 'pm') is favorable, and if certain momentum and trend indicators are within specified bounds.

Here the actual code of the buy trend population:

Sell trend function

Now about the populate_sell_trend function. In the provided Freqtrade strategy, the sell trend determines when to send sell signals based on a series of conditions that utilize technical indicators, particularly multiple EMAs (Exponential Moving Averages) adjusted by certain parameters. Let's delve into how these conditions are set up and how they function to guide sell decisions:

EMA Conditions:

The function checks if optimization flags for various EMAs (such as optimize_sell_ema3, optimize_sell_ema4, etc.) are enabled. If they are, it calculates EMA values multiplied by specific offset factors to create adjusted threshold values (ema_offset_sell). These thresholds determine the price conditions under which the asset should be considered for selling.

Dynamic Sell Conditions: Each sell condition combines the current price relative to its corresponding EMA threshold with other checks:

  • The price should be either above or below the EMA threshold depending on the condition.

  • The asset's trading volume must be non-zero, ensuring there's market activity.

  • The RSI (Relative Strength Index) is used to check if the asset is potentially overbought (indicative of a good sell opportunity).

  • A custom pm value (pmax_thresh), likely related to an indicator that measures market extremes or volatility, helps further refine the condition to match specific market scenarios.

Specific Sell Conditions

Condition 1 (EMA 1): The price must be above the EMA threshold, with a low RSI and under a specified pm threshold, suggesting a potential peak or overbought condition.

Condition 2 (EMA 2): Similar to condition 1 but requires the pm value to be above its threshold, possibly indicating different market dynamics.

Conditions 3 to 8: These involve checks against other EMAs, with similar logic but varying in the specifics of price relative to EMA, pm thresholds, and RSI levels. Some conditions use a rolling minimum function, which can help filter out noise by ensuring the condition has been met continuously over a specified number of periods.

If the conditions are checked, and if any are true, the sell column in the DataFrame is set to 1, signaling a sell order. The use of multiple conditions and the combination of indicators like EMA, RSI, and custom pm thresholds aim to create a robust mechanism to identify optimal selling points based on the strategy's interpretation of market conditions.

The actual sell conditions of the strategy are given below:

Backtest results

All this code looks interesting and could certainly provide enough favorable conditions under which to buy and to sell.

So I have backtested this strategy code with my backtesting scripts and created the output necessary to decide if this algorithm has an edge in the market (on the backtest data ofcourse).

And to start with the overview of all the results of all the timeframes, these are not bad at all to begin with:

The 30 minute timeframe has the best results with a realistic 486 percent profit over 2224 trades. The 63 percent win rate also shows quite realistic in my opinion and 23 win streak agains max 13 losses after another are also something I could live with.

Furthermore I am always happy to see that most of the pairs (75%) used are responding well to the algorithm. Which indicates that this algo can be used generically and does not fit one or a few specific pairs.

The equity curve looks very good to me too. A nice steady incline of equity and resilient against any bad market circumstances.

You can see that by looking at the drawdown curve. The highest drawdown peaks from the latest absolute profit to its lowest point only reaches around 8 percent and the average drawdown over all trades is only a meager 2 percent.

Taking a look at the win loss ratio chart, you see that most of the times the algo has winning weeks. Although there are periods where there is not much to celebrate too. However the longest period with losing weeks is around 5 weeks maximum, and then the profits start to roll into your account again. Which results in the equity curve I showed you in the beginning.

On average you have more weeks where this algo seems to make you profit and during this backtest only a period of 5 weeks max you will see money flowing out your trading account. But then the money will roll right in again. Hypothetically speaking ofcourse.

So although this algo may not seem to deliver you the highest profits, I personally do like the way it builds up your trading account.

Maybe with a little bit of tweaking here and there it could perform even better, depending on your own pairs, setup and risk appetite.

Now I did not optimize this strategy since this has a lot of cogs, wheels and switches that can be turned and flipped. And I do not want to show results that are better but unrealistic, just for the views. But I do believe that well though out optimizations can improve things, as I just said.

The overall performance indicators also support my suspicions, since out of the box they show the points where the algo scores strong, like its pairs ratio, win percentage, profit factor and drawdown. To mention some.

But there are also some indicators that show the areas that could be improved on, like the profit percentage, CAGR and Calmar ratio.

Strategy League

So all in all, a pretty reasonable scoring trading algorithm right out of the box that certainly has a well deserved place within the current top 20 best performing strategies.

But remember to always do your own research and forward tests first before using any trading strategy presented or developed. Only testing under live circumstances are the real prove a trading hypothesis will work in real time. And you do not want to use real money while testng out a trading strategy.

Ending

So at the end of this post I want to repeat that the original authors deserve all the credit for this result.

Below are the files that came out of my backtest, together with the strategy code I use myself. There is also a Version 5 of this algo, but I did not test this yet.

I will be continuing mmy search for the best algo, so I will see you in the next post.

Goodbye!

Files

Exploring MultiMA TLS4: Good Algorithmic Trading Strategy Performance Revealed!

Join me as I delve into the complexities of the MultiMA TLS4, a powerful algorithmic trading strategy designed for cryptocurrency markets. Created by Stash86 (https://github.com/stash86/MultiMA_TSL), this strategy utilizes multiple moving averages, including EMA, HMA, and VWMA, alongside advanced indicators like RSI, RSX, and the custom PMAX to pinpoint optimal trading opportunities. Whether you're a seasoned trader or just starting, this video will guide you through the nuts and bolts of applying MultiMA TLS4 to your trading toolkit. Dive into the strategy's code, understand its parameters, and see real backtest results to evaluate its effectiveness. Don't forget to subscribe for more insights and support the creator on Patreon! === !!!! SEE MY PATREON FOR ALL CODE AND STRATEGIES !!!! 💬 SOCIAL 💬 Patreon: https://www.patreon.com/dutchalgotrading Strategy league: https://www.dutchalgotrading.com Buy me a coffee: https://ko-fi.com/dutchcryptodad Youtube: https://www.youtube.com/@dutchalgotrading 💰 AFILIATE LINKS & PROMO’S 💰 Bybit: https://www.bybit.com/en-US/invite?ref=K7JEX Linode $100 Free credits: http://linode.gvw92c.net/dutchalgotrading Tradingview get $15 off with purchase : https://www.tradingview.com/pricing/?share_your_love=DutchCryptoDad 🏷️ TAGS 🏷️ #trading #bot #crypto #cryptocurrency #bitcoin #money #strategy #algorithmic #algorithm #backtesting #dutchcryptodad #dutchalgotrading 📺 PLAYLISTS 📺 Tested trading strategies: https://bit.ly/DCD_strategies_pl Freqtrade bot tutorials: https://bit.ly/DCD_freqtrade_pl 📈 CHART ANALYSIS 📈 Tradingview: https://bit.ly/DCD_Tradingview ⚠️ FINANCIAL DISCLAIMER ⚠️ This channel is for education and entertainment purposes only! All the tests I do show hypothetical results on a limited backtest dataset. My way of deciding if an algorithm is good is not(!) an exact science. Everybody has their own preferred way of determining if a trading algorithm fits their person needs or not. It is your responsibility to investigate if this strategy will provide similar results under live circumstances. Past Performance Is NO Guarantee of Future Results!! I am in no way responsible for bad setups, strategies and possible losses or gains of money as a result! Everything expressed here is my opinion and not official investment advice. Investing in cryptocurrency or trading involves a high degree of risk and should be considered only by persons who can afford to sustain a loss of their entire investment. Please do your own research or consult a financial advisor before making any financial decisions.

Comments

David Ramirez Matamoros

Hi I am trying to deploy Multima_TSL4b using docker, I am able to launch freqtrader with other strategies but it fails with this giving output errors such "2024-09-04 03:05:11,625 - freqtrade - ERROR - DEPRECATED: Using 'sell_profit_only' moved to 'exit_profit_only'." Any idea? Thanks in advance

Dutch Algotrading

You should try the strategy migration command or read this document: https://www.freqtrade.io/en/stable/strategy_migration/. Recent Freqtrade versions have updated commands for buy and sell (entry and exit). Strategies are not updated on the internet for this change. Hope this helps.