OPEN-SOURCE SCRIPT
Gold SCALP XAUUSD (SMA200/PSAR/ADX/ATR/Arrows)

This script is a custom scalping indicator designed for XAUUSD (gold) trading, suitable for low timeframes such as 1-minute or 5-minute charts.
It combines several proven technical analysis tools: the 200-period Simple Moving Average (SMA), Parabolic SAR (PSAR), Average Directional Index (ADX), and Average True Range (ATR).
The script first calculates the 200-period SMA to determine the overall market trend – above the SMA is bullish, below is bearish.
The PSAR indicator is included to pinpoint short-term reversal points and precise breakout moments.
ADX is calculated manually within the script to measure the strength of the prevailing trend; only strong trends trigger signals.
ATR is used to dynamically set take-profit and stop-loss levels, adapting to current volatility.
A buy signal is generated when the close price crosses above the PSAR, price is above the 200 SMA (bullish environment), and ADX indicates a strong trend above the threshold.
A sell signal appears when the close crosses below the PSAR, price is below SMA 200, and ADX confirms a strong bearish trend.
Arrows are plotted on the chart for every valid buy or sell signal, making trade entries visually clear.
Take-profit and stop-loss levels are plotted as crosses above or below the entry, calculated as multiples of ATR.
The background color subtly changes to green or red, indicating whether the market is bullish or bearish per trend filter.
Users can quickly evaluate trend conditions and momentum at a glance using these color cues.
Parameters for SMA, PSAR, ADX, ATR, and profit/stop levels can be manually adjusted to fit the user’s risk and trading style.
ADX and DI (Directional Indicators) are calculated from price action, not with a built-in, and the code follows the standard ADX mathematical formula.
Signals appear only when the trend is strong, avoiding sideways or choppy movements and helping filter out false positives.
The script does not open or close trades automatically; it is strictly an informational and visual trading tool.
All the plots, shapes, and backgrounds are intended to increase clarity and make decision-making quick during scalping.
The code is written in Pine Script v5, fully compatible with TradingView charts.
It is especially useful for traders looking to capture quick moves but needing strict technical filtering for their scalping approach.
Combining dynamic and static volatility, directional, and trend-following tools helps maximize probability and reduce whipsaw trades.
The modular design enables further customization, such as adding more timeframes or integrating with alerts, based on user preference.
開源腳本
本著TradingView的真正精神,此腳本的創建者將其開源,以便交易者可以查看和驗證其功能。向作者致敬!雖然您可以免費使用它,但請記住,重新發佈程式碼必須遵守我們的網站規則。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。
開源腳本
本著TradingView的真正精神,此腳本的創建者將其開源,以便交易者可以查看和驗證其功能。向作者致敬!雖然您可以免費使用它,但請記住,重新發佈程式碼必須遵守我們的網站規則。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。