OPEN-SOURCE SCRIPT
Probability System v1.0 [AstroHub]

The Probability System [AstroHub] is an indicator designed to assess the likelihood of a market trend change based on the analysis of previous candles. The system calculates the probability of price increasing (up) or decreasing (down) based on the count of bullish (up) and bearish (down) candles over a selected period. The script generates buy and sell signals based on these probabilities and displays visual elements that help traders gauge the strength of the trend across different timeframes.
How it works:

Probability Calculation:
The script analyzes the open and close prices of candles over the chosen period (default is 20).
Using this data, the script calculates the probability of price increasing Up Probability or decreasing Down Probability as percentages.
Signal Generation:
A Green signal is generated when the upProbability exceeds a set threshold.
A Red signal is generated when the downProbability exceeds a threshold.
Multi-Level Visualization:
For both up and down probabilities, four levels are defined: 50%, 60%, 70%, and 80%. Each level is represented by circles with varying intensity (color opacity):
Green circles below the price represent up probabilities, with increasing intensity indicating a stronger bullish trend.
Red circles above the price represent down probabilities, with increasing intensity showing stronger bearish signals.
Alerts:
Alerts are set up for each probability level, notifying traders in real-time when specific thresholds are met.
The alerts provide the exact percentage of the probability, allowing traders to act on changes in the market conditions promptly.
How to Use:
Set the desired analysis period (default is 20) and the probability threshold (e.g., 80%) for buy or sell signals.
The script will automatically display signals on the chart, as well as color-coded circles to indicate the probability strength.
Enable real-time notifications for each probability level to keep track of changes in the market trend.
This script is suitable for all types of traders, whether using short-term or long-term strategies.

Unique Features:
Multi-Level Probability Visualization: Four distinct probability levels (50%, 60%, 70%, 80%) are displayed with varying color intensities, providing a clearer understanding of market conditions.
Flexible Settings: Users can customize the analysis period and probability threshold according to their trading style and market conditions.
Real-Time Alerts: Alerts for different probability levels help traders respond swiftly to changes in the market.
Dynamic Signals Based on Statistics: The indicator doesn't rely on fixed data but rather uses the actual statistics of past candles, offering more accurate and timely signals for traders.
Suitable for All Trading Styles: Whether you trade short-term or follow longer-term strategies, this system is versatile and valuable for both types of traders.
Who it’s for:
This indicator is ideal for traders who use technical analysis and are looking for accurate signals based on the probability of trend changes. It’s useful for both beginner and experienced traders who want to improve the precision of their market decisions.
How it works:
Probability Calculation:
The script analyzes the open and close prices of candles over the chosen period (default is 20).
Using this data, the script calculates the probability of price increasing Up Probability or decreasing Down Probability as percentages.
Signal Generation:
A Green signal is generated when the upProbability exceeds a set threshold.
A Red signal is generated when the downProbability exceeds a threshold.
Multi-Level Visualization:
For both up and down probabilities, four levels are defined: 50%, 60%, 70%, and 80%. Each level is represented by circles with varying intensity (color opacity):
Green circles below the price represent up probabilities, with increasing intensity indicating a stronger bullish trend.
Red circles above the price represent down probabilities, with increasing intensity showing stronger bearish signals.
Alerts:
Alerts are set up for each probability level, notifying traders in real-time when specific thresholds are met.
The alerts provide the exact percentage of the probability, allowing traders to act on changes in the market conditions promptly.
How to Use:
Set the desired analysis period (default is 20) and the probability threshold (e.g., 80%) for buy or sell signals.
The script will automatically display signals on the chart, as well as color-coded circles to indicate the probability strength.
Enable real-time notifications for each probability level to keep track of changes in the market trend.
This script is suitable for all types of traders, whether using short-term or long-term strategies.
Unique Features:
Multi-Level Probability Visualization: Four distinct probability levels (50%, 60%, 70%, 80%) are displayed with varying color intensities, providing a clearer understanding of market conditions.
Flexible Settings: Users can customize the analysis period and probability threshold according to their trading style and market conditions.
Real-Time Alerts: Alerts for different probability levels help traders respond swiftly to changes in the market.
Dynamic Signals Based on Statistics: The indicator doesn't rely on fixed data but rather uses the actual statistics of past candles, offering more accurate and timely signals for traders.
Suitable for All Trading Styles: Whether you trade short-term or follow longer-term strategies, this system is versatile and valuable for both types of traders.
Who it’s for:
This indicator is ideal for traders who use technical analysis and are looking for accurate signals based on the probability of trend changes. It’s useful for both beginner and experienced traders who want to improve the precision of their market decisions.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.