Code Monkey home page Code Monkey logo

Comments (14)

xmatthias avatar xmatthias commented on May 16, 2024 1

don't ... it's not his own strategy - he only collected and commited it here (not to dimish this accomplishment, though).

I said i never saw this pattern before today.

What it seems to do is try and assign a 1 length dataframe a 'sell'=0.
i don't think this makes sense, and the aboved proposed dataframe.loc[:, 'sell'] = 0 will make more sense.

I did do some backtests with this strategy before - but it never seemed to trigger this line - as that "can only fail" ...

from freqtrade-strategies.

xmatthias avatar xmatthias commented on May 16, 2024 1

After looking at this strategy more in detail i'm inclined in removing it from this repository - or at least the sell part unless someone got an idea how to fix this.

It does everything you should not do in a strategy:

  • uses .iloc[0] to access an absolute row in the dataframe
  • uses .tail(1) to get the last buy-signal (however the last-buy signal in backtesting won't give you the trade entry. The same is true during real runs - where this code will give you the last buy-signal - but not necessarily the entry point for that particular trade - which may have ben longer ago.

from freqtrade-strategies.

lebonez avatar lebonez commented on May 16, 2024

I think my confusion lies in the concept behind this. We are checking if we have had a buy signal in the last 499 candles if not then don't sell. Lets say we just now get a buy signal and we also at the same time have a sell signal does that mean it is also going to sell then most likely buy within the time limit? I've had that happen a couple times when I set this:
if len(buyframe) == 0: dataframe.loc[:, 'sell'] = 0 return dataframe
This is probably not ideal since I'm a beginner to pandas as far as code but wouldn't we want to wait until the newest buy signal is at least the last candle? Like this unfortunately back testing doesn't show me any benefit.
elif len(buyframe) == 1: time_delta_ns = currentframe['date'].values[0] - buyframe['date'].values[0] time_delta_m = time_delta_ns.astype('timedelta64[m]')/numpy.timedelta64(5, 'm') if time_delta_m < 1: dataframe.loc[:, 'sell'] = 0 return dataframe

from freqtrade-strategies.

hroff-1902 avatar hroff-1902 commented on May 16, 2024

No, only values from the last candle of 499 is used as buy/sell signals, during dry-run/live trade
For backtesting, the values of the buy/sell columns are used as the buy/sell signals for corresponding time (next to the candle) inside the timerange. The dataframe is usually more than 500 (or 499) candles during backtesting.

from freqtrade-strategies.

hroff-1902 avatar hroff-1902 commented on May 16, 2024

For relation between buy and sell, it's implemented as:

        if buy and not sell:
            # then buy

from freqtrade-strategies.

lebonez avatar lebonez commented on May 16, 2024

Okay thanks for clearing that up. So for the error in the first comment if we haven't had a buy signal in the previous candle range this fails.
dataframe.loc[[False], 'sell']
Just changing to this dataframe.loc[:, 'sell'] seems correct?

So something like this set of signals will not happen (or highly unlikely)? Given the market is moving "normally". I think I saw this scenario a couple times where it sold for -.19% profit then bought immediately afterwards past the cooldown period.
Buy: 1 1 1 1 1 0 1
Sell: 1 1 1 1 1 1 0
Would be interesting to have a cooldown period that can be set in the config.

from freqtrade-strategies.

xmatthias avatar xmatthias commented on May 16, 2024

dataframe.loc[[False], 'sell'] seems wrong 'per se' ... i'll need to check what that actually does as i've never seen it this way.
dataframe.loc[:, 'sell'] is definitely better.

Would be interesting to have a cooldown period that can be set in the config.

well strictly speaking, you can - although not in the strategy itself.
however scenarios / usages for this vary wildly - so this is best done in the strategy.

Also - nothing is forcing you to populate buy / sell signals populate_buy / populate_sell -
The main thing is that at the end of the 3 methods, the dataframe has a 'buy' and a 'sell' column.

so in theory, you could generate the 'sell' column first - and then verify that dataframe['sell'].shift() != 1 (or something like that ...) - so checking for sell signals, and then not buying if the previous candle had a sell signal.
This won't cover you from ROI / stoploss sells though - only from sells initiated from a sellsignal.

from freqtrade-strategies.

hroff-1902 avatar hroff-1902 commented on May 16, 2024

...as i've never seen it this way.

if len(buyframe) == 0:
dataframe.loc[[False], 'sell'] = 0
return dataframe

🤣

Calling @berlinguyinca 😉

from freqtrade-strategies.

lebonez avatar lebonez commented on May 16, 2024

Thank you for the explanation. I've got a lot of interesting things to test and learn with this strategy.

You might already know but, how it triggers is if you get a pair that doesn't have a buy signal trigger in any of the past 500 candles. There are a couple on the exchange that is in that situation that can hit with dry-run. If you would like to see it in action. Theoretically, it could fail in backtesting if it has no buy signal in the total data range.

from freqtrade-strategies.

xmatthias avatar xmatthias commented on May 16, 2024

yes - that's absolutely true.

However, i'm "sceptical" about this whole section - assuming dry-run - we could have a buy - and no sell for 500+ candles for a pair (for whatever reason).

Then that pair / trade would have to rely on stoploss / ROI exclusively, since these 2 lines exclude it from ever getting a sell-signal.

There's no real reason to 0 sells if no buy happened - if there's nothing to sell, it simply won't sell.

from freqtrade-strategies.

lebonez avatar lebonez commented on May 16, 2024

Oh that is true doesn't seem to be that rare at the moment. I'm going to make some improvements no ideas at the moment though.

from freqtrade-strategies.

lebonez avatar lebonez commented on May 16, 2024

I agree. I am looking at it as I have time to see what I can do don't see a good way to fix those issues.

from freqtrade-strategies.

lebonez avatar lebonez commented on May 16, 2024

I put in a pull request after removing the buyframe dependencies it gets nearly the same results.

from freqtrade-strategies.

xmatthias avatar xmatthias commented on May 16, 2024

closed by #65

from freqtrade-strategies.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.