-
Notifications
You must be signed in to change notification settings - Fork 212
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Resampled dataframes are shifted 1 candle. #268
Comments
I answer myself... maybe I still don't understand what is explained in: but I consider that this way it works correctly because I haven't got delay in the indicators. please let me know if it is necessary to create a PR. |
it's pretty dangerous to compare screenshots with screenshots of tradingview without further information. The change you did above will cause the same exact problem - which will mean that maybe your backtesting results will look great - but the bot will most likely never trade in live. assuming a 15m / 1h timeframes (for simplicity) - as in freqtrade/freqtrade#4073: The main point here is to consider that all candle dates are candle open dates. The candle The "modified" date ( with your "fix": you use data available not before 23:00 (the 1h close) at 22:00. Given, it's a pretty complicated topic, but one we spent several days thinking about (several times, too). I can be profitable 100% of the time if i know in the morning how today's daily candle will close. Your change would facilitate this - but for live - such a thing will not be possible. |
Thank you xmatthias for taking the time to answer my question. Now I can understand the purpose of freqtrade/freqtrade#4073 I agree that it is a complicated issue. However, I think it is not useful for 100% of the cases. I want to use it as a protection and not to determine the entry to a trade. So the displacement in a timeframe of 4H or more is a long time of delay. What is your opinion of this change? |
Also for protections you'll have the same issue (repainting) - so the moment you use ANY other value than open (also through an indicator) - you'll think backtesting works great - but it doesn't work well on live. If you use it as signal or protection does not change the matter. The function will not be changed to allow looking into the future. As a library / framework, we'll however try hard to protect people from accidentally doing this - therefore we'll try to design as much as possible to protect from this. This also includes no option to "enable backtest cheating" - which this option would effectively be. |
Hello, I have a problem just like this bug #60. The resampled dataframes are shifted 1 candle.
Example
dataframe_1h = resample_to_interval(dataframe, 60)
dataframe_1h['TEMA9_1H'] = ta.TEMA(dataframe_1h, timeperiod=9, price='close')
dataframe = resampled_merge(dataframe, dataframe_1h, fill_na=True)
FREQTRADE - BTC/USDT(BINANCE)
----------------------------TEMA9_1H
2022-06-01 00:00 - 31,794
2022-06-01 01:00 - 31,857
2022-06-01 02:00 - 31,892
2022-06-01 03:00 - 31,855
2022-06-01 04:00 - 31,743
TRADINGVIEW - BTC/USDT(BINANCE)
----------------------------TEMA9_1H
2022-06-01 00:00 - 31,857
2022-06-01 01:00 - 31,892
2022-06-01 02:00 - 31,855
2022-06-01 03:00 - 31,743
2022-06-01 04:00 - 31,642
in these images you can see the shift to the right of the indicator in the top image
![freqtrade](https://user-images.githubusercontent.com/1746925/171693283-c570ee26-230f-4c9e-b74c-526bf0ddddd0.png)
![tradingview](https://user-images.githubusercontent.com/1746925/171693315-9c6179e0-de7c-484f-943b-0586cdc4fb78.png)
What am I doing wrong?
The text was updated successfully, but these errors were encountered: