Benford's Law Actual [Tagstrading]Benford’s Law Chart — First Digit Analysis of Percentage Price Drops
This script visualizes the distribution of the leading digit in the percentage change of price drops, and compares it to the theoretical distribution expected by Benford’s Law.
It helps traders, analysts, and quants to detect anomalies, unnatural behavior, or price manipulation in any asset or timeframe.
How to Use
Add to any chart or symbol (stocks, crypto, FX, etc.) and select the timeframe you wish to analyze.
Set the “Number of Bars to Analyze” input (default: 500) to control the length of the historical window.
The chart will display, for the latest window:
A blue line: the actual leading-digit distribution for percentage price changes between bars.
A red line: the expected distribution per Benford’s Law.
Labels below and above: digit markers and the expected (theoretical) percentages.
Summary panel on the right: frequency counts and actual vs. theoretical % for each digit.
Interpretation:
If your actual (blue) curve or digit counts are significantly different from the red Benford’s Law curve, it could indicate unnatural price action, fraud, bot activity, or structural anomalies.
Why is this useful for TradingView?
Financial forensics: Benford’s Law is a classic tool for detecting data manipulation and fraud in accounting. On charts, it can reveal if price movements are statistically “natural.”
Transparency and confidence: Helps communities audit markets, brokers, or exchanges for irregularities.
Adaptable: Works on any market, any timeframe.
What makes this script unique?
Focuses on % price changes, not raw prices.
This provides a fair comparison across assets, symbols, and timeframes.
Measures only the direction and magnitude of drops/rises — more suitable for detecting manipulation in active markets.
Clear and customizable visualization:
The Benford line, actual data, and summary are all visible and readable in one glance.
Optimized for speed and clarity (runs efficiently on all major charts).
How is it different from stg44’s Benford’s Law script?
This script analyzes the leading digit of percentage price changes (i.e., how much the price drops or rises in %),
while the original by stg44 analyzes the leading digit of price itself.
Results are less sensitive to price scale and more comparable across volatile and non-volatile assets.
The summary panel clearly shows ( ) for actual and for Benford theoretical values.
Full code is commented and open for the community.
Credits and Inspiration
This script was inspired by “Benford’s Law” by stg44:
Thanks to the TradingView community for sharing powerful visual ideas.
—
By tags trading
Manipulationzones
ICT Macros [LuxAlgo]The ICT Macros indicator aims to highlight & classify ICT Macros, which are time intervals where algorithmic trading takes place to interact with existing liquidity or to create new liquidity.
🔶 SETTINGS
🔹 Macros
Macro Time options (such as '09:50 AM 10:10'): Enable specific macro display.
Top Line , Mid Line , Bottom Line and Extending Lines options: Controls the lines for the specific macro.
🔹 Macro Classification
Length : A length to detect Market Structure Brakes and classify macro type based on detection.
Swing Area : Swing or Liquidity Area selection, highest/lowest of the wick or the candle bodies.
Accumulation , Manipulation and Expansion color options for the classified macros.
🔹 Others
Macro Texts : Controls both the size and the visibility of the macro text.
Alert Macro Times in Advance (Minutes) : This option will plot a vertical line presenting the start of the next macro time. The line will not appear all the time, but it will be there based on remaining minutes specified in the option.
Daylight Saving Time (DST) : Adjust time appropriate to Daylight Saving Time of the specific region.
🔶 USAGE
A macro is a way to automate a task or procedure which you perform on a regular basis.
In the context of ICT's teachings, a macro is a small program or set of instructions that unfolds within an algorithm, which influences price movements in the market. These macros operate at specific times and can be related to price runs from one level to another or certain market behaviors during specific time intervals. They help traders anticipate market movements and potential setups during specific time intervals.
To trade these effectively, it is important to understand the time of day when certain macros come into play, and it is strongly advised to introduce the concept of liquidity in your analysis.
Macros can be classified into three categories where the Macro classification is calculated based on the Market Structure prior to macro and the Market Structure during the macro duration:
Manipulation Macro
Manipulation macros are characterized by liquidity being swept both on the buyside and sellside.
Expansion Macro
Expansion macros are characterized by liquidity being swept only on the buyside or sellside. Prices within these macros are highly correlated with the overall trend.
Accumulation Macro
Accumulation macros are characterized by an accumulation of liquidity. Prices within these macros tend to range.
The script returns the maximum/minimum price values reached during the macro interval alongside the average between the maximum/minimum and extends them until a new macro starts. These levels can act as supports and resistances.
🔶 DETAILS
All required data for the macro detection and classification is retrieved using 1 minute data sets, this includes candles as well as pivot/swing highs and lows. This approach guarantees the visually presented objects are same (same highs/lows) on higher timeframes as well as the macro classification remain same as it is in 1 min charts.
8 Macros can be displayed by the script (4 are enabled by default):
02:33 AM 03:00 London Macro
04:03 AM 04:30 London Macro
08:50 AM 09:10 New York Macro
09:50 AM 10:10 New York Macro
10:50 AM 11:10 New York Macro
11:50 AM 12:10 New York Launch Macro
13:10 PM 13:40 New York Macro
15:15 PM 15:45 New York Macro
🔶 ALERTS
When an alert is configured, the user will have the ability to be notified in advance of the next Macro time, where the value specified in 'Alert Macro Times in Advance (Minutes)' option indicates how early to be notified.
🔶 LIMITATIONS
The script is supported on 1 min, 3 mins and 5 mins charts.
🔶 RELATED SCRIPTS