1Copy the scriptPress Copy script above, or the copy button on the code below.
2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.
Source Code
35 lines of Pine Script v5 from candlesticks/hammer_hanging_man.pine, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.
A Hammer requires a bullish candle with a small real body, a long lower shadow, and a short upper shadow after a lookback downtrend. A Hanging Man uses the same body and shadow rules on a bearish candle after a lookback uptrend. Inputs set body size, shadow ratios, lookback length, and visibility of each pattern. Matching bars are colored and labeled with arrows. It does not generate entries, exits, or risk management.
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
Hammer/Hanging Man body size threshold in percentage (0.50 = 50%)
float
0.50
hammerHangingManBodySizeThreshold
Hammer/Hanging Man lower shadow multiplier
float
1.8
hammerHangingManLowerShadowMultiplier
Hammer/Hanging Man upper shadow threshold in percentage (0.10 = 10 %)
float
0.10
hammerHangingManUpperShadowThreshold
Lookback Period
int
3
lookbackPeriod
Show Hammer
bool
true
showHammer
Show Hanging Man
bool
true
showHangingMan
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.
All Candlestick Patterns detects and highlights a wide range of bullish, bearish, and neutral candlestick patterns directly on the price chart. It features optional trend filtering using either a 50-period simple moving average or a combination of 50-period an
This indicator detects a large set of classic candlestick patterns and plots colored labels on the price chart. Trend context uses a 50-period simple moving average, or the 50 and 200 averages stacked together, and can be switched off. Users filter bullish, be
Five-in-one Strategy combines five analytical tools into a single price chart overlay: the Dual Thrust Trading Algorithm (DTTA), Semafore, HalfTrend, Nick Rypock Trailing Reverse, and Tweezer or Kangaroo Tail candlestick patterns. It generates trade signals us
This indicator calculates and plots Heikin-Ashi smoothed candlesticks directly on the price chart. It derives the smoothed close from standard price averages and recursively computes the open, high, and low values. The script does not issue trade signals or al
This indicator overlays on the price chart and provides trend and momentum analysis. It calculates and plots three exponential moving averages with fixed periods of 20, 50, and 200 using yellow, orange, and blue colors respectively. The script also computes th
The Confluence Suite indicator draws multiple trading signals and tools directly on the price chart. It generates entry and exit signals based on selected modes and filters, with an AI signal classifier rating quality from 1-4. Additional features include smar