OPEN-SOURCE SCRIPT
reversal candle

This indicator is a Technical Reversal Pattern Suite designed to identify specific candlestick formations that suggest a potential change in market direction. It combines trend filtering, volume analysis, and pattern recognition into a single tool.Here is a breakdown of how it works:1. Trend Filter (9 SMA)The indicator uses a 9-period Simple Moving Average (SMA) as the "filter" for the entire system.Why? Reversal patterns are highly contextual. A pattern that looks like a reversal in a downtrend is actually a "continuation" pattern if the overall trend is strongly upwards. By requiring the price to be on a specific side of the 9 SMA, the script ensures you are only looking for trades that align with the short-term momentum.2. Pattern Recognition LogicThe script looks for six distinct candlestick patterns, split by the trend they appear in:PatternCategoryLogicEngulfing (BE/BU)Trend ReversalOne candle's body completely "eats" or engulfs the previous candle's body, signaling a shift in control.Hammer (HM)BullishSmall body at the top with a long lower shadow; implies sellers were rejected.Inverted Hammer (IH)BullishSmall body at the bottom with a long upper shadow; shows buyers testing the resistance.Shooting Star (SS)BearishSmall body at the bottom with a long upper shadow; implies buyers were rejected at a peak.Hanging Man (HM)BearishSmall body at the top with a long lower shadow; implies that despite a low price, sellers are stepping in during an uptrend.3. Volume ConfirmationThe script includes a Volume Filter that calculates the average volume over the last 20 periods (ta.sma(volume, 20)).The Logic: A reversal pattern is considered "weak" or "noisy" if it happens on low volume. By requiring volume > volAvg, the indicator ensures that the pattern is backed by significant market participation, which increases the probability that a "real" move is occurring.4. Visual ManagementDynamic Labels: It uses a latestLabel variable to ensure that only the most recent signal remains on your screen, preventing historical clutter.Highlighting: It uses barcolor() to change the candle color the moment a pattern is detected, making the signal immediately visible without needing to check the labels.Summary of Indicators UsedMoving Averages: 9 SMA (Trend), 20 SMA (Volume).Candlestick Math: Uses the relationship between open, close, high, and low to calculate bodySize and shadow lengths.Logical Confluence: It forces four conditions to be true simultaneously before alerting: Trend direction + Pattern geometry + Volume threshold + Logic validity.This tool is designed to act as a "Decision Point" indicator. It does not tell you to buy or sell, but rather tells you when the market has reached a state of "exhaustion" where a reversal is statistically more likely to happen.
สคริปต์แบบโอเพนซอร์ส
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน
สคริปต์แบบโอเพนซอร์ส
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน