Home Creators Posts Import Register Favorites Logout
haven't archived this post yet. have a subscription? use the importer!

Downloads

  • 2024.23.FrostAuraM115mStrategy.zip

Missing 1 file, as this post has not yet been imported.

Content

2024.23.FrostAuraM115mStrategy

Introduction

This will be a Patreon post only strategy explanation because this strategy does not perform well (so here I warned you beforehand, read this post at your own peril).

It was a pieve of code that was laying around for a while after hoarding loads and loads of code one or two years ago. Searching for this code now seems to not give any results back anymore, but maybe someone recognizes this code and can point to the original author.

The strategy

The file has some minor comments about the purpose of the code. Apparently this is "FrostAura's mark 1 strategy which aims to make purchase decisions based on the BB and RSI". It also claims to have the following results, but there is no mention on which pairs or timerange it is based.

Last Optimization:

    Sharpe Ratio    : 5.11912 (prev 4.9885)

    Profit %        : 1880.60% (prev 1962.82%)

    Avg             : 209.6m (prev 437.6m)

    Optimized for   : Last 100+ days, 15min

Luckily for us the code is pretty short and straightforward so I can explain things quickly and simple before showing you the results I got on my setup (this might be totally different on your setup ofcourse, so it is just an indication).

The ROI has multiple time based exit points.

# Minimal ROI designed for the strategy.

minimal_roi = {

    "0": 0.25023,

    "89": 0.09497,

    "248": 0.02596,

    "350": 0

}

The stop loss is pretty largely set and this might be a problem for strategies that are based on small timeframes here (my experience)

# Optimal stoploss designed for the strategy.

stoploss = -0.34316

The proposed timeframe to use is the 15 minute timeframe.

# Optimal ticker interval for the strategy.

timeframe = '15m'

In the indicator section there are two main indicators configured, the RSI and the Bollinger Bands.

The latter has three bands configured. On standard deviation 1, deviation 2 and one on deviation 3. Plus the middle band ofcourse that has a window of 20.

def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame:

    # RSI

    dataframe['rsi'] = ta.RSI(dataframe)


    # Bollinger Bands

    bollinger1 = qtpylib.bollinger_bands(qtpylib.typical_price(dataframe), window=20, stds=1)

    dataframe['bb_lowerband1'] = bollinger1['lower']

    dataframe['bb_middleband1'] = bollinger1['mid']

    dataframe['bb_upperband1'] = bollinger1['upper']


    bollinger2 = qtpylib.bollinger_bands(qtpylib.typical_price(dataframe), window=20, stds=2)

    dataframe['bb_lowerband2'] = bollinger2['lower']

    dataframe['bb_middleband2'] = bollinger2['mid']

    dataframe['bb_upperband2'] = bollinger2['upper']


    bollinger3 = qtpylib.bollinger_bands(qtpylib.typical_price(dataframe), window=20, stds=3)

    dataframe['bb_lowerband3'] = bollinger3['lower']

    dataframe['bb_middleband3'] = bollinger3['mid']

    dataframe['bb_upperband3'] = bollinger3['upper']


    return dataframe

The buy signal occurs when the rsi gets above 45 and the close price is below the second Bollinger band (standard deviation 2). Also the coin should have a minimum price of 0.0000015 USDT. Which can prevent some smaller cap coins to trade in this case.

def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:

    minimum_coin_price = 0.0000015


    dataframe.loc[

        (

            #(dataframe['rsi'] > 45) &

            (dataframe["close"] < dataframe['bb_lowerband2']) &

            (dataframe["close"] > minimum_coin_price)

        ),

        'buy'] = 1


    return dataframe

The sell happens when the RSI is above 53 and the close price is above the Bollinger lowerband 1. That is the lowerband with standard deviation 1.

def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:

    dataframe.loc[

        (

            (dataframe['rsi'] > 53) &

            (dataframe["close"] > dataframe['bb_lowerband1'])

        ),

        'sell'] = 1


    return dataframe

So the purpose of this strategy is to buy below the lowest (std=2) Bollinger band with RSI higher than 45 (some momentum happening) and then sell quickly when the price is above the first lower Bollinger band (std=1) with an even higher RSI momentum. And this all on the 15 minute timeframe.

Backtest results

However this momentum based 'buy the dip' kind of trading idea is not very profitable on my setup.

Even worse, my hypothetical account got drained from the moment the backtest started.

My main concern here is that, while there are many winning trades, these winners are gaining less money than the few losers it has. You see even the best ROI timebased setting only has a 25 percent win.

"0": 0.25023,

"89": 0.09497,

"248": 0.02596,

"350": 0

But one losing trade (besides the exit signal) can drain your account by 34 percent

    # Optimal stoploss designed for the strategy.

    stoploss = -0.34316

So you should have at least two winning trades for each losing trade to gain money. And this is not happening with this configuration.

This is also show with the drawdown plot. From the beginnin on a losing battle.

This profit loss plot shows it even better. There are winning weeks, where the drawdown gets lower. But the multiple weeks where there is a loss show clearly that these winning trades (see a few plots back for that curve) cannot prevent the few losing trades to blow up your account.

This plot shows it also, all weeks have positive winlose ratios, but still the strategy loses money.

Which brings me to the overall performance indicators. Does somebody still need an explanation of what's happening here...?

So it's no wonder that this blogpost is short and directly to the point. There is no need to put a lot of energy into this trading system. Except ofcourse when you still think it is a good starting point to tweak and fix the algo to make it perform better.

I sure am curious to see if somebody picks up the challenge and can still make something out of this algo.

Ofcourse optimizing with hyperopt could do the trick and make the ROI and Stoploss settings better. But be aware that this is adding bias to the strategy and might cause future problems since past performances are not guaranteed to also repeat themselves in the future.

But the whole purpose for this (and many other) backtest excersise is to filter out the bad ideas and keep and improve on the good ideas. So all energy is still well spend and we now not a lot more about this algo.

So many thanks for reading this post and I will continue in the future because I stil have many many algo codes to test (and I already can tell you that some of them are even better than the current number one).

So thank you again and I will see you in the next post!

Goodbye!


Comments

No comments found for this post.