Why hammer candle signal works, but shooting star does not?

Discussion in 'Strategy Building' started by Kust, Aug 9, 2024.

  1. Kust

    Kust

    I'm testing different trading signals in Python. To avoid overfitting, I use daily time series of stocks, bonds, and commodities.

    I found that the hammer candle works great as expected, but the shooting star does not. The hammer candle works best when the price is above the moving average. However, the shooting star does not work under any conditions.

    If a shooting star is detected, then it is profitable to take a long position. This seems very strange to me. Can someone explain why is it so?

    Code:
    def check_shooting_star_candle(
        yesterday_high: float,
        yesterday_low: float,
        yesterday_close: float,
        today_high: float,
        today_low: float,
        today_open: float,
        today_close: float,
    ) -> bool:
        if (
            np.isnan(yesterday_high)
            or np.isnan(yesterday_low)
            or np.isnan(yesterday_close)
            or np.isnan(today_high)
            or np.isnan(today_low)
            or np.isnan(today_open)
            or np.isnan(today_close)
        ):
            return False
        if today_close > yesterday_close:
            return False
        if today_close > today_open:
            return False
        yesterday_high_low = yesterday_high - yesterday_low
        if today_high < (yesterday_high + (yesterday_high_low * 0.07)):
            return False
        today_high_low = today_high - today_low
        if (today_high - today_open) < (today_high_low * 0.75):
            return False
    
        # today close near low
        if (today_close - today_low) > (today_high_low * 0.15):
            return False
    
        # today close not too low to have potential to go lower in subsequent days
        if (yesterday_close - today_close) > (yesterday_high_low * 0.2):
            return False
    
        return True
     
  2. When the market's psycho turns negative... like in a bear... you will see the opposite.
     
    Relentless likes this.
  3. Gary186

    Gary186

    Your code is not the correct definition.you need consider body size and context and the position comparing previous bar. Maybe together volume.
     
    Last edited: Sep 21, 2024
  4. Zwaen

    Zwaen

    You will probably find that your system is very robust in an uptrending market. Why would that be?;)