Zero Lag EMA Multi-PeriodPeriods: We define three periods—20, 40, and 60—for calculating the ZEMA.
Separate Calculations: Each ZEMA calculation uses its respective period.
Plot: Each ZEMA is plotted with a unique color to distinguish them:
Blue for Period 20
Red for Period 40
Green for Period 60
This code will display three lines on the chart, each representing a Zero Lag EMA for the specified periods.
Leadingindicator
Leading Economic Indicator (LEI)The Leading Economic Indicator (LEI) is a groundbreaking technical indicator designed to serve as a comprehensive measure of the prevailing direction of economic trends in the United States. This unique index combines two key economic indicators: the Composite Leading Indicator (CLI) from the Organization for Economic Co-operation and Development (OECD) and the Purchasing Managers' Index (PMI) from the Institute for Supply Management (ISM).
The OECD Composite Leading Indicator (CLI) is a globally recognized indicator that assesses the future direction of economic trends by analyzing various leading economic factors. The ISM PMI, on the other hand, provides insights into the business activities of both the manufacturing and services sectors. LEI merges these critical indicators into a single, holistic indicator that empowers traders and investors to grasp the broader economic outlook and the performance of essential economic sectors simultaneously.
By taking into account the CLI and PMI, LEI offers a distinctive perspective, enabling a more accurate assessment of the potential direction of US financial markets.
Usage:
To utilize LEI effectively, it is recommended to apply it on a monthly timeframe (TF Monthly). This extended timeframe is particularly beneficial for investors with a medium to long-term horizon. By focusing on longer-term trends and market stability, LEI becomes an invaluable tool in your investment strategy.
One of the primary applications of LEI is to gauge the risk of market corrections in US financial markets, including the S&P 500, Nasdaq, and Dow Jones indices. Analysts often observe the crossing of the 5-period Simple Moving Average (SMA) with the 10-period SMA. When the 5-period SMA falls below the 10-period SMA, it serves as a potential warning signal for an impending market correction. This feature provides traders with an opportunity to exercise caution and make well-informed investment decisions.
LEI, with its unique blend of the OECD CLI and ISM PMI, provides a reliable tool for assessing the US economic climate, identifying trends, and making informed decisions in the financial markets. It stands as a reference indicator, capturing the essence of economic trends and providing valuable insights to traders and investors.
Sources:
- OECD Composite Leading Indicator (CLI): www.data.oecd.org
- Purchasing Managers' Index: ISM Report on Business (PMI) www.ismworld.org
Purchasing Managers Index (PMI)The Purchasing Managers Index (PMI) is a widely recognized economic indicator that provides crucial insights into the health and performance of an economy's manufacturing and services sectors. This index is a vital tool for anticipating economic developments and trends, offering an early warning system for changes in these sectors.
The PMI is calculated based on surveys conducted among purchasing managers in various businesses and organizations. These managers are asked about their perceptions of current business conditions and their expectations for future economic activity within their sectors. The responses are then compiled and used to calculate the PMI value.
A PMI value above 50 typically indicates that the manufacturing or services sector is expanding, suggesting a positive economic outlook. Conversely, a PMI value below 50 suggests contraction, which may be an early indication of economic challenges or a potential recession.
In summary, the Purchasing Managers Index (PMI) is an essential economic indicator that assesses the health of manufacturing and services sectors by surveying purchasing managers' opinions. It serves as an early warning system for changes in economic activity and is a valuable tool for forecasting economic trends and potential crises.
This code combines the Purchasing Managers Index (PMI) data with two Simple Moving Averages (SMA) and some visual elements.
Let's break down how this indicator works:
1. Loading PMI Data:
The indicator loads data for the "USBCOI" symbol, which represents the PMI data. It fetches the monthly closing prices of this symbol.
2. Calculating Moving Averages:
Two Simple Moving Averages (SMAs) are calculated based on the PMI data. The first SMA, sma_usbcoi, has a length defined by the input parameter (default: 2). The second SMA, sma2_usbcoi, has a different length defined by the second input parameter (default: 14).
3. Color Coding and Thresholds:
The line color of the PMI plot is determined based on the value of the PMI. If the PMI is above 52, the color is teal; if it's below 48, the color is red; otherwise, it's gray. These threshold values are often used to identify specific conditions in the PMI data.
4. Crossing Indicator:
A key feature of this indicator is to determine if the PMI crosses the first SMA (sma_usbcoi) from top to bottom while also being above the value of 52. This is indicated by the crossedUp variable. This condition suggests a specific situation where the PMI crosses a short-term moving average while indicating strength (above 52).
5. Visual Elements:
A "💀" skull emoji is defined as skullEmoji.
The PMI is plotted on the chart with color coding based on its value, as described earlier.
The two SMAs are also plotted on the chart.
When the crossedUp condition is met (PMI crosses the first SMA from top to bottom while above 52), a skull emoji (indicating potential danger) is plotted at the top of the indicator window.
US Composite Leading Indicator (CLI)The US Composite Leading Indicator (CLI), normalized for the United States, closely mirrors the Conference Board "Leading Economic Index" (LEI). It offers unique insights into economic and financial dynamics.
The Composite Leading Indicator (CLI) is an economic tool designed to anticipate economic developments. It is created by aggregating and normalizing a wide range of economic and financial data from various sources.
The normalized data is then aggregated, and a composite indicator is calculated by taking a weighted average of individual indicators.
The CLI is used to provide early insights into the state of the economy and to anticipate future economic trends. It is particularly valuable for predicting economic downturns, including recessions.
The CLI is an essential tool for economists, governments, businesses, and investors seeking to understand economic trends and make informed decisions.
Key Features:
1. Early Warning: Just like its counterpart, the CLI indicator excels at offering early warnings about significant economic events, particularly economic crises. This makes it an indispensable asset for analysts and investors.
2. Recession Indicators: The moving average serves as an early warning system for potential economic recessions. When it crosses the indicator line from the bottom to the top while surpassing a predefined threshold (e.g., 101), it signals a potential crisis.
3. Market Impact: The CLI indicator provides valuable insights into the performance of financial markets, offering cues about indices such as the S&P 500, Nasdaq, Dow Jones, and more.
Why It Matters:
Understanding the US Composite Leading Indicator (CLI) indicator, normalized for the United States, is crucial for anticipating economic shifts and preparing for changes in financial markets. By analyzing a diverse array of economic factors, it provides a holistic view of economic well-being. Whether you're an investor or economist, this indicator can be an invaluable resource for staying informed about market trends and major economic developments.
Source:
www.data.oecd.org
Big 8 Intraday TICKAt the start of each trading day (0930 EST), this indicator calculates the intraday price difference between open and close for the eight largest market cap stocks (AAPL, AMZN, GOOGLE, META, MSFT, NFLX, NVDA, and TSLA), assigns a +/-1 for each, and then plots the cumulative change. An EMA has been added for smoothing purposes that is set to 5 but can be changed. Please note indicator is best used on lower timeframes (15 min or less) and has no applicability to time frames above 1 hour.
The thought behind this indicator is those eight major stocks drive a majority of intraday price change in indices like SPY and QQQ that are heavily weighted towards these stocks, therefore they should be a leading indicator in price change. You can often catch a move in SPY or QQQ one to two bars (on 1 min chart) ahead of the actual move because you see this indicator moving strong to one direction.
It's not perfect as there are divergences you will see when you compare historical charts, but oftentimes those divergences ultimately lead to significant price swings in the same direction as this indicator, so recommend being on watch to pull the trigger when you see those and price confirms.
You can use this indicator in a few ways:
1. Confirmation that your current trade is in the same direction as this indicator
2. Use the zero cross as a trigger for put or call entry
3. Focusing only on calls/longs if the value is above 0, or only puts/shorts if the value is below zero. Just be sure to keep an eye on reversals.
If you have recommendations on how to improve, let me know and I'll do my best to make changes.
Eurobond CurveABOUT
Dynamically plots 3 no. forward EUROBOND curves. When the curves converge (or worse crossover) there is higher risk of financial uncertainty and potential market correction.
The Eurobond Curves work in a similar way to treasury "yield curve inversion"; except the EUROBOND curves can signal much earlier than Treasuries therefore providing a leading indicator.
The indicator looks the the "near" (next year EUROBOND), "mid" (EUROBOND 2 years out) and "far" (EUROBOND 5 years out) to assess for crossovers.
When the "near" and "mid" curves crossover the "far" curve, concerning economic conditions are developing and it may be a good idea to reduce risk exposure to markets.
LIMITATIONS
The EUROBOND curve crossover events are rare, and this indicator uses data back to 2005 (using approximately 25 TradingView security functions). Given there are relatively few crossover events, the reliability of this indicator should be considered low. Nonetheless, there is decent alignment with treasury yield curve inversions in the 20 year period assessed. Given treasury yield curve inversions have predicted every recession for the last 70 years, we still think the EUROBOND Curves are a useful datapoint to monitor into the future and provide confluence to other risk management strategies.
Leading Indicator [TH]The leading indicator is helpful to identify early entries and exits (especially near support and resistance).
Green = trend up
Red = trend down
How it works:
The leading indicator calculates the difference between price and an exponential moving average.
Adding the difference creates a negative lag relative to the original function.
Negative lag is what makes this a leading indicator.
The amount of lead is exactly equal to the amount of lag of the moving average.
The leading indicator has lagging signals at turning points.
The leading indicator will always have noise gain, which gets eliminated by applying a moving average.
Modifying the alpha values will modify the amount of noise and change the sensitivity of trend change.
Example 1: Changing alpha1 from 0.25 to 0.15 lowers noise, more clearly identifies trend, and adds delay to this indicator.
Example 2: Changing alpha1 from 0.25 to 0.35 increases noise, less clearly identifies trend, BUT more quickly indicates a trend change.
Calculations:
Where:
alpha1 = 0.25
alpha2 = 0.33
Leading = 2 * (arithmetical mean of current High and Low price) + (alpha1 - 2) * (arithmetical mean of previous High and Low price) + (1 - alpha1) * (previous 'Leading' value)
Total Leading = alpha2 * leading + (1 - alpha2) * (previous 'Total Leading' value)
EMA = 0.5 * (arithmetical mean of previous High and Low price) + 0.5 * (previous 'EMA' value)
Uptrend when 'Total Leading' value is greator than the EMA
Downtrend when 'Total Leading' value is lesser than the EMA
Cybernetic Analysis for Stocks and Futures, by John Ehlers (page 231-235)
Detrended Ehlers Leading Indicator [CC]The Detrended Ehlers Leading Indicator was created by Bill Mars based off of Ehlers work and this is his attempt to create a leading indicator based on the previous Detrended Synthetic Price . I will be honest that this is a bit of a strange script because it is an indicator based off of the detrended synthetic price which is based off of Ehlers work so I haven't found clear buy and sell signals so I'm open to suggestions. His suggestion for buy and sell signals is to only buy and sell at the indicator crossings but haven't found buy and sell logic that I'm sure about. I have included strong buy and sell signals in addition to normal ones so strong signals are darker in color and normal signals are lighter in color. Buy when the line turns green and sell when it turns red.
Let me know if there are any other indicators or scripts you would like to see me publish!
[blackcat] L2 Ehlers Leading IndicatorLevel: 2
Background
John F. Ehlers introuced Leading Indicator in his "Cybernetic Analysis for Stocks and Futures" chapter 16 on 2004.
Function
The leading characteristic is present in the net filte.As predicted, the lead is one bar at very low frequencies. That is, the trend indication will lead by one bar. However, the net filter has a lag of approximately 2.5 bars for cycle components near 20-bar cycles. Also, higher-frequency lag settles down to be about half a bar. The interpretation of the lag response is that the filter predicts a continuation of a trend by 1 bar, lags abrupt changes by about 0.5 bars, and lags smooth changes that can be fitted by segments of a 20-bar sinewave by as much as 2.5 bars. That’s the law of physics—you cannot get something for nothing. Causal filters can have a predictive capability over some portion of the frequency response, but not at all frequencies. There is no magic predictor.
Key Signal
NetLead ---> Leading Indicator fast line
EMA ---> Leading Indicator slow line
Pros and Cons
100% John F. Ehlers definition translation of original work, even variable names are the same. This help readers who would like to use pine to read his book. If you had read his works, then you will be quite familiar with my code style.
Remarks
The 35th script for Blackcat1402 John F. Ehlers Week publication.
Readme
In real life, I am a prolific inventor. I have successfully applied for more than 60 international and regional patents in the past 12 years. But in the past two years or so, I have tried to transfer my creativity to the development of trading strategies. Tradingview is the ideal platform for me. I am selecting and contributing some of the hundreds of scripts to publish in Tradingview community. Welcome everyone to interact with me to discuss these interesting pine scripts.
The scripts posted are categorized into 5 levels according to my efforts or manhours put into these works.
Level 1 : interesting script snippets or distinctive improvement from classic indicators or strategy. Level 1 scripts can usually appear in more complex indicators as a function module or element.
Level 2 : composite indicator/strategy. By selecting or combining several independent or dependent functions or sub indicators in proper way, the composite script exhibits a resonance phenomenon which can filter out noise or fake trading signal to enhance trading confidence level.
Level 3 : comprehensive indicator/strategy. They are simple trading systems based on my strategies. They are commonly containing several or all of entry signal, close signal, stop loss, take profit, re-entry, risk management, and position sizing techniques. Even some interesting fundamental and mass psychological aspects are incorporated.
Level 4 : script snippets or functions that do not disclose source code. Interesting element that can reveal market laws and work as raw material for indicators and strategies. If you find Level 1~2 scripts are helpful, Level 4 is a private version that took me far more efforts to develop.
Level 5 : indicator/strategy that do not disclose source code. private version of Level 3 script with my accumulated script processing skills or a large number of custom functions. I had a private function library built in past two years. Level 5 scripts use many of them to achieve private trading strategy.
Ehlers Predictive Moving Average [CC]The Predictive Moving Average was created by John Ehlers (Rocket Science For Traders pg 212) and this is one of his first leading indicators. I have been asked by many people for more leading indicators so this one is for you all! Buy when the indicator line is green and sell when it is red.
Let me know if there are other indicators you would like to see me publish or if you want something custom done!
Ehlers Leading Indicator [CC]The Leading Indicator was created by John Ehlers (Cybernetic Analysis For Stocks And Futures pg 235) and as the name implies, this is a leading indicator that provides super early signals. Feel free to change the alpha values to adjust to your needs. Buy when the indicator line is green and sell when it is red.
Let me know if there are other scripts you would like to see me publish or if you want something custom done!
Ehlers Hilbert Oscillator [CC]The Hilbert Oscillator was created by John Ehlers (Rocket Science For Traders pgs 90-91) and just like the sinewave indicator that I published yesterday, this is also a leading indicator. The big difference between this indicator and the sinewave is that this indicator works very well for determining major turning points in the stock before they happen. You will notice that when the blue line crosses over the red line that a few bars from that point, the stock will start an uptrend and the reverse is true. I have also included immediate buy and sell signals over the 0 line so buy when the line is green and sell when it is red
Let me know if you would like to see any other scripts from me or if you want something custom done!
Enhanced Time Segmented Volume (Multi MA)**THIS VERSION ALLOWS THE USER TO SELECT WHICH MOVING AVERAGE THEY WOULD LIKE TO UTILIZE FOR THE SIGNAL LINE**
Chart shows two different options of many. Top option is the default settings and bottom option is a different moving average with no other changes.
Time Segmented Volume was developed by Worden Brothers, Inc to be a leading indicator by comparing various time segments of both price and volume. Essentialy it is designed to measure the amount of money flowing in and out of an instrument.
Time Segmented Volume was originally ported to TradingView by user @liw0 and later corrected by user @vitelot. I never quite understood how to read Time Segmented Volume until I ran across a version by user @storma where they indicated when price would be long or short, but that code also utilized the incorrect calculation from user @liw0.
In an effort to make Time Segmented Volume more accessible and easier to read, I have re-coded it here. The calculations are based on the code from @vitelot and I have added direction indicators below the chart.
If the histogram (TSV) is greater than zero and greater than the moving average, price should be moving long and there will be a green box below the chart.
If TSV falls below the moving average while still being greater than zero, the trend may be exhausting and has been coded to read Price Action Long - FAILURE with a black x below the chart.
If the histogram (TSV) is less than zero and less than the moving average, price should be moving short and there will be a red box below the chart.
If TSV rises above the moving average while still being less than zero, the trend may be exhausting and has been coded to read Price Action Short - FAILURE with a black x below the chart.
At times, the moving average may be above zero while TSV is below zero or vice versa. In these situations the chart will indicate long or short based on whether or not TSV is greater or less than zero. It is possible a new trend may be forming as the moving average obviously lags, but also possible price is consolidating with little volume and causing TSV to oscillate close to zero.
More information regarding Time Segmented Volume can be found here: www.worden.com
Original code ported by @liw0
Corrected by @vitelot
Updated/Enhancements by @eylwithsteph with inspiration from @storma
Multiple MA Options Credits to @Fractured and @lejmer
Bits and Pieces from @AlexGrover, @Montyjus, and @Jiehonglim
As always, trade at your own risk.
Enhanced Time Segmented VolumeTime Segmented Volume was developed by Worden Brothers, Inc to be a leading indicator by comparing various time segments of both price and volume. Essentialy it is designed to measure the amount of money flowing in and out of an instrument.
Time Segmented Volume was originally ported to TradingView by user @liw0 and later corrected by user @vitelot. I never quite understood how to read Time Segmented Volume until I ran across a version by user @storma where they indicated when price would be long or short, but that code also utilized the incorrect calculation from user @liw0.
In an effort to make Time Segmented Volume more accessible and easier to read, I have re-coded it here. The calculations are based on the code from @vitelot and I have added direction indicators below the chart.
If the histogram (TSV) is greater than zero and greater than the moving average, price should be moving long and there will be a green box below the chart.
If TSV falls below the moving average while still being greater than zero, the trend may be exhausting and has been coded to read Price Action Long - FAILURE with a black x below the chart.
If the histogram (TSV) is less than zero and less than the moving average, price should be moving short and there will be a red box below the chart.
If TSV rises above the moving average while still being less than zero, the trend may be exhausting and has been coded to read Price Action Short - FAILURE with a black x below the chart.
At times, the moving average may be above zero while TSV is below zero or vice versa. In these situations the chart will indicate long or short based on whether or not TSV is greater or less than zero. It is possible a new trend may be forming as the moving average obviously lags, but also possible price is consolidating with little volume and causing TSV to oscillate close to zero.
More information regarding Time Segmented Volume can be found here: www.worden.com
Original code ported by @liw0
Corrected by @vitelot
Updated/Enhancements by @eylwithsteph with inspiration from @storma
As always, trade at your own risk.