OPEN-SOURCE SCRIPT
ที่อัปเดต: ST | MA Occurrence Scanner

This tool is designed to automate the statistical backtesting of Moving Averages. Instead of subjectively looking at a chart to see if an MA is being "respected" by the price, this indicator quantifies every interaction to provide hard data.
How it Works: The scanner detects when price approaches a user-defined Moving Average (SMA) and tracks the outcome of that interaction based on a dynamic "Tolerance Zone."
How it Works: The scanner detects when price approaches a user-defined Moving Average (SMA) and tracks the outcome of that interaction based on a dynamic "Tolerance Zone."
เอกสารเผยแพร่
This tool is designed to automate the statistical backtesting of Moving Averages. Instead of subjectively looking at a chart to see if an MA is being "respected" by the price, this indicator quantifies every interaction to provide hard data.How it Works: The scanner detects when price approaches a user-defined Moving Average (SMA) and tracks the outcome of that interaction based on a dynamic "Tolerance Zone."
เอกสารเผยแพร่
Concept and Utility This indicator is a quantitative tool designed to automate the backtesting and real-time analysis of Moving Average (MA) interactions. Instead of subjectively eyeballing whether a price "respects" an SMA, this script provides statistical data by classifying every interaction into specific events. It is particularly useful for Swing Traders looking to validate if a specific Moving Average (e.g., SMA 50 or SMA 200) acts as a reliable dynamic support/resistance for a given asset.How the Calculation Works The script creates a dynamic "Buffer Zone" around the selected Moving Average based on a user-defined percentage tolerance. It then monitors price action relative to this zone using a state-machine logic:
Detection: The algorithm waits for the price to approach the MA after a period of "Isolation" (ensuring the approach is clean and not choppy).
Observation Window: Once the price enters the zone, a decision window opens (default 5 candles).
Event Classification:
✅ Bounce: The price touches the zone but fails to close decisively beyond the MA within the time limit. The label is placed at the exact pivot point (lowest low for support, highest high for resistance).
❌ Break: The price closes beyond the MA, signaling a trend violation.
⚠️ False (Trap): The price pierces the MA significantly (beyond a 'Trap Threshold') but reverses back to the original side, filtering out liquidity sweeps.
Key Features
Visual Labels: Automatically plots labels on the chart at the exact pivot points of interaction.
Statistical Dashboard: A table displays the total number of events and the percentage win rate of Bounces vs. Breaks, allowing for instant strategy validation.
Whipsaw Protection: Includes a "Cooldown" feature to prevent signal spamming during high volatility.
Customizable: Users can adjust the MA Length, Tolerance %, and Decision Window to fit different timeframes and volatilities.
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน