clocks156t174

quantized pin bar indicator with ATR

Abstract
This script computes the strength of pin bars.
This script uses the corrent and the previous two bars to compute the strength of pin bars.
The strength of pin bars can be also comared with average true range, so we can evaluate those pin bars are strong or weak.

Introduction
Pin bar is a popular price action trading strategy.
It is based on quick price rejection.
Most of existing pin bar scripts only determine if a bar is a pin bar or not.
However, evaluating the strength of pin bars is important.
If price rejection is too weak, it is difficult to trigger trend reversal.
If a pin bar is too strong, we may enter the trade too late and cannot have good profit.
In this script, it provides a method to compute to strength of pin bars.
After the strength of pin bars are quantized, they can compare with average true range, price range and trend strength, which can help us to determine where are worthy for us to open trades.

Computation
Bullish hammer : current low is lower than ( previous high or current open ) and current close.
Bearish gravestone : current high is higher than ( previous low or current open ) and current close.
Bullish engulfing and harami : ( current low or previous low ) is lower than ( previous 2nd high or previous open ) and current close.
Bearish engulfing and harami : ( current high or previous high ) is higher than ( previous 2nd low or previous open ) and current close.

Parameters
Smoothing : the type of computing average.
Length of ATR : determines the number of true ranges for computing average true range.
ATR multiplier line : the threshould that a pin bar is strong enough. For example, if this value is 0.5, it means a pin bar with 0.5*atr or more is considered a strong pin bar.
one direction pinbar : set to 1 if you want the strength of bullish pin bars and bearish pin bars are cancelled. Set to 0 if you want to keep both strength of bullish pin bars and bearish pin bars; in this case, you may need to change the plot style to make both strength visible.

Trading Suggestions
Evaluate the strength of trend against pin bars. After all, a single reverse pin bar may be too weak to reverse the trend.
Timeframe : if atr is higher than 4*spread, the timeframe is high enough. However, if strong pin bars appear too frequent or price range is too small, going to higher fimeframe may be more safe.
Entry and exit : according to personal flavors.

Conclusion
The strength of pin bars can be quantized.
With this indicator, we can find more potential pin bars which human eyes and binary pattern detectors were leaked.
In my opinion, 0.5*atr is the most suitable streng of a pin bar for my trade entry but I still need to consider the direction of the trend.
You are welcome to share your settings and related trading strategy.

References
Most of related knowledge can be searched from the internet.
I cannot say the exact references because they may violate the rules of Tradingview.
Mã nguồn mở

Với tinh thần TradingView, tác giả của tập lệnh này đã xuất bản nó dưới dạng mã nguồn mở, vì vậy các nhà giao dịch có thể hiểu và xác minh nó. Chúc mừng tác giả! Bạn có thể sử dụng mã này miễn phí, nhưng việc sử dụng lại mã này trong một ấn phẩm chịu sự điều chỉnh của Nội quy nội bộ. Bạn có thể yêu thích nó để sử dụng nó trên biểu đồ.

Thông báo miễn trừ trách nhiệm

Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.

Bạn muốn sử dụng tập lệnh này trên biểu đồ?