mkajnar / DailyBuyStrategy

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

HPStrategyDCA has_bias #1

Closed jifengthu closed 11 months ago

jifengthu commented 11 months ago

| filename | strategy | has_bias | total_signals | biased_entry_signals | biased_exit_signals | biased_indicators | |---------------+---------------+------------+-----------------+------------------------+-----------------------+--------------------------------------------------------------------| | HPStrategy.py | HPStrategyDCA | True | 20 | 0 | 0 | bullish_divergence, fractal_top, fractal_bottom, turnaround_signal |

jifengthu commented 11 months ago

the command is: freqtrade lookahead-analysis -s HPStrategyDCA --timerange 20230101-

mkajnar commented 11 months ago

I will try your command. Can you explain it more, before it? I am wide opened for advices. Thanks. :)

I understand now, backtest is not relevant (only help for develop), real tradings looks better in results. :)

image

Bot started yesterday make 13,6% profit. (DCA working) Started with small but real account.

image

mkajnar commented 11 months ago

| filename | strategy | has_bias | total_signals | biased_entry_signals | biased_exit_signals | biased_indicators | |---------------+---------------+------------+-----------------+------------------------+-----------------------+--------------------------------------------------------------------| | HPStrategy.py | HPStrategyDCA | True | 20 | 0 | 0 | bullish_divergence, fractal_top, fractal_bottom, turnaround_signal |

I have tested now. I have prepared these changes:

Bullish Divergence:

I used shift(1) to ensure that the lows of previous periods are compared to the current period, which avoids the appearance of a bias.

Fractals:

I modified the calculation to only "look" at data from the past. The shift(1) ensures that future data is not included. MACD and Volatility Factor:

MACD is calculated from historical data, so its calculation remains the same.

Volatility is calculated using the standard deviation of the last 14 candles, which is the standard method without lookahead bias. The normalization of volatility is done using the minimum and maximum values

After backtesting I will commit changes - today

mkajnar commented 11 months ago

image

Commited solution :) Again thanks bro. :)

jifengthu commented 11 months ago

You are welcome, great work!

MuhammadElsaeed commented 9 months ago

I run the same command against HPStrategyTFJPAConfirmV3.py and it seems it also has bias. | filename | strategy | has_bias | total_signals | biased_entry_signals | biased_exit_signals | biased_indicators | |-----------------------------+--------------------------+------------+-----------------+------------------------+-----------------------+-----------------------------------------------------| | HPStrategyTFJPAConfirmV3.py | HPStrategyTFJPAConfirmV3 | True | 20 | 8 | 6 | fibonacci_retracements, lowest_price, highest_p

CharlesJ-ABu commented 9 months ago

I run the same command against HPStrategyTFJPAConfirmV3.py and it seems it also has bias. | filename | strategy | has_bias | total_signals | biased_entry_signals | biased_exit_signals | biased_indicators | |-----------------------------+--------------------------+------------+-----------------+------------------------+-----------------------+-----------------------------------------------------| | HPStrategyTFJPAConfirmV3.py | HPStrategyTFJPAConfirmV3 | True | 20 | 8 | 6 | fibonacci_retracements, lowest_price, highest_p

I also encountered with this issue in HPStrategyTF and I modified the code for higher_tf_trend with a shift(1) function and the bias disappeared, you can try to find the specific biased_indicators and shift the data