Comments (14)
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.
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.
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.
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.
For relation between buy and sell, it's implemented as:
if buy and not sell:
# then buy
from freqtrade-strategies.
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.
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.
...as i've never seen it this way.
freqtrade-strategies/user_data/strategies/berlinguyinca/BinHV27.py
Lines 94 to 96 in 20941f7
🤣
Calling @berlinguyinca 😉
from freqtrade-strategies.
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.
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.
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.
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.
I put in a pull request after removing the buyframe dependencies it gets nearly the same results.
from freqtrade-strategies.
closed by #65
from freqtrade-strategies.
Related Issues (20)
- GodStra strat can't find ta module HOT 3
- How to get funding rate to use as indicator on freqtrade HOT 8
- Volatility Strategy HOT 2
- Lookahead for Strategy002 and 004 HOT 5
- cannot use the timeframe i want HOT 4
- GodStra not results available HOT 1
- GodStraHo: Impossible to load Strategy 'GodStraHo'. This class does not exist or contains Python code errors.
- GodStraHo: Impossible to load Strategy 'GodStraHo'. This class does not exist or contains Python code errors. #294 HOT 3
- Unable to retrieve candlestick information from dataframe HOT 1
- BB_RSI_ATR HOT 5
- Momentum Strategy HOT 4
- ta not installing on Google cloud instance and all futures strategies are not working HOT 3
- No module named 'ta' HOT 1
- incorrect times displayed in FreqUI HOT 4
- AlphaTrend Strategy HOT 3
- Error using MACD indicator from qtpylib indicators.py
- WARNING - Unable to analyze candle (OHLCV) data for pair {pair}: Dataframe returned from strategy has mismatching last close price. HOT 2
- finta problem HOT 2
- supertrend different timeframe
- strategy won't work with live trading in binance futures HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from freqtrade-strategies.