Hello,
This is just an easy but effective code, to detect pin bars.
“Shooting stars” = bearish pin bars
“Hammer” = bullish pin bars
I don’t consider the color of the candle, but the size of the wick.
Have a good trading !
I wrote this code in order to test a strategy.
This strategy fails, but not the indicator code.
shootingstar = 0
hammer = 0
IF (high - low) > 2* abs(close - open) THEN // définition d’une pin bar (étoile filante ou marteau)
IF (open - low) < 0.3*(high - low) OR (close - low) < 0.3*(high-low) THEN
shootingstar = -1
ENDIF
IF (high - open) < 0.3*(high - low) OR (high - close) < 0.3*(high-low) THEN
hammer = 1
ENDIF
ENDIF
return shootingstar as "Shooting Star", hammer as "Hammer"