Skip to content
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

Look ahead bias ? #2

Open
designboxcom opened this issue Dec 2, 2022 · 3 comments
Open

Look ahead bias ? #2

designboxcom opened this issue Dec 2, 2022 · 3 comments
Assignees
Labels
question Further information is requested

Comments

@designboxcom
Copy link

Hello,
I am currenty learning the mechanics of freqtrade and its strategies and was interrested by your approach to find extrems.
I am not an expert and the process of learning is seamly a long road but, stil, I try my best to understand how strats and signals work at best.
Thus, I wondered if your strat doesn't suffer a so-called look-ahead bias ?
The gap between backtesting and dry-run is simply too enormous. On one side, the backtesting results are simply fantastic but, on another side, running a dry-run is totally another history. Poor results and bad extrems detection.

@ivanproskuryakov ivanproskuryakov self-assigned this Dec 3, 2022
@ivanproskuryakov
Copy link
Owner

Hi @designboxcom, the strategies in this repo started from the basic idea of finding lows and highs with the utilization of numpy's signal.argrelextrema methods.

The strategies performed well when the whole chunk of data was available - say backtesting, but required correction to filter out local minimus look-ahead bias, which you pointed out correctly.

Initially, this correction was made with simple fixed percentage drop checks, to filter out percentage drop drops of less than 5% and later re-implemented in a dynamic manner to adjust to catch a broader range of assets(Bitcoin and altcoins fluctuate currently).

Price drops check still was not catching fake deeps, with the second correction followed to look for a sequence of buying candles aimed to bypass fake deeps. This new correction relies on counting candles on RSI[7] for the given range, now the range is between 40 and 60.

Extremes search

Price drop check

Fake deep correction

Screenshot 2023-01-08 at 13 13 06

@ivanproskuryakov ivanproskuryakov added the question Further information is requested label Jan 8, 2023
@Daniel595
Copy link

Daniel595 commented Jan 6, 2024

Running lookahead-analysis from 20231226-20230105 says no bias detected:

2024-01-06 00:10:38,315 - freqtrade.optimize.analysis.lookahead - INFO - Found targeted trade amount = 20 signals.
2024-01-06 00:10:38,316 - freqtrade.loggers.set_log_levels - INFO - Restoring log verbosity.
2024-01-06 00:10:38,316 - freqtrade.optimize.analysis.lookahead - INFO - TaSearchLevelG15m: no bias detected
2024-01-06 00:10:38,316 - freqtrade.optimize.analysis.lookahead_helpers - INFO - Checking look ahead bias via backtests of TaSearchLevelG15m.py took 990 seconds.
| filename             | strategy          | has_bias   |   total_signals |   biased_entry_signals |   biased_exit_signals | biased_indicators   |
|----------------------+-------------------+------------+-----------------+------------------------+-----------------------+---------------------|
| TaSearchLevelG15m.py | TaSearchLevelG15m | False      |              20 |                      0 |                     0 |                     |

If this is sufficient to determine if lookahead bias is present.

@Daniel595
Copy link

But it's true, performance on dry run is very different though :-D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants