mkajnar / DailyBuyStrategy

GNU General Public License v3.0
30 stars 19 forks source link

About the informative data involving lookahead bias #15

Open CharlesJ-ABu opened 6 months ago

CharlesJ-ABu commented 6 months ago

In codes below, it introduces lookahead bias, I suggest trying 'merge' function or please check 'nearest' function's definition: if not informative.empty:

Ujistěte se, že 'informative' je zarovnán s hlavním dataframe

        informative = informative.reindex(dataframe.index, method='nearest')
        # Nyní bezpečně porovnávejte uzavírací ceny, protože jsou zarovnané
        conditions.append(dataframe['close'] < informative['close'].shift(1))
    else:
        logging.info(f"No data available for {metadata['pair']} in '{level}' timeframe. Skipping this condition.")

Your strategy is great and codes above is the only lookahead bias's root....

eymanraz commented 5 months ago

Hello brother. This strategy is only for buying. Can you put buying and selling strategy at the same time, thank you