Financials ScoreThe Pine Script you've provided is designed to compute and display a "Financials Score" for a security based on several key financial metrics. This script is structured to run as an independent indicator on the TradingView platform, appearing in a separate pane rather than overlaying on the main price chart. Here's a breakdown of the script's components and functionality:
User Inputs
- **Period Selection**: Users can choose between 'FQ' (Financial Quarter) and 'FY' (Financial Year) to specify the period for which financial data should be considered.
- **Display Settings**: Allows customization of the table's appearance with inputs for text size, text color, data text color, and panel background color. These inputs help tailor the visual representation to the user's preferences.
- **Table Position**: Users can choose where to position any table within the indicator pane from several options like top left, top center, top right, etc.
- **Show Status Column**: A boolean input to decide whether to show an additional status column in any table outputs.
### Financial Metrics
The script retrieves various financial data points using the `request.financial` function. The data retrieved includes:
- **Operating Margin** (`opmar`)
- **Earnings Per Share (Basic)** (`eps`)
- **Price to Earnings Ratio** (`pe_ratio`)
- **Price to Book Ratio** (`pb_ratio`)
- **Debt to Equity Ratio** (`de_ratio`)
- **Return on Equity Adjusted to Book Value** (`roe_pb`)
- **Piotroski F-Score** (`fscore`)
### Scoring Logic
A scoring system is implemented where each financial metric contributes points to a total score based on specified conditions:
- **Operating Margin**: +20 points if greater than 20%.
- **EPS**: +20 points if greater than 0.
- **P/E Ratio**: +10 points if between 0 and 20.
- **P/B Ratio**: +10 points if less than 3.
- **D/E Ratio**: +10 points if less than 0.8.
- **ROE/PB Ratio**: +20 points if greater than 5.
- **F-Score**: +10 points if greater than 5.
The script uses ternary operators to conditionally add points to the `total_score` variable based on these criteria.
### Output
- **`plot` function**: The total score is plotted as a line graph in the indicator pane, allowing users to visually track the financial health score over time.
### Overall Functionality
This script is valuable for investors or traders who want to quickly assess the financial health of a company using key metrics and visualize this assessment directly within the TradingView interface. The score provides a simplified aggregate view that can aid in making investment decisions based on financial fundamentals.
基本面分析
Yield Curve SpaghettiDisplays the difference in yield between multiple bond pairs for a given country.
Currently supports US, DE, and GB bonds
Smart Money Interest Index [AlgoAlpha]🌟 Smart Money Interest Index by AlgoAlpha 🌟
Welcome to the innovative Smart Money Interest Index indicator, designed meticulously by AlgoAlpha to revolutionize the way you trade! 📈🧠 This indicator is engineered to decipher the activities of smart money investors relative to the less informed (dumb money) and dynamically display their dominance in the trading landscape through a sophisticated visual index. 🚀💹
🔑 Key Features:
- Smart vs. Dumb Money Analysis: Tracks and compares the movements of smart money (informed investors) and dumb money (general public) within the market to identify potential investment signals.
- Relative Strength Index (RSI) Based Ratios: Utilizes RSI for both smart and dumb money to create a ratio that indicates buying or selling pressures.
- Dynamic Normalization: Employs a long-term peak normalization over a customizable period to ensure the index remains relevant regardless of market conditions.
- Visual Thresholds and Signals: Highlights significant shifts in market dynamics with color-coded thresholds, making it easier to spot changes at a glance.
🛠 How to Use the Smart Money Interest Index:
🔹 🚀 Step 1: Adding the Indicator
- Add the indicator to your favourites.
- Customize the settings according to your analysis needs:
- `Index Period`, `Volume Flow Period`, `Normalization Period`, `High Interest Threshold`
🔹 📊 Step 2: Interpretation of the Index
- Monitor the index plot; a rising index suggests increasing smart money interest, potentially indicating a buying opportunity.
- A value above the high interest threshold (in yellow) highlights significant interest by smart money, suggesting a good time to buy.
🔹 🔔 Step 3: Setting Alerts
- Configure alerts to notify you when the index crosses above the set threshold, enabling you to capitalize on trading opportunities timely and efficiently.
📐 Basic Logic Overview:
The Smart Money Interest Index by AlgoAlpha provides a unique metric that contrasts the investment behaviors of informed (smart money) and general (dumb money) investors. Utilizing the Relative Strength Index (RSI), this indicator evaluates the trading pressure exerted by both groups over specified periods, then forms a ratio of these activities to identify dominance in buying or selling trends. For example, when we see dumb money selling and smart buying, this suggests that the conditions for buying the asset is optimal as smart money is willing to buy the dip. The outputs are normalized against the highest values observed in a user-defined term to maintain consistency through varying market conditions. When the index exceeds a certain threshold, it suggests that smart money presence is particularly strong, possibly indicating that smart money is looking to enter positions on the asset. This tool serves as a sophisticated visual guide to understanding market dynamics and making well-informed trading decisions based on the activities of market-savvy investors. Smart money activity is identified during areas of low volume and the opposite for dumb money, the indicator uses the NVI and PVI metrics as its foundation for smart and dumb money analysis.
📊 Enhance Your Trading Strategy:
Leverage the Smart Money Interest Index to gain deeper insights into market dynamics and enhance your decision-making process with a powerful, data-driven approach. Whether you're looking to identify entry points or set strategic exits, this tool is designed to provide you with the competitive edge you need in the fast-paced world of trading. 🌐✨
Transform your trading with the power of smart money analysis—start using the Smart Money Interest Index today! 🚀🔔
US CPIIntroducing "US CPI" Indicator
The "US CPI" indicator, based on the Consumer Price Index (CPI) of the United States, is a valuable tool for analyzing inflation trends in the U.S. economy. This indicator is derived from official data provided by the U.S. Bureau of Labor Statistics (BLS) and is widely recognized as a key measure of inflationary pressures.
What is CPI?
The Consumer Price Index (CPI) is a measure that examines the average change in prices paid by consumers for a basket of goods and services over time. It is an essential economic indicator used to gauge inflationary trends and assess changes in the cost of living.
How is "US CPI" Calculated?
The "US CPI" indicator in this script retrieves CPI data from the Federal Reserve Economic Data (FRED) using the FRED:CPIAUCSL symbol. It calculates the rate of change in CPI over a specified period (typically 12 months) and applies technical analysis tools like moving averages (SMA and EMA) for trend analysis and smoothing.
Why Use "US CPI" Indicator?
1. Inflation Analysis: Monitoring CPI trends provides insights into the rate of inflation, which is crucial for understanding the overall economic health and potential impact on monetary policy.
2. Policy Implications: Changes in CPI influence decisions by policymakers, central banks, and investors regarding interest rates, fiscal policies, and asset allocation.
3. Market Sentiment: CPI data often impacts market sentiment, influencing trading strategies across various asset classes including currencies, bonds, and equities.
Key Features:
1. Customizable Smoothing: The indicator allows users to apply exponential moving average (EMA) smoothing to CPI data for clearer trend identification.
2. Visual Representation: The plotted line visually represents the inflation rate based on CPI data, helping traders and analysts assess inflationary pressures at a glance.
Sources and Data Integrity:
The CPI data used in this indicator is sourced directly from FRED, ensuring reliability and accuracy. The script incorporates robust security protocols to handle data requests and maintain data integrity in a trading environment.
In conclusion, the "US CPI" indicator offers a comprehensive view of inflation dynamics in the U.S. economy, providing traders, economists, and policymakers with valuable insights for informed decision-making and risk management.
Disclaimer: This indicator and accompanying analysis are for informational purposes only and should not be construed as financial advice. Users are encouraged to conduct their own research and consult with professional advisors before making investment decisions.
Index Generator [By MUQWISHI]▋ INTRODUCTION :
The “Index Generator” simplifies the process of building a custom market index, allowing investors to enter a list of preferred holdings from global securities. It aims to serve as an approach for tracking performance, conducting research, and analyzing specific aspects of the global market. The output will include an index value, a table of holdings, and chart plotting, providing a deeper understanding of historical movement.
_______________________
▋ OVERVIEW:
The image can be taken as an example of building a custom index. I created this index and named it “My Oil & Gas Index”. The index comprises several global energy companies. Essentially, the indicator weights each company by collecting the number of shares and then computes the market capitalization before sorting them as seen in the table.
_______________________
▋ OUTPUTS:
The output can be divided into 3 sections:
1. Index Title (Name & Value).
2. Index Holdings.
3. Index Chart.
1. Index Title , displays the index name at the top, and at the bottom, it shows the index value, along with the daily change in points and percentage.
2. Index Holdings , displays list the holding securities inside a table that contains the ticker, price, daily change %, market cap, and weight %. Additionally, a tooltip appears when the user passes the cursor over a ticker's cell, showing brief information about the company, such as the company's name, exchange market, country, sector, and industry.
3. Index Chart , display a plot of the historical movement of the index in the form of a bar, candle, or line chart.
_______________________
▋ INDICATOR SETTINGS:
(1) Naming the index.
(2) Entering a currency. To unite all securities in one currency.
(3) Table location on the chart.
(4) Table’s cells size.
(5) Table’s colors.
(6) Sorting table. By securities’ (Market Cap, Change%, Price, or Ticker Alphabetical) order.
(7) Plotting formation (Candle, Bar, or Line)
(8) To show/hide any indicator’s components.
(9) There are 34 fields where user can fill them with symbols.
Please let me know if you have any questions.
ITG Scalper with Early SignalsThe TEMA-MACD Fusion Indicator combines the Triple Exponential Moving Average (TEMA) and Moving Average Convergence Divergence (MACD) to provide traders with a comprehensive insight into market momentum and trend direction.
TEMA is a powerful smoothing indicator that reduces lag and provides a clearer representation of price trends. By applying TEMA to MACD, this fusion indicator enhances the traditional MACD signals, offering more accurate and timely indications of trend changes and potential entry/exit points.
Key Features:
TEMA: The Triple Exponential Moving Average offers a unique perspective on price movements by providing a triple-smoothed average. It adapts more swiftly to changes in price compared to traditional moving averages, making it well-suited for capturing short to medium-term trends.
MACD: The Moving Average Convergence Divergence is a versatile momentum oscillator that depicts the relationship between two moving averages of an asset's price. It is widely used to identify trend direction, momentum strength, and potential reversal points.
Enhanced Signals: By integrating TEMA with MACD, this indicator generates enhanced signals that filter out noise and provide a clearer picture of market dynamics. It helps traders to identify trend reversals, confirm trend strength, and pinpoint potential entry and exit points with greater precision.
Customizable Parameters: Traders can customize the indicator's parameters according to their trading style and preferences, allowing for flexibility in signal generation and adaptability to various market conditions.
User-Friendly Interface: The indicator is designed with a user-friendly interface, making it accessible to traders of all levels of experience. Clear visual representations of signals and trend dynamics facilitate easy interpretation and decision-making.
Multi-Timeframe Compatibility: The TEMA-MACD Fusion Indicator is compatible with multiple timeframes, enabling traders to analyze trends and signals across different time horizons, from intraday to long-term perspectives.
Incorporate the TEMA-MACD Fusion Indicator into your trading strategy to gain deeper insights into market trends and make informed trading decisions with greater confidence.
True stock performance based on EY Bar divergenceI created this indicator to be used in conjunction with my other indicator "True stock performance based on Earnings Yield". I've detailed in that description how true performance is calculated. In short it measures how much EY is moving in relation to the stock price. The theory is that if stock price is moving heavily while EY isn't you have a sentiment driven trend and the stock isn't traded on fundamentals.
This indicators marks bars when stock performance divergences from true performance.
Green upward triangle = The true performance closes lower than previous while stock price is closing higher. This indicates a optimistic sentiment as stock price is pushed up even though price based on EY is moving down.
Red downward triangle = The true performance closes higher than previous while stock price closing lower. This indicates a negative sentiment as stock price is pushed down even though price based on EY is moving up.
How do I use it?
I use it to confirm when sentiment has taken taken over a stock. If you have a fair uptrend (when both stock performance and true performance are doing higher highs), optimistic divergencies are welcome. I've used NVIDIA from 2017 to 2019 to demonstrate.
But if true performance starts to make lower highs while stock performance keeps going up and you see optimistic divergencies, you can tell that the market is getting overoptimistic.
When the stock had crashed it eventually bottomed and started to make higher lows together with an uptrend of true performance, which I count as a fair uptrend. Regardless of that you start to see some negative divergencies indicating that people are scared that the stock will drop again and oversell. These opportunities can be good places to buy more.
But i don't care about earnings, I'm a technical trader. Do i have any use for it?
You possibly could, yes. If you want to follow the crowd, optimistic divergencies confirms that the market is still interested in the stock and may keep pushing the price up. But be careful. Negative divergencies almost never marks any tops, it often confirms downtrends and may indicate bottoms. Often the optimistic divergencies marks the top so don't buy more blindly using this indicator.
True stock performance based on Earnings YieldThe whole basis of the stock market is that you invest your money into a business that can use that money to increase it's earnings and pay you back for that investment with dividends and increased stock value. But because we are human the market often overbuy stocks that cant keep up their earnings with the current inflow of investments. We can also oversell a stock that is keeping up with earnings in regards to the stock price but we don't care because of the sentiment we have.
Earnings Yield is simply the percentage of Earnings Per Share in relation to the stock price. Alone, it's a great fundamental indicator to analyze a company. But I wanted to use it in another way and got tired of using the calculator all the time so that's why I made this indicator.
The goal is to see if the STOCK price is moving accordingly to the BUSINESS earnings. It works by calculating the difference of EY (TTM) previous close (1 bar) to the close thereafter. It then calculates the stock performance of the latest bar and divides that to get decimal form instead of percent. Then it divides the stock performance in decimal form with the difference of EY calculated before. The result shows how much the stock prices moves in relation to how much EY is moving. The theory is that if EY barely moves but the stock price moves heavily, you have a sentiment driven trend.
Example: Week 1 EY = 1.201. Week 2 EY = 1.105.
1.201 - 1.105 = 0.096
Week 2 performed a 11,2% increase in stock price. = 0.112 in decimal form.
0.112 / 0.096 = 1.67
1.67 is the multiple that plots this indicator.
Here is an good example of a stock that's currently in a highly sentiment driven trend, NVIDIA! (Posted 2024-03-30)
Here is an example of a Swedish stock that retail investors flocked to that have been blowned out completely.
When do I buy and sell?
This indicator is not meant to give exact entries or exits. The purpose is to scout the current and past sentiment, possible divergencies and see if a stock is over or under valued. I did add a 50 EMA to get some form of mean plotted. One could buy when true performance is low and sell when true performance drops below the 50 EMA. You could also just sell a part of your position and set a trailing exit with a ordinary 50 EMA or something like that. Often the sentiment will keep driving the price up. But if it last for 1 month or 1 year is impossible to tell.
Try it out and learn how it works and use it as you like. Cheers!
NVT Z-ScoreNVT Z-Score Script:
Data Source and Calculation: This script calculates the NVT ratio by dividing the market cap (assumed from QUANDL data) by a 90-day MA of the transaction volume (also from QUANDL), similar to the NVTS calculation. However, the adaptation lies in further analyzing the NVT ratio through a Z-score approach, not explicitly described in the original NVTS methodology.
Z-Score Analysis: The script calculates the mean and standard deviation of the NVT ratio over a user-defined period (daysForMean, defaulting to 180 days) and then computes the Z-score of the current NVT ratio relative to this historical data. This Z-score analysis introduces a standardized way of understanding the NVT ratio's deviation from its historical average, offering a nuanced view of market valuation states.
Visualization and Dynamic Zones: The visualization emphasizes Z-score-based dynamic zones (green, yellow, and red), determined by the stdDevMultiplier. These zones are plotted and filled on the chart, providing visual cues for interpreting the NVT ratio's current state in relation to its historical norm. This aspect significantly differs from the traditional NVTS approach by directly incorporating the concept of standard deviation and Z-scores into the analysis.
Inflation CorrelationHeyo fellas,
In today’s dynamic economic landscape, understanding the relationship of market prices to other economical factors like inflation rate is crucial. The Inflation Correlation Indicator is designed to provide traders with a clear visualization of this relationship. By correlating average inflation rates from selected countries with market closing prices, this indicator offers a unique perspective on potential market movements influenced by inflationary trends.
Features:
Country Selection: Choose from the European Union (EU), Germany (DE), or the United States (US) to tailor the correlation analysis to your specific market interest.
Correlation Length Customization: Adjust the correlation length to refine the sensitivity of the indicator to recent inflation data.
Visual Clarity: The correlation histogram changes color based on the direction of the correlation, providing an intuitive understanding of the inflation correlation.
Whether you’re a fundamental analyst seeking to incorporate macroeconomic indicators into your strategy or a trader looking for an edge in inflation-sensitive markets, the Inflation Correlation Indicator is an indispensable tool in your TradingView arsenal.
Thanks for checking this out!
Best regards,
simwai
NSE Option Straddle Candle Chart
'NSE Option Straddle Candle Chart' plot a straddle chart of the mentioned strike.
Straddle means combine price of a call price and a put price.
User has 4 inputs :
1 : Spot Symbol
2 : Expiry date
3 : Straddle Strikes
4 : Ema Length
5 : Supertrend Inputs
How to use :
1 : Trade need to know first what is a straddle. If ATM straddle price is 405, than it means market is likely to close within 405 points up or down at the expiry.
2 : Straddle is traded on pairs only
3 : If trader sells a straddle than , straddle price should move down. For there reference supertrend and moving average is plotted on chart
4 : Both this indicators helps trade to identify the trend , hence predict market.
5 : Options are dying assite , so is straddle , so prefer selling straddle instead of buying.
Buffett IndicatorThis is an open-source version of the Buffett indicator. The old version was code-protected and broken, so I created another version.
It's computed simply as the entire SPX 500 capitalization divided by the US GDP. Since TradingView does not have data for the SPX 500 capitalization, I used quarterly values of SPX devisors as a proxy.
I tried to create another version of the Buffett indicator for other countries/indexes, but I can't find the data. If you can help me find data for index divisors, I can add more choices to this indicator.
It's interesting to see how this indicator's behavior has changed in the last few years. Levels that looked crazy are not so crazy anymore.
Disclaimer
Please remember that past performance may not be indicative of future results.
Due to various factors, including changing market conditions, the strategy may no longer perform as well as in historical backtesting.
This post and the script don’t provide any financial advice.
NSE Option Chain
This Indicator show Options Data on signal dashboard , that help trader to analyse the market.
Options data consist of two things , Call and Put.
Every Strike has its Call and Put price.
So if user Opens any chart which is traded in options , dashboard will show total 16 Call and 16 Put strikes
8 Above from ATM and 8 Below from ATM.
On left hand side of dashboard there is Call data and on right side there is Put data.
Call side datas are , Call LTP which is latest price of that call strike , Call Chg which is change in points from previous day close and third is Call % which is % change from previous day close.
Same is on put side.
Color code is done based on positive or negative of data. If change or % is negative then color is red else green.
ATM strike data is plotted in bold
Inputs :
Spot Symbol Input for Option dashboard
Expiry date of that option contract
Strike interval between 2 strikes
Reference ATM strike ( user should keep this input as current ATM strike )
How to Use :
If dashboard shows call side is negative and put side is positive then that means market Bearish , because falling market leads to falling price of call and increase in price of Put.
Similarly if put is negative and call is positive then market is bullish.
This dashboard give trend conformation , trader should take other conformation also before taking trade.
Statistics • Chi Square • P-value • SignificanceThe Statistics • Chi Square • P-value • Significance publication aims to provide a tool for combining different conditions and checking whether the outcome is significant using the Chi-Square Test and P-value.
🔶 USAGE
The basic principle is to compare two or more groups and check the results of a query test, such as asking men and women whether they want to see a romantic or non-romantic movie.
–––––––––––––––––––––––––––––––––––––––––––––
| | ROMANTIC | NON-ROMANTIC | ⬅︎ MOVIE |
–––––––––––––––––––––––––––––––––––––––––––––
| MEN | 2 | 8 | 10 |
–––––––––––––––––––––––––––––––––––––––––––––
| WOMEN | 7 | 3 | 10 |
–––––––––––––––––––––––––––––––––––––––––––––
|⬆︎ SEX | 10 | 10 | 20 |
–––––––––––––––––––––––––––––––––––––––––––––
We calculate the Chi-Square Formula, which is:
Χ² = Σ ( (Observed Value − Expected Value)² / Expected Value )
In this publication, this is:
chiSquare = 0.
for i = 0 to rows -1
for j = 0 to colums -1
observedValue = aBin.get(i).aFloat.get(j)
expectedValue = math.max(1e-12, aBin.get(i).aFloat.get(colums) * aBin.get(rows).aFloat.get(j) / sumT) //Division by 0 protection
chiSquare += math.pow(observedValue - expectedValue, 2) / expectedValue
Together with the 'Degree of Freedom', which is (rows − 1) × (columns − 1) , the P-value can be calculated.
In this case it is P-value: 0.02462
A P-value lower than 0.05 is considered to be significant. Statistically, women tend to choose a romantic movie more, while men prefer a non-romantic one.
Users have the option to choose a P-value, calculated from a standard table or through a math.ucla.edu - Javascript-based function (see references below).
Note that the population (10 men + 10 women = 20) is small, something to consider.
Either way, this principle is applied in the script, where conditions can be chosen like rsi, close, high, ...
🔹 CONDITION
Conditions are added to the left column ('CONDITION')
For example, previous rsi values (rsi ) between 0-100, divided in separate groups
🔹 CLOSE
Then, the movement of the last close is evaluated
UP when close is higher then previous close (close )
DOWN when close is lower then previous close
EQUAL when close is equal then previous close
It is also possible to use only 2 columns by adding EQUAL to UP or DOWN
UP
DOWN/EQUAL
or
UP/EQUAL
DOWN
In other words, when previous rsi value was between 80 and 90, this resulted in:
19 times a current close higher than previous close
14 times a current close lower than previous close
0 times a current close equal than previous close
However, the P-value tells us it is not statistical significant.
NOTE: Always keep in mind that past behaviour gives no certainty about future behaviour.
A vertical line is drawn at the beginning of the chosen population (max 4990)
Here, the results seem significant.
🔹 GROUPS
It is important to ensure that the groups are formed correctly. All possibilities should be present, and conditions should only be part of 1 group.
In the example above, the two top situations are acceptable; close against close can only be higher, lower or equal.
The two examples at the bottom, however, are very poorly constructed.
Several conditions can be placed in more than 1 group, and some conditions are not integrated into a group. Even if the results are significant, they are useless because of the group formation.
A population count is added as an aid to spot errors in group formation.
In this example, there is a discrepancy between the population and total count due to the absence of a condition.
The results when rsi was between 5-25 are not included, resulting in unreliable results.
🔹 PRACTICAL EXAMPLES
In this example, we have specific groups where the condition only applies to that group.
For example, the condition rsi > 55 and rsi <= 65 isn't true in another group.
Also, every possible rsi value (0 - 100) is present in 1 of the groups.
rsi > 15 and rsi <= 25 28 times UP, 19 times DOWN and 2 times EQUAL. P-value: 0.01171
When looking in detail and examining the area 15-25 RSI, we see this:
The population is now not representative (only checking for RSI between 15-25; all other RSI values are not included), so we can ignore the P-value in this case. It is merely to check in detail. In this case, the RSI values 23 and 24 seem promising.
NOTE: We should check what the close price did without any condition.
If, for example, the close price had risen 100 times out of 100, this would make things very relative.
In this case (at least two conditions need to be present), we set 1 condition at 'always true' and another at 'always false' so we'll get only the close values without any condition:
Changing the population or the conditions will change the P-value.
In the following example, the outcome is evaluated when:
close value from 1 bar back is higher than the close value from 2 bars back
close value from 1 bar back is lower/equal than the close value from 2 bars back
Or:
close value from 1 bar back is higher than the close value from 2 bars back
close value from 1 bar back is equal than the close value from 2 bars back
close value from 1 bar back is lower than the close value from 2 bars back
In both examples, all possibilities of close against close are included in the calculations. close can only by higher, equal or lower than close
Both examples have the results without a condition included (5 = 5 and 5 < 5) so one can compare the direction of current close.
🔶 NOTES
• Always keep in mind that:
Past behaviour gives no certainty about future behaviour.
Everything depends on time, cycles, events, fundamentals, technicals, ...
• This test only works for categorical data (data in categories), such as Gender {Men, Women} or color {Red, Yellow, Green, Blue} etc., but not numerical data such as height or weight. One might argue that such tests shouldn't use rsi, close, ... values.
• Consider what you're measuring
For example rsi of the current bar will always lead to a close higher than the previous close, since this is inherent to the rsi calculations.
• Be careful; often, there are na -values at the beginning of the series, which are not included in the calculations!
• Always keep in mind considering what the close price did without any condition
• The numbers must be large enough. Each entry must be five or more. In other words, it is vital to make the 'population' large enough.
• The code can be developed further, for example, by splitting UP, DOWN in close UP 1-2%, close UP 2-3%, close UP 3-4%, ...
• rsi can be supplemented with stochRSI, MFI, sma, ema, ...
🔶 SETTINGS
🔹 Population
• Choose the population size; in other words, how many bars you want to go back to. If fewer bars are available than set, this will be automatically adjusted.
🔹 Inputs
At least two conditions need to be chosen.
• Users can add up to 11 conditions, where each condition can contain two different conditions.
🔹 RSI
• Length
🔹 Levels
• Set the used levels as desired.
🔹 Levels
• P-value: P-value retrieved using a standard table method or a function.
• Used function, derived from Chi-Square Distribution Function; JavaScript
LogGamma(Z) =>
S = 1
+ 76.18009173 / Z
- 86.50532033 / (Z+1)
+ 24.01409822 / (Z+2)
- 1.231739516 / (Z+3)
+ 0.00120858003 / (Z+4)
- 0.00000536382 / (Z+5)
(Z-.5) * math.log(Z+4.5) - (Z+4.5) + math.log(S * 2.50662827465)
Gcf(float X, A) => // Good for X > A +1
A0=0., B0=1., A1=1., B1=X, AOLD=0., N=0
while (math.abs((A1-AOLD)/A1) > .00001)
AOLD := A1
N += 1
A0 := A1+(N-A)*A0
B0 := B1+(N-A)*B0
A1 := X*A0+N*A1
B1 := X*B0+N*B1
A0 := A0/B1
B0 := B0/B1
A1 := A1/B1
B1 := 1
Prob = math.exp(A * math.log(X) - X - LogGamma(A)) * A1
1 - Prob
Gser(X, A) => // Good for X < A +1
T9 = 1. / A
G = T9
I = 1
while (T9 > G* 0.00001)
T9 := T9 * X / (A + I)
G := G + T9
I += 1
G *= math.exp(A * math.log(X) - X - LogGamma(A))
Gammacdf(x, a) =>
GI = 0.
if (x<=0)
GI := 0
else if (x
Chisqcdf = Gammacdf(Z/2, DF/2)
Chisqcdf := math.round(Chisqcdf * 100000) / 100000
pValue = 1 - Chisqcdf
🔶 REFERENCES
mathsisfun.com, Chi-Square Test
Chi-Square Distribution Function
1995-Present - Inflation and Purchasing PowerGood day, everyone! Today, we're going to look at a chart that's a bit different from the usual price charts we analyse. This isn't just any chart; it's a lens into the past, adjusted for the reality of inflation—a concept we often hear about but seldom see directly applied to our trading charts.
What we have here is an 'Inflation Adjusted Price' indicator on TradingView, and it's doing something quite special. It's showing us the price of our asset, let's say the S&P 500, not just in today's dollars, but in the dollars of 1995. Why 1995, you ask? Well, it's the starting point we've chosen to measure how much actual buying power has changed since then.
So, every point on this red line we see represents what the S&P 500's value would be if we stripped away the effects of inflation. This is the price in terms of what your money could actually buy you back in 1995.
As traders and investors, we're always looking at prices going up and thinking, 'Great! My investment is growing!' But the real question we should ask is, 'Is my money growing in real terms? Can it buy me more than it did last year, or five, ten, or twenty-five years ago?'
This chart tells us exactly that. If the red line is above the actual price, it means that the S&P 500 has not just grown in nominal terms, but it has actually outpaced inflation. Your investment has grown in real terms; it can buy you more now than it could back in 1995.
On the flip side, if the red line is below the actual price, that's a sign that while the nominal price might be up, the real value, the purchasing power, hasn't grown as much or could even have fallen.
This view is crucial, especially for the long-term investors among us. It gives us a reality check on our investments and savings. Are we truly growing our wealth, or are we just keeping up with the cost of living? This indicator answers that.
Remember, the true measure of financial growth is not just the numbers on a chart. It's what you can do with those numbers—how much bread, or eggs, or yes, even houses, you can buy with your hard-earned money
Daily Close GAP Detector [Yosiet]User Manual for "Daily Close GAP Detector "
Overview
This script is designed to help traders identify and react to significant gaps in daily market prices. It plots daily open and close prices and highlights significant gaps with a cross. The script is particularly useful for identifying potential breakouts or reversals based on these gaps.
Configuration
GAP Close Threshold: This input allows you to set a threshold for the gap size that you consider significant. The default value is 0.001.
Timeframe Seeker: This input lets you choose the timeframe for the gap detection. The default is 'D' for daily.
Features
Daily Open and Close Lines: The script plots daily open and close prices. If the close price is lower than the open price, the line is colored red; otherwise, it's green.
Gap Detection: It calculates the difference between the current day's close and the previous day's close, both adjusted for the selected timeframe. If this difference exceeds the threshold, it's considered a significant gap.
Significant Gap Indicator: A cross is plotted on the chart to indicate significant gaps. The color of the cross indicates whether the gap is a short or long gap: red for short gaps and green for long gaps.
Alert Conditions: The script sets up alert conditions for short and long gap breakouts. You can customize the alert messages to include details like the ticker symbol, interval, price, and exchange.
How to Use
Add the Script to Your Chart: Copy the script into the Pine Script editor on TradingView and add it to your chart.
Configure Inputs: Adjust the "GAP Close Threshold" and "Timeframe Seeker" inputs as needed.
Review the Chart: The script will overlay daily open and close prices on your chart, along with crosses indicating significant gaps.
Set Alerts: Use the script's alert conditions to set up alerts for short and long gap breakouts. You can customize the alert messages to suit your trading strategy.
Extending the Code
To extend this script, you can modify the gap detection logic, add more indicators, or integrate it with other scripts for a more comprehensive trading strategy. Remember to test any changes thoroughly before using them in live trading.
Earnings Line+Growth stock investors are concerned with Earnings per share that is growing, Sales (Revenue) that is growing and Increasing gross margins. This indicator helps view each of these parameters.
On the chart is Tesla (TSLA) gross margin (blue line) on a 12 trailing months basis (TTM). As you can see, TSLA's margins appear to be eroding.
The user selects one of the following parameters to display from the input drop down menu:
"EARNINGS_PER_SHARE_BASIC", "TOTAL_REVENUE", or "GROSS_MARGIN".
The value axis for your selection will appear on the left side of the chart.
The user also selects one of the following periods: "FY", "FQ" or "TTM" (Fiscal year, fiscal quarter or 12-trailing months). You have an option to display the inputs by checking the box. This is useful as a reminder but can be removed if the label is in the way.
The chart will render on any chart time scale, however longer time scales will probably be of more value. Weekly charts work well.
It is not possible to display more than one line simultaneously because of axis incompatibilities. However, it is possible to load this indicator multiple times and select different items in each. In this case additional left-side scales will be shown as well as additional lines. Common pairings are Revenue (Sales) and Earnings, or, Revenue and Gross Margin.
@ jmikes
Blockunity US Market Liquidity (BML)Get a clear view of US market liquidity and monitor its status at a glance to anticipate movements on risky assets.
The Idea
The BML aggregates and analyzes total USD market liquidity in trillions of dollars. It is used to monitor the liquidity of the USD market. When liquidity is good, all is well. If liquidity is low, the US will maneuver and sell treasury bills (debt) to replenish its treasury, which can lead to bearish pressure on markets, particularly those considered risky, such as Bitcoin.
How to Use
The indicator is very easy to use, there's nothing special about it. This tool is mainly intended to be used as fundamental information, and not for active trading.
Elements
The US Market Liquidity has several distinct components:
FED Balance Sheet
The Fed credits member banks’ Fed accounts with money, and in return, banks sell the Fed US Treasuries and/or US Mortgage-Backed Securities. This is how the Fed “prints” money to juice the financial system.
US Treasury General Account
The US Treasury General Account (TGA) balances with the NY Fed. When it decreases, it means the US Treasury is injecting money into the economy directly and creating activity. When it increases, it means the US Treasury is saving money and not stimulating economic activity. The TGA also increases when the Treasury sells bonds. This action removes liquidity from the market as buyers must pay for their bonds with dollars.
Overnight Reverse Repurchase Agreements
A reverse repurchase agreement (known as Reverse Repo or RRP) is a transaction in which the New York Fed under the authorization and direction of the Federal Open Market Committee sells a security to an eligible counterparty with an agreement to repurchase that same security at a specified price at a specific time in the future.
Earnings Remittances Due to the Treasury
The Federal Reserve Banks remit residual net earnings to the US Treasury after providing for the costs of operations, payment of dividends, and the amount necessary to maintain each Federal Reserve Bank’s allotted surplus cap. Positive amounts represent the estimated weekly remittances due to the US Treasury. Negative amounts represent the cumulative deferred asset position, which is incurred during a period when earnings are not sufficient to provide for the cost of operations, payment of dividends, and maintaining surplus.
Settings
Several parameters can be defined in the indicator configuration. You can:
Choose the smoothing and timeframe to be used in the plot.
Set the EMA lookback period and display it or not. This affects the color of the main plot.
Set the period to be taken into account when calculating the variation rate in the table.
Select the data to be taken into account in the calculation.
Activate or not the barcolor.
Lastly, you can modify all table parameters.
BTC Valuation
The BTC Valuation indicator
is a powerful tool designed to assist traders and analysts in evaluating the current state of Bitcoin's market valuation. By leveraging key moving averages and a logarithmic trendline, this indicator offers valuable insights into potential buying or selling opportunities based on historical price value.
Key Features:
200MA/P (200-day Moving Average to Price Ratio):
Provides a perspective on Bitcoin's long-term trend by comparing the current price to its 200-day Simple Moving Average (SMA).
A positive value suggests potential undervaluation, while a negative value may indicate overvaluation.
50MA/P (50-day Moving Average to Price Ratio):
Focuses on short-term trends, offering insights into the relationship between Bitcoin's current price and its 50-day SMA.
Helps traders identify potential bullish or bearish trends in the near term.
LTL/P (Logarithmic TrendLine to Price Ratio):
Incorporates a logarithmic trendline, considering Bitcoin's historical age in days.
Assists in evaluating whether the current price aligns with the long-term logarithmic trend, signaling potential overvaluation or undervaluation.
How to Use:
Z Score Indicator Integration:
The BTC Valuation indicator leverages the Z Score Indicator to score the ratios in a statistical way.
Statistical scoring provides a standardized measure of how far each ratio deviates from the mean, aiding in a more nuanced and objective evaluation.
Z Score Indicator
This BTC Valuation indicator provides a comprehensive view of Bitcoin's valuation dynamics, allowing traders to make informed decisions.
While indicators like BTC Valuation provide valuable insights, it's crucial to remember that no indicator guarantees market predictions.
Traders should use indicators as part of a comprehensive strategy and consider multiple factors before making trading decisions.
Historical performance is not indicative of future results. Exercise caution and continually refine your approach based on market dynamics.
Commitments of Traders Report [Advanced]This indicator displays the Commitment of Traders (COT) report data in a clear, table format similar to an Excel spreadsheet, with additional functionalities to analyze open interest and position changes. The COT report, published weekly by the Commodity Futures Trading Commission (CFTC), provides valuable insights into market sentiment by revealing the positioning of various trader categories.
Display:
Release Date: When the data was released.
Open Interest: Shows the total number of open contracts for the underlying instrument held by selected trader category.
Net Contracts: Shows the difference between long and short positions for selected trader category.
Long/Short OI: Displays the long and short positions held by selected trader category.
Change in Long/Short OI: Displays the change in long and short positions since the previous reporting period. This can highlight buying or selling pressure.
Long & Short Percentage: Displays the percentage of total long and short positions held by each category.
Trader Categories (Configurable)
Commercials: Hedgers who use futures contracts to manage risk associated with their underlying business (e.g., producers, consumers).
Non-Commercials (Large Speculators): Speculative traders with large positions who aim to profit from price movements (e.g., hedge funds, investment banks).
Non-Reportable (Small Speculators/Retail Traders): Smaller traders with positions below the CFTC reporting thresholds.
CFTC Code: If the indicator fails to retrieve data, you can manually enter the CFTC code for the specific instrument. The code for instrument can be found on CFTC's website.
Using the Indicator Effectively
Market Sentiment Gauge: Analyze the positioning of each trader category to gauge overall market sentiment.
High net longs by commercials might indicate a bullish outlook, while high net shorts could suggest bearish sentiment.
Changes in open interest and long/short positions can provide additional insights into buying and selling pressure.
Trend Confirmation: Don't rely solely on COT data for trade signals. Use it alongside price action and other technical indicators for confirmation.
Identify Potential Turning Points: Extreme readings in COT data, combined with significant changes in open interest or positioning, might precede trend reversals, but exercise caution and combine with other analysis tools.
Disclaimer
Remember, the COT report is just one piece of the puzzle. It should not be used for making isolated trading decisions. Consider incorporating it into a comprehensive trading strategy that factors in other technical and fundamental analysis.
Credit
A big shoutout to Nick from Transparent FX ! His expertise and thoughtful analysis have been a major inspiration in developing this COT Report indicator. To know more about this indicator and how to use it, be sure to check out his work.
IDX Financials v2This indicator adds financial data, ratios, and valuations to your chart. The main objective is to present financial overview that can be glanced quickly to add to your considerations.
The visualization of the indicator consists of two parts:
A. Plots (lines alongside the candlestick)
B. Financial table on the right. Drag your candlestick to the left to provide blank area for the table.
Programatically, the financial data is obtained by using these Pine API:
request.earnings(...) API for the EPS values that are used by the price at average PER line , and
request.financial(..) API for the rest of financial data required by the indicator.
See What financial data is available in Pine for more info on getting financial data in Pine.
A. THE PLOTS
The plots produces two lines, price at average PER in blue and price at average PBV line in pink, calculated over some adjustable time period (the default is one year). By default, only price at average PER line is shown.
Note that PER stands for Price to Earning Ratio.
The price at average PER line shows the price level at the average PER. It is calculated using formula as follows:
line = AVGPER * EPSTTM
where AVGPER is the average PER over some time period (default is one year, adjustable) and EPSTTM is the standardized EPS TTM.
Note that the EPS is updated at the actual time of earning report publication , and not at standard quarter dates such as March 31st, Dec 31st, etc.. This approach is chosen to represent the actual PE at the time.
The price at average PBV line (PBV stands for Price to Book Value), which can be enabled in settings, shows the price at average PBV. It is calculated using formula as follows:
line = AVGPBV * BVPS
where AVGPBV is the average PBV over some period of time (default is one year, adjustable) and BVPS is the book value per share. Note that the PBV is clipped to range to avoid values that are too small/large.
Also note that unlike PER, the BVPS is updated at each quarterly date (such as March 31st, Dec 31st, etc.).
Apart from those lines, some values are written to the status line (i.e. the numbers next to indicator name), which represent the corresponding value at the currently hovered bar:
PER TTM
Average PER
Std value (zvalue) of PER TTM (equal to = (PERTTM - AVGPER)/STDPER)
PBV
The meaning for these abbreviations should be straightforward.
Using the price at average PER line
There are several ways to use the price at average PER line .
You can quickly get the sense of current valuation by seeing the price relative to the price at average PER line . If the price is above the line, the valuation is higher than the average valuation, and vice versa if the price is lower.
The distance between the price and the average is measured in unit of standard deviation. This is represented by the third number in the status line. Value zero indicates the price is exactly at the average PER line. Positive value indicates price is higher than average, and negative if price is lower than average. Usually people use value +2 and -2 to indicate extreme positions.
The second way to use the line is to see how the line jumps up or down at the earning report date . If the line jumps up, this indicates the increase of EPSTTM. And vice versa when the line jumps down.
When EPSTTM is trending up over several quarters, or if EPSTTM is expected to go up, usually the price is also trending up and the valuation is over the average. And vice versa when EPSTTM is trending down or expected to go down. Deviation from this pattern may present some buying or selling opportunity.
B. THE FINANCIAL TABLE
The second visual part is the financial table. The financial table contains financial information at the last bar . It has four sections:
1. Revenue
2. Income
3. Valuations
4. Ratios
Let's discuss them in detail.
1. Revenue and income sections
The revenue and income table are organized into rows and columns.
Each row shows the data at the specified time frame, as follows:
The first four rows shows quarterly revenue/income of the last four quarters.
Then followed by TTM data.
Then followed by forecast of next quarter revenue/income, if such forecast exists. Note the "(F)" notation next to the quarter name.
Then followed by forecast of TTM data of next quarter (only for income), if such forecast exists. Note the "(F)" notation next to the TTM name.
The columns of revenue and income sections show the following:
The time frame information (such as quarter name, TTM, etc.)
The revenue/income value, in billions or millions (configurable).
YoY (year on year) growth, i.e. comparing the value with the value one year earlier, if any.
QoQ (quarter on quarter) growth, i.e. comparing the value with previous quarter value, if any.
GPM/NPM (gross profit margin or net profit margin), i.e. the margin on the specified time period.
Using the Revenue and Income table
The table provides quick way to see the revenue and income trend. You can see the YoY growth as well as QoQ, if that is applicable (non seasonal stocks). You can also see how the margins change over the periods.
The values are also presented with relevant background color . Green indicates "good" value and red indicates "bad" value. The intensity represents how good/bad the value is. The limits of the good and bad values are currently hardcoded in the script.
2. Valuations section
The valuation shows current stock valuation. The section is organized in rows and columns. Each row contains one type of valuation criteria, as follows:
PER (Price Earning Ratio)
Next quarter PER forecast (marked by "(F)" notation) when available
PBV (Price to Book value)
For each valuation criteria, several values are presented as columns:
The current value of the criteria. By current, it means the value at the last bar.
The one year standard deviation position
The three years standard deviation position
3. Ratios Section
The ratios section contains the following useful financial ratios:
ROA (Return on Asset), equal to: NET_INCOME_TTM / TOTAL_ASSETS
ROE (Return on Equity), equal to: NET_INCOME_TTM / BOOK_VALUE_PER_SHARE
PEG (PER to Growth Ratio), equal to PER_TTM / (INCOME_TTM_GROWTH*100)
DER (Debt to Equity Ratio), taken from request.financial(syminfo.tickerid, "DEBT_TO_EQUITY", "FQ")
DPR (Dividend Payout Ratio), taken from request.financial(syminfo.tickerid, "DIVIDEND_PAYOUT_RATIO", "FY")
Dividend yield, equal to (DPR * (NET_INCOME_TTM / TOTAL_SHARES_OUTSTANDING)) / close
KNOWN BUGS
Currently does not handle when the financial quarter contains gap, i.e. there is missing quarter. This usually happens on newly IPO stocks.
RP - Realized Price for Bitcoin (BTC) [Logue]Realized Price (RP) - The RP is summation of the value of each BTC when it last moved divided by the total number of BTC in circulation. This gives an estimation of the average "purchase" price of BTC on the bitcoin network based on when it was last transacted. This indicator tells us if the average network participant is in a state of profit or loss. This indicator is normally used to detect BTC bottoms, but an extension can be used to detect when the bitcoin network is "highly" overvalued. Because the "strength" of the BTC tops has decreased over the cycles, a logarithmic function for the extension was created by fitting past cycles as log extension = slope * time + intercept. This indicator triggers when the BTC price is above the realized price extension. For the bottoms, the RP is shifted downwards at a default value of 80%. The slope, intercept, and RP bottom shift can all be modified in the script.
CVDD - Coin Value Days Destroyed for Bitcoin (BTC) [Logue]Cumulative Value Days Destroyed (CVDD) - The CVDD was created by Willy Woo and is the ratio of the cumulative value of Coin Days Destroyed in USD and the market age (in days). While this indicator is used to detect bottoms normally, an extension is used to allow detection of BTC tops. When the BTC price goes above the CVDD extension, BTC is generally considered to be overvalued. Because the "strength" of the BTC tops has decreased over the cycles, a logarithmic function for the extension was created by fitting past cycles as log extension = slope * time + intercept. This indicator is triggered for a top when the BTC price is above the CVDD extension. For the bottoms, the CVDD is shifted upwards at a default value of 120%. The slope, intercept, and CVDD bottom shift can all be modified in the script.