OPEN-SOURCE SCRIPT
XAUUSD Macro Anomaly Pulses (Chart XAU) - sudo

XAUUSD Macro Anomaly Pulses
A simple pulse indicator that highlights when XAUUSD moves in a way that macro conditions cannot fully explain
Overview
This indicator marks candles on XAUUSD that behave differently than what the broader market suggests should happen.
Instead of looking at XAUUSD alone, this tool compares gold’s actual movement to an expected movement based on:
Other gold cross pairs (XAUJPY, XAUAUD, XAUCHF)
The U.S. Dollar Index (DXY), inverted
The US30 index (Dow Jones)
When XAUUSD moves much stronger or weaker than this macro-based expectation, the indicator plots a small pulse (a circle) directly on the candle.
Purpose
This indicator helps you quickly see when a candle on XAUUSD is acting “out of character” compared to normal macro flow. In other words:
These unusual moves often signal:
Liquidity grabs
Stop hunts
News-driven spikes
False breakouts
Front-running of macro shifts
How It Works
It reads the XAUUSD candles directly from the chart.
This ensures pulses stick to your candles correctly.
It pulls data from basket legs (XAUJPY, XAUAUD, XAUCHF) and macro symbols (DXY, US30) using security calls.
It converts each symbol into a simple % return per candle.
It builds an “expected” gold move using weighted inputs:
Average return of gold crosses
Inverse return of DXY
Return of US30
It calculates the “residual,” which means:
Pine Script®
It turns that into a Z-score to measure how extreme the deviation is.
If the Z-score is too high or too low, the script marks the candle:
Aqua pulse below bar = unusually strong move
Fuchsia pulse above bar = unusually weak move
How to Interpret the Pulses
Aqua Pulse (below candle) – Bullish anomaly
XAUUSD moved stronger than the macro environment suggests.
Meaning:
-Possible liquidity grab upward
-Possible early trend move
-Possible false breakout
-Price may be overreacting
Fuchsia Pulse (above candle) – Bearish anomaly
XAUUSD moved weaker than expected.
Meaning:
-Possible liquidity sweep downward
-Possible aggressive sell-side event
-Possible exhaustion
-Price may be taking liquidity before reversing
Typical Use Cases
-Spot moments when gold acts independently of macro
-Identify candles that might signal a reversal or a trap
-Confirm whether a breakout is real or suspicious
-Filter trades by macro alignment
-Help understand when XAUUSD is reacting to news or liquidity instead of fundamentals
Inputs Explained
-Z-score Lookback – How many candles are considered normal behavior
-Z-threshold – How extreme a move must be before it is marked
-Basket / DXY / US30 weights – How much influence each macro component has
A simple pulse indicator that highlights when XAUUSD moves in a way that macro conditions cannot fully explain
Overview
This indicator marks candles on XAUUSD that behave differently than what the broader market suggests should happen.
Instead of looking at XAUUSD alone, this tool compares gold’s actual movement to an expected movement based on:
Other gold cross pairs (XAUJPY, XAUAUD, XAUCHF)
The U.S. Dollar Index (DXY), inverted
The US30 index (Dow Jones)
When XAUUSD moves much stronger or weaker than this macro-based expectation, the indicator plots a small pulse (a circle) directly on the candle.
Purpose
This indicator helps you quickly see when a candle on XAUUSD is acting “out of character” compared to normal macro flow. In other words:
“Did XAUUSD move in a way that makes sense with the rest of the market, or did something weird happen?”
These unusual moves often signal:
Liquidity grabs
Stop hunts
News-driven spikes
False breakouts
Front-running of macro shifts
How It Works
It reads the XAUUSD candles directly from the chart.
This ensures pulses stick to your candles correctly.
It pulls data from basket legs (XAUJPY, XAUAUD, XAUCHF) and macro symbols (DXY, US30) using security calls.
It converts each symbol into a simple % return per candle.
It builds an “expected” gold move using weighted inputs:
Average return of gold crosses
Inverse return of DXY
Return of US30
It calculates the “residual,” which means:
actual XAU return - expected macro return
It turns that into a Z-score to measure how extreme the deviation is.
If the Z-score is too high or too low, the script marks the candle:
Aqua pulse below bar = unusually strong move
Fuchsia pulse above bar = unusually weak move
How to Interpret the Pulses
Aqua Pulse (below candle) – Bullish anomaly
XAUUSD moved stronger than the macro environment suggests.
Meaning:
-Possible liquidity grab upward
-Possible early trend move
-Possible false breakout
-Price may be overreacting
Fuchsia Pulse (above candle) – Bearish anomaly
XAUUSD moved weaker than expected.
Meaning:
-Possible liquidity sweep downward
-Possible aggressive sell-side event
-Possible exhaustion
-Price may be taking liquidity before reversing
Typical Use Cases
-Spot moments when gold acts independently of macro
-Identify candles that might signal a reversal or a trap
-Confirm whether a breakout is real or suspicious
-Filter trades by macro alignment
-Help understand when XAUUSD is reacting to news or liquidity instead of fundamentals
Inputs Explained
-Z-score Lookback – How many candles are considered normal behavior
-Z-threshold – How extreme a move must be before it is marked
-Basket / DXY / US30 weights – How much influence each macro component has
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.