Yearly and 12-Week Percentage Difference with EMAThe indicator "Yearly and 12-Week Percentage Difference with EMA" is designed to display the annual and 12-week difference in the percentage variability of asset prices, as well as their exponential moving averages (EMA) on the TradingView chart.
EMA Period (EMA Period): This is a configurable parameter that allows you to select a period for calculating the EMA.
Yearly % Difference (Annual percentage difference): This indicator shows the percentage difference between the current price and the asset price a year ago on weekly bars. The graph is displayed in blue.
12-Week % Difference (12 weeks difference as a percentage): This indicator shows the percentage difference between the current price and the asset price 12 weeks ago on weekly bars. The graph is displayed in green.
Zero Line (Zero Line): This black line on the chart shows the zero level.
EMA of Yearly % Difference (EMA of annual percentage difference): This line represents the exponential moving average (EMA) of the annual percentage difference. The graph is displayed in red.
EMA of 12-Week % Difference (EMA of the difference over 12 weeks as a percentage): This line represents the exponential moving average (EMA) of the difference over 12 weeks as a percentage. The graph is displayed in orange.
Use this indicator to analyze the percentage variability of asset prices on an annual and 12-week basis, as well as to track their EMA, which can help in making trading decisions.
Русская версия \\\\\
Индикатор "Разница в процентах за год и за 12 недель с EMA" предназначен для отображения цены от год к году, и за 12 недель процентной изменчивости цен актива, а также их экспоненциальных скользящих средних (EMA) на графике TradingView.
- EMA Period (Период EMA): Это настраиваемый параметр, который позволяет выбрать период для расчета EMA.
- Yearly % Difference (Годовая разница в процентах): Этот индикатор показывает процентную разницу между текущей ценой и ценой актива год назад на недельных барах. График отображается синим цветом.
- 12-Week % Difference (Разница за 12 недель в процентах): Этот индикатор показывает процентную разницу между текущей ценой и ценой актива 12 недель назад на недельных барах. График отображается зеленым цветом.
- Zero Line (Линия нуля): Эта черная линия на графике показывает нулевой уровень.
- EMA of Yearly % Difference (EMA годовой разницы в процентах): Эта линия представляет собой экспоненциальное скользящее среднее (EMA) годовой разницы в процентах. График отображается красным цветом.
- EMA of 12-Week % Difference (EMA разницы за 12 недель в процентах): Эта линия представляет собой экспоненциальное скользящее среднее (EMA) разницы за 12 недель в процентах. График отображается оранжевым цветом.
Используйте этот индикатор для анализа процентной изменчивости цен актива на годовой и 12-недельной основе, а также для отслеживания их EMA, что может помочь в принятии торговых решений.
Циклический анализ
Triple Ehlers Market StateClear trend identification is an important aspect of finding the right side to trade, another is getting the best buying/selling price on a pullback, retracement or reversal. Triple Ehlers Market State can do both.
Three is always better
Ehlers’ original formulation produces bullish, bearish and trendless signals. The indicator presented here gate stages three correlation cycles of adjustable lengths and degree thresholds, displaying a more refined view of bullish, bearish and trendless markets, in a compact and novel way.
Stick with the default settings, or experiment with the cycle period and threshold angle of each cycle, then choose whether ‘Recent trend weighting’ is included in candle colouring.
John Ehlers is a highly respected trading maths head who may need no introduction here. His idea for Market State was published in TASC June 2020 Traders Tips. The awesome interpretation of Ehlers’ work on which Triple Ehlers Market State’s correlation cycle calculations are based can be found at:
DISCLAIMER: None of this is financial advice.
PA-Adaptive Hull Parabolic [Loxx]The PA-Adaptive Hull Parabolic is not your typical trading indicator. It synthesizes the computational brilliance of two famed technicians: John Ehlers and John Hull. Let's demystify its sophistication.
█ Ehlers' Phase Accumulation
John Ehlers is well-known in the trading community for his digital signal processing approach to market data. One of his standout techniques is phase accumulation. This method identifies the dominant cycle in the market by accumulating the phases of individual cycles. By doing so, it "adapts" to real-time market conditions.
Here's the brilliance of phase accumulation in this code
The indicator doesn't merely use a static look-back period. Instead, it dynamically determines the dominant market cycle through phase accumulation.
The calcComp function, rooted in Ehlers' methodology, provides a complex computation using a digital signal processing approach to filter out market noise and pinpoint the current cycle's frequency.
By measuring and adapting to the instantaneous period of the market, it ensures that the indicator remains relevant, especially in non-stationary market conditions.
Hull's Moving Average
John Hull introduced the Hull Moving Average (HMA) aiming to reduce lag and improve smoothing. The HMA's essence lies in its weighted average computation, prioritizing more recent prices.
This code takes an adaptive twist on the HMA
Instead of a fixed period, the HMA uses the dominant cycle length derived from Ehlers' phase accumulation. This makes the HMA not just fast and smooth, but also adaptive to the dominant market rhythm.
The intricate iLwmp function in the script provides this adaptive HMA computation. It's a weighted moving average, but its length isn't static; it's based on the previously determined dominant market cycle.
█ Trading Insights
The indicator paints the bars to represent the immediate trend: green for bullish and red for bearish.
Entry points, both long ("L") and short ("S"), are presented visually. These are derived from crossovers of the adaptive HMA, a clear indication of a potential shift in the trend.
Additionally, alert conditions are set, ready to notify a trader when these crossovers occur, ensuring real-time actionable insights.
█ Conclusion
The PA-Adaptive Hull Parabolic is a masterclass in advanced technical indicator design. By marrying John Ehlers' adaptive phase accumulation with John Hull's HMA, it creates a dynamic, responsive, and precise tool for traders. It's not just about capturing the trend; it's about understanding the very rhythm of the market.
Supertrend x4 w/ Cloud FillSuperTrend is one of the most common ATR based trailing stop indicators.
The average true range (ATR) plays an important role in 'Supertrend' as the indicator uses ATR to calculate its value. The ATR indicator signals the degree of price volatility. In this version you can change the ATR calculation method from the settings. Default method is RMA, when the alternative method is SMA.
The indicator is easy to use and gives an accurate reading about an ongoing trend. It is constructed with two parameters, namely period and multiplier.
The implementation of 4 supertrends and cloud fills allows for a better overall picture of the higher and lower timeframe trend one is trading a particular security in.
The default values used while constructing a supertrend indicator is 10 for average true range or trading period.
The key aspect what differentiates this indicator is the Multiplier. The multiplier is based on how much bigger of a range you want to capture. In our case by default, it starts with 2.636 and 3.336 for Set 1 & Set 2 respectively giving a narrow band range or Short Term (ST) timeframe visual. On the other hand, the multipliers for Set 3 & Set 4 goes up to 9.736 and 8.536 for the multiplier respectively giving a large band range or Long Term (LT) timeframe visual.
A ‘Supertrend’ indicator can be used on equities, futures or forex, or even crypto markets and also on minutes, hourly, daily, and weekly charts as well, but generally, it fails in a sideways-moving market. That's why with this implementation it enables one to stay out of the market if they choose to do so when the market is ranging.
This Supertrend indicator is modelled around trends and areas of interest versus buy and sell signals. Therefore, to better understand this indicator, one must calibrate it to one's need first, which means day trader (shorter timeframe) vs swing trader (longer time frame), and then understand how it can be utilized to improve your entries, exits, risk and position sizing.
Example:
In this chart shown above using SPX500:OANDA, 15R Time Frame, we can see that there is at any give time 1 to 4 clouds/bands of Supertrends. These four are called Set 1, Set 2, Set 3 and Set 4 in the indicator. Set's 1 & 2 are considered short term, whereas Set's 3 & 4 are considered long term. The term short and long are subjective based on one's trading style. For instance, if a person is a 1min chart trader, which would be short term, to get an idea of the trend you would have to look at a longer time frame like a 5min for instance. Similarly, in this cases the timeframes = Multiplier value that you set.
Optional Ideas:
+ Apply some basic EMA/SMA indicator script of your choice for easier understanding of the trend or to allow smooth transition to using this indicator.
+ Split the chart into two vertical layouts and applying this same script coupled with xdecow's 2 WWV candle painting script on both the layouts. Now you can use the left side of the chart to show all bearish move candles only (make the bullish candles transparent) and do the opposite for the right side of the chart. This way you enhance focus to just stick to one side at a given time.
Credits:
This indicator is a derivative of the fine work done originally by KivancOzbilgic
Here is the source to his original indicator: ).
Disclaimer:
This indicator and tip is for educational and entertainment purposes only. This not does constitute to financial advice of any sort.
ATR Multiples PlottedInspired by @jeffsuntrading and @Fred6724 's ATR% multiple from 50-MA .
There are no catch-all values, however a high of 6 and a low of -4 generally has been valuable to me. I tend to look at the historical highs and lows of the indicator, and adjust the Value High and Value Low accordingly to get an idea when profit-taking may be sensible.
The essence is the difference between price and the selected moving average, measured in ATRs.
Full Moon Delta IndicatorThis unique indicator highlights the dates of full moons on your chart with vertical dotted lines. The significance of the full moon in trading and its potential influence on market behavior has been a topic of interest for many traders. With this indicator, you can easily visualize these lunar events and their potential impact on the market.
Xeeder - US Government Bonds AnalysisXeeder - US Government Bonds Analysis (USBA)
The "Xeeder - US Government Bonds Analysis" (USBA) is a comprehensive tool designed to assist traders in analyzing the spread, historical volatility, and correlation between two different U.S. Government Bonds. This indicator is crucial for understanding the relative performance and risk factors between two bond assets.
Details of the Indicator:
Bond Input Settings: This feature allows traders to select two different U.S. Government Bonds from a dropdown list. The bonds range from 1-month to 30-year maturities.
Timeframe Settings: Traders can choose the timeframe for the analysis, such as Daily, Weekly, etc.
Moving Average (MA) Settings: The indicator offers various types of moving averages like SMA, EMA, WMA, etc., for calculating the spread's moving average. Traders can also specify the length of the moving average.
Spread Calculation: The indicator calculates the spread between the selected bonds and plots it on the chart.
Historical Volatility: The indicator calculates and plots the historical volatility of the spread, which is useful for risk assessment.
Correlation Coefficient: This feature calculates the correlation between the two selected bonds over a specified period.
How to Use the Indicator:
Select Bonds: Choose two U.S. Government Bonds from the dropdown list that you are interested in analyzing.
Choose Timeframe: Select the timeframe that aligns with your trading or investment strategy.
Configure MA Settings: Adjust the type and length of the moving average according to your needs.
Analyze Plots: Observe the plotted spread, its moving average, historical volatility, and correlation coefficient to gain insights into the bonds' relative performance and risk factors.
Interpret Data: Use the plotted data to make informed decisions about bond trading or hedging strategies.
Example of Usage:
As a trader focused on swing trading and strategy development, you can use the USBA indicator to:
Select Bonds: Choose bonds that you believe will show significant spread changes based on your macroeconomic and geopolitical analysis.
Adjust Settings: Configure the MA settings to suit your trading strategy.
Analysis and Comparison: Examine the spread, historical volatility, and correlation to identify potential trading opportunities or hedging strategies.
Content Creation: Use the insights gained to write compelling articles on bond market trends, risks, and opportunities, enriching your financial journalism portfolio.
Remember, the USBA indicator is a versatile tool that provides a multi-faceted analysis of U.S. Government Bonds. Always consider your broader trading strategy and market conditions when using this tool.
Seasonal Trend by LogReturnSeasonal trend in terms of stocks refers to typical and recurring patterns in stock prices that happen at a specific time of the year. There are many theories and beliefs regarding seasonal trends in the financial markets, and some traders use these patterns to guide their investment decisions.
This indicator calculates the trend by "Daily" logarithmic returns of the past years.
So, you should use this indicator with a "Daily" mainchart.
Note: If you select more years in the past than data is available, the line turns red.
Kaschko's Seasonal TrendThis script calculates the average price moves (using each bar's close minus the previous bar's close) for the trading days, weeks or months (depending on the timeframe it is applied to) of a number of past calendar years (up to 30) to construct a seasonal trend which is then drawn as a seasonal chart (overlay) onto the price chart. Supported are the 1D,1W,1M timeframes.
The seasonal chart is adjusted to the price chart (so that both occupy the same height on the overall chart) and it is also de-trended, which means that the seasonal chart's starting value is the same in each year and the progression during the year is adjusted so that no abrupt gap occurs between years and the highs and lows of consecutive years of the seasonal chart (if projected over more than one year) are also at the same level. Of course, this also means that the absolute value of the seasonal chart has no meaning at all.
You can configure the number of bars the seasonal chart is drawn into the future. This projection shows how price could move in the future if the market shows the same seasonal tendencies like in the past. On the daily chart, the trading week of year (TWOY), trading day of month (TDOM) and trading day of year (TDOY) are shown in the status line.
Caution is advised as seasonality is based on the past. It is not a reliable prediction of the future. But it can still be used as an additional confirmation or contradiction of an otherwise recognized possible impending trend.
I have used a virtually identical indicator for a long time in a commercial software package popular among futures traders, but have not found anything comparable here. Therefore I implemented it myself. I hope you find it useful.
Abz US Real ratesThis indicator shows Fed Funds Rate vs US inflation. It also shows the US 10 year bond yield and provides a color indication that aims to indicate if this is a period where owning TLT is a good idea or not. It is not investment advice and it is only aiming to indicate whether the trend is supportive or not for long dated US bonds in comparison with short dated treasury bills and versus inflation.
Recessions: Recessions are indicated by a grey background.
Yield inversion: Periods where the Fed Funds Rate is above the US 10 year bond yield are shown as a maroon background and frequently are macro indicators of an upcoming recession. Like other macro signals, this can't be relied upon as a timing tool.
This is intended to be used as an indictor on a long term chart. Minimum would be weekly but could be even more valid to focus on a chart with monthly candles.
[Excalibur] Ehlers AutoCorrelation Periodogram ModifiedKeep your coins folks, I don't need them, don't want them. If you wish be generous, I do hope that charitable peoples worldwide with surplus food stocks may consider stocking local food banks before stuffing monetary bank vaults, for the crusade of remedying the needs of less than fortunate children, parents, elderly, homeless veterans, and everyone else who deserves nutritional sustenance for the soul.
DEDICATION:
This script is dedicated to the memory of Nikolai Dmitriyevich Kondratiev (Никола́й Дми́триевич Кондра́тьев) as tribute for being a pioneering economist and statistician, paving the way for modern econometrics by advocation of rigorous and empirical methodologies. One of his most substantial contributions to the study of business cycle theory include a revolutionary hypothesis recognizing the existence of dynamic cycle-like phenomenon inherent to economies that are characterized by distinct phases of expansion, stagnation, recession and recovery, what we now know as "Kondratiev Waves" (K-waves). Kondratiev was one of the first economists to recognize the vital significance of applying quantitative analysis on empirical data to evaluate economic dynamics by means of statistical methods. His understanding was that conceptual models alone were insufficient to adequately interpret real-world economic conditions, and that sophisticated analysis was necessary to better comprehend the nature of trending/cycling economic behaviors. Additionally, he recognized prosperous economic cycles were predominantly driven by a combination of technological innovations and infrastructure investments that resulted in profound implications for economic growth and development.
I will mention this... nation's economies MUST be supported and defended to continuously evolve incrementally in order to flourish in perpetuity OR suffer through eras with lasting ramifications of societal stagnation and implosion.
Analogous to the realm of economics, aperiodic cycles/frequencies, both enduring and ephemeral, do exist in all facets of life, every second of every day. To name a few that any blind man can naturally see are: heartbeat (cardiac cycles), respiration rates, circadian rhythms of sleep, powerful magnetic solar cycles, seasonal cycles, lunar cycles, weather patterns, vegetative growth cycles, and ocean waves. Do not pretend for one second that these basic aforementioned examples do not affect business cycle fluctuations in minuscule and monumental ways hour to hour, day to day, season to season, year to year, and decade to decade in every nation on the planet. Kondratiev's original seminal theories in macroeconomics from nearly a century ago have proven remarkably prescient with many of his antiquated elementary observations/notions/hypotheses in macroeconomics being scholastically studied and topically researched further. Therefore, I am compelled to honor and recognize his statistical insight and foresight.
If only.. Kondratiev could hold a pocket sized computer in the cup of both hands bearing the TradingView logo and platform services, I truly believe he would be amazed in marvelous delight with a GARGANTUAN smile on his face.
INTRODUCTION:
Firstly, this is NOT technically speaking an indicator like most others. I would describe it as an advanced cycle period detector to obtain market data spectral estimates with low latency and moderate frequency resolution. Developers can take advantage of this detector by creating scripts that utilize a "Dominant Cycle Source" input to adaptively govern algorithms. Be forewarned, I would only recommend this for advanced developers, not novice code dabbling. Although, there is some Pine wizardry introduced here for novice Pine enthusiasts to witness and learn from. AI did describe the code into one super-crunched sentence as, "a rare feat of exceptionally formatted code masterfully balancing visual clarity, precision, and complexity to provide immense educational value for both programming newcomers and expert Pine coders alike."
Understand all of the above aforementioned? Buckle up and proceed for a lengthy read of verbose complexity...
This is my enhanced and heavily modified version of autocorrelation periodogram (ACP) for Pine Script v5.0. It was originally devised by the mathemagician John Ehlers for detecting dominant cycles (frequencies) in an asset's price action. I have been sitting on code similar to this for a long time, but I decided to unleash the advanced code with my fashion. Originally Ehlers released this with multiple versions, one in a 2016 TASC article and the other in his last published 2013 book "Cycle Analytics for Traders", chapter 8. He wasn't joking about "concepts of advanced technical trading" and ACP is nowhere near to his most intimidating and ingenious calculations in code. I will say the book goes into many finer details about the original periodogram, so if you wish to delve into even more elaborate info regarding Ehlers' original ACP form AND how you may adapt algorithms, you'll have to obtain one. Note to reader, comparing Ehlers' original code to my chimeric code embracing the "Power of Pine", you will notice they have little resemblance.
What you see is a new species of autocorrelation periodogram combining Ehlers' innovation with my fascinations of what ACP could be in a Pine package. One other intention of this script's code is to pay homage to Ehlers' lifelong works. Like Kondratiev, Ehlers is also a hardcore cycle enthusiast. I intend to carry on the fire Ehlers envisioned and I believe that is literally displayed here as a pleasant "fiery" example endowed with Pine. With that said, I tried to make the code as computationally efficient as possible, without going into dozens of more crazy lines of code to speed things up even more. There's also a few creative modifications I made by making alterations to the originating formulas that I felt were improvements, one of them being lag reduction. By recently questioning every single thing I thought I knew about ACP, combined with the accumulation of my current knowledge base, this is the innovative revision I came up with. I could have improved it more but decided not to mind thrash too many TV members, maybe later...
I am now confident Pine should have adequate overhead left over to attach various indicators to the dominant cycle via input.source(). TV, I apologize in advance if in the future a server cluster combusts into a raging inferno... Coders, be fully prepared to build entire algorithms from pure raw code, because not all of the built-in Pine functions fully support dynamic periods (e.g. length=ANYTHING). Many of them do, as this was requested and granted a while ago, but some functions are just inherently finicky due to implementation combinations and MUST be emulated via raw code. I would imagine some comprehensive library or numerous authored scripts have portions of raw code for Pine built-ins some where on TV if you look diligently enough.
Notice: Unfortunately, I will not provide any integration support into member's projects at all. I have my own projects that require way too much of my day already. While I was refactoring my life (forgoing many other "important" endeavors) in the early half of 2023, I primarily focused on this code over and over in my surplus time. During that same time I was working on other innovations that are far above and beyond what this code is. I hope you understand.
The best way programmatically may be to incorporate this code into your private Pine project directly, after brutal testing of course, but that may be too challenging for many in early development. Being able to see the periodogram is also beneficial, so input sourcing may be the "better" avenue to tether portions of the dominant cycle to algorithms. Unique indication being able to utilize the dominantCycle may be advantageous when tethering this script to those algorithms. The easiest way is to manually set your indicators to what ACP recognizes as the dominant cycle, but that's actually not considered dynamic real time adaption of an indicator. Different indicators may need a proportion of the dominantCycle, say half it's value, while others may need the full value of it. That's up to you to figure that out in practice. Sourcing one or more custom indicators dynamically to one detector's dominantCycle may require code like this: `int sourceDC = int(math.max(6, math.min(49, input.source(close, "Dominant Cycle Source"))))`. Keep in mind, some algos can use a float, while algos with a for loop require an integer.
I have witnessed a few attempts by talented TV members for a Pine based autocorrelation periodogram, but not in this caliber. Trust me, coding ACP is no ordinary task to accomplish in Pine and modifying it blessed with applicable improvements is even more challenging. For over 4 years, I have been slowly improving this code here and there randomly. It is beautiful just like a real flame, but... this one can still burn you! My mind was fried to charcoal black a few times wrestling with it in the distant past. My very first attempt at translating ACP was a month long endeavor because PSv3 simply didn't have arrays back then. Anyways, this is ACP with a newer engine, I hope you enjoy it. Any TV subscriber can utilize this code as they please. If you are capable of sufficiently using it properly, please use it wisely with intended good will. That is all I beg of you.
Lastly, you now see how I have rasterized my Pine with Ehlers' swami-like tech. Yep, this whole time I have been using hline() since PSv3, not plot(). Evidently, plot() still has a deficiency limited to only 32 plots when it comes to creating intense eye candy indicators, the last I checked. The use of hline() is the optimal choice for rasterizing Ehlers styled heatmaps. This does only contain two color schemes of the many I have formerly created, but that's all that is essentially needed for this gizmo. Anything else is generally for a spectacle or seeing how brutal Pine can be color treated. The real hurdle is being able to manipulate colors dynamically with Merlin like capabilities from multiple algo results. That's the true challenging part of these heatmap contraptions to obtain multi-colored "predator vision" level indication. You now have basic hline() food for thought empowerment to wield as you can imaginatively dream in Pine projects.
PERIODOGRAM UTILITY IN REAL WORLD SCENARIOS:
This code is a testament to the abilities that have yet to be fully realized with indication advancements. Periodograms, spectrograms, and heatmaps are a powerful tool with real-world applications in various fields such as financial markets, electrical engineering, astronomy, seismology, and neuro/medical applications. For instance, among these diverse fields, it may help traders and investors identify market cycles/periodicities in financial markets, support engineers in optimizing electrical or acoustic systems, aid astronomers in understanding celestial object attributes, assist seismologists with predicting earthquake risks, help medical researchers with neurological disorder identification, and detection of asymptomatic cardiovascular clotting in the vaxxed via full body thermography. In either field of study, technologies in likeness to periodograms may very well provide us with a better sliver of analysis beyond what was ever formerly invented. Periodograms can identify dominant cycles and frequency components in data, which may provide valuable insights and possibly provide better-informed decisions. By utilizing periodograms within aspects of market analytics, individuals and organizations can potentially refrain from making blinded decisions and leverage data-driven insights instead.
PERIODOGRAM INTERPRETATION:
The periodogram renders the power spectrum of a signal, with the y-axis representing the periodicity (frequencies/wavelengths) and the x-axis representing time. The y-axis is divided into periods, with each elevation representing a period. In this periodogram, the y-axis ranges from 6 at the very bottom to 49 at the top, with intermediate values in between, all indicating the power of the corresponding frequency component by color. The higher the position occurs on the y-axis, the longer the period or lower the frequency. The x-axis of the periodogram represents time and is divided into equal intervals, with each vertical column on the axis corresponding to the time interval when the signal was measured. The most recent values/colors are on the right side.
The intensity of the colors on the periodogram indicate the power level of the corresponding frequency or period. The fire color scheme is distinctly like the heat intensity from any casual flame witnessed in a small fire from a lighter, match, or camp fire. The most intense power would be indicated by the brightest of yellow, while the lowest power would be indicated by the darkest shade of red or just black. By analyzing the pattern of colors across different periods, one may gain insights into the dominant frequency components of the signal and visually identify recurring cycles/patterns of periodicity.
SETTINGS CONFIGURATIONS BRIEFLY EXPLAINED:
Source Options: These settings allow you to choose the data source for the analysis. Using the `Source` selection, you may tether to additional data streams (e.g. close, hlcc4, hl2), which also may include samples from any other indicator. For example, this could be my "Chirped Sine Wave Generator" script found in my member profile. By using the `SineWave` selection, you may analyze a theoretical sinusoidal wave with a user-defined period, something already incorporated into the code. The `SineWave` will be displayed over top of the periodogram.
Roofing Filter Options: These inputs control the range of the passband for ACP to analyze. Ehlers had two versions of his highpass filters for his releases, so I included an option for you to see the obvious difference when performing a comparison of both. You may choose between 1st and 2nd order high-pass filters.
Spectral Controls: These settings control the core functionality of the spectral analysis results. You can adjust the autocorrelation lag, adjust the level of smoothing for Fourier coefficients, and control the contrast/behavior of the heatmap displaying the power spectra. I provided two color schemes by checking or unchecking a checkbox.
Dominant Cycle Options: These settings allow you to customize the various types of dominant cycle values. You can choose between floating-point and integer values, and select the rounding method used to derive the final dominantCycle values. Also, you may control the level of smoothing applied to the dominant cycle values.
DOMINANT CYCLE VALUE SELECTIONS:
External to the acs() function, the code takes a dominant cycle value returned from acs() and changes its numeric form based on a specified type and form chosen within the indicator settings. The dominant cycle value can be represented as an integer or a decimal number, depending on the attached algorithm's requirements. For example, FIR filters will require an integer while many IIR filters can use a float. The float forms can be either rounded, smoothed, or floored. If the resulting value is desired to be an integer, it can be rounded up/down or just be in an integer form, depending on how your algorithm may utilize it.
AUTOCORRELATION SPECTRUM FUNCTION BASICALLY EXPLAINED:
In the beginning of the acs() code, the population of caches for precalculated angular frequency factors and smoothing coefficients occur. By precalculating these factors/coefs only once and then storing them in an array, the indicator can save time and computational resources when performing subsequent calculations that require them later.
In the following code block, the "Calculate AutoCorrelations" is calculated for each period within the passband width. The calculation involves numerous summations of values extracted from the roofing filter. Finally, a correlation values array is populated with the resulting values, which are normalized correlation coefficients.
Moving on to the next block of code, labeled "Decompose Fourier Components", Fourier decomposition is performed on the autocorrelation coefficients. It iterates this time through the applicable period range of 6 to 49, calculating the real and imaginary parts of the Fourier components. Frequencies 6 to 49 are the primary focus of interest for this periodogram. Using the precalculated angular frequency factors, the resulting real and imaginary parts are then utilized to calculate the spectral Fourier components, which are stored in an array for later use.
The next section of code smooths the noise ridden Fourier components between the periods of 6 and 49 with a selected filter. This species also employs numerous SuperSmoothers to condition noisy Fourier components. One of the big differences is Ehlers' versions used basic EMAs in this section of code. I decided to add SuperSmoothers.
The final sections of the acs() code determines the peak power component for normalization and then computes the dominant cycle period from the smoothed Fourier components. It first identifies a single spectral component with the highest power value and then assigns it as the peak power. Next, it normalizes the spectral components using the peak power value as a denominator. It then calculates the average dominant cycle period from the normalized spectral components using Ehlers' "Center of Gravity" calculation. Finally, the function returns the dominant cycle period along with the normalized spectral components for later external use to plot the periodogram.
POST SCRIPT:
Concluding, I have to acknowledge a newly found analyst for assistance that I couldn't receive from anywhere else. For one, Claude doesn't know much about Pine, is unfortunately color blind, and can't even see the Pine reference, but it was able to intuitively shred my code with laser precise realizations. Not only that, formulating and reformulating my description needed crucial finesse applied to it, and I couldn't have provided what you have read here without that artificial insight. Finding the right order of words to convey the complexity of ACP and the elaborate accompanying content was a daunting task. No code in my life has ever absorbed so much time and hard fricking work, than what you witness here, an ACP gem cut pristinely. I'm unveiling my version of ACP for an empowering cause, in the hopes a future global army of code wielders will tether it to highly functional computational contraptions they might possess. Here is ACP fully blessed poetically with the "Power of Pine" in sublime code. ENJOY!
7 consecutive closes above/below the 5-periodThis script looks for 7 consecutive closes above/below the 5-period SMA. The indicator is inspired by legendary trader Linda Raschke's work.
First are the two models for which the indicator was created, both inspired by Raschke:
1) Persistency of trend / Extended run setup.
Around 10-12 times per year we get a persistency of trend in instruments in general.
After 7 consecutive closes above/below the 5-period as price pulls back we can look to enter in the direction of the main trend as it moves up/down above/below 5 ma again. You should use price action trading to pinpoint the entries. Now try to hold this as long as possible. Way longer than you can percieve or think is possible. Up to 24-28 periods is what we are looking for in these cases.
2) Normal usage.
When the trend is not persistent, it is possible to use this as an oscillating signal, for a shorter term trade, where we can look for a short or long term reversal setup in price action.
3) I also use it at as a learning to see the swing trades clearer. You can also use it as a visual aid for developing new variances of the classic swing trading setup.
Read and listen to Linda Raschkes work to learn more.
US Presidential ElectionsThis script can be useful in case of analyzing the impact of US presidential election on the past market.
It has separated settings for showing Inauguration and Election labels.
Cycles: 4x dual inputs: Swing / Time Cycles projected forward//Purpose/Premise:
To project forward vertical 'cycle' lines based on user-input anchor points, and to search for confluence.
The idea being that if several well-anchored cycles agree (i.e. we see multiple bunched vertical line confluence in the future), then this may add support to an already existing trade idea, or may indicate an increased likelihood of a shift in direction.
//Usage & notes:
~In the above chart I've anchored to obvious swing lows and swing highs in Btc/Usd from 2020-2022. You could also use fixed time-based cycles from a favored start anchor point. Bars per cycle are printed at the top of each cycle box if your're interested in time cycles. I.e. for 1, 2, 3 month cycles: for BTC you could use 30, 60, 90 bars on daily; for S&P you could use 20, 40, 60 bars on daily.
~On first loading the indicator you will be asked select 'start date', and 'end date' for each of 4 sessions (8x clicks on chart). After this you can easily reset points by clicking the indicator display line three dots>> reset points. Or you can simply drag the vertical box edges (purple lines) to change your cycle anchor points.
~Be sure the start anchor point is before the end anchor point or box/lines won't appear.
~When you drop down to low timeframes you might get bar_index error due to history available: you need then to click the three dots on indicator display line >> reset points >> 8x clicks on the chart.
~Vertical projected lines will match the color of the cycle box they origninate from.
~Lines will project into the future as far as is allowed by tradingview (500 bars max)
//Inputs:
~Time start and end dates for each cycle (change these as described above, or input manually)
~Show/hide each cycle (default is show all 4)
~Formatting options: color of forward projected lines, line width, line style, line / box / text color.
~Box transparancy: Set to 100 to make boxes invisible & declutter the chart. Set to 0 for maximum opacity. Default is 80.
thanks to @Sathyamurthie for his ideas on cycle confluence which caused me to write this.
AMDX Time ZoneThis script is base on the theory of @traderdaye, on the TimeZone AMDX
Accumulation
Manipulation
Distribution
X reversal / continuation
OR
AMDX
It show you the box on intraday Timeframe:
Q1: 18.00 - 19.30 | Q2: 19.30 - 21.00 | Q3: 21.00 - 22.30 | Q4: 22.30 - 00.00 (90min Cycles of the Asian Session)
Q1: 00.00 - 01.30 | Q2: 01.30 - 03.00 | Q3: 03.00 - 04.30 | Q4: 04.30 - 06.00 (90min Cycles of the London Session)
Q1: 06.00 - 07.30 | Q2: 07.30 - 09.00 | Q3: 09.00 - 10.30 | Q4: 10.30 - 12.00 (90min Cycles of the NY Session)
Q1: 12.00 - 13.30 | Q2: 13.30 - 15.00 | Q3: 15.00 - 16.30 | Q4: 16.30 - 18.00 (90min Cycles of the PM Session)
You can extend this theory to the day => to the week => to the month
Thanks LuxAlgo for the base,
Hope you enjoy it
LIT - TimingIntroduction
This Script displays the Asia Session Range, the London Open Inducement Window, the NY Open Inducement Window, the Previous Week's high and low, the Previous Day's highs and lows, and the Day Open price in the cleanest way possible.
Description
The Indicator is based on UTC -7 timing but displays the Session Boxes automatically correct at your chart so you do not have to adjust any timings based on your Time Zone and don't have to do any calculations based on your UTC. It is already perfect.
You will see on default settings the purple Asia Box and 2 grey boxes, the first one is for the London Open Inducement Window (1 hour) and the second grey box is for the NY Open Inducement Window (also 1 hour)
Asia Range comes with default settings with the Asia Range high, low, and midline, you can remove these 3 lines in the settings "style" and untick the "Lines" box, that way you only will have the boxes displayed.
Special Feature
Most Timing-based Indicators have "bugged" boxes or don't show clean boxes at all and don't adjust at daylight savings times, we made sure that everything automatically gets adjusted so you don't have to! So the timings will always display at the correct time regarding the daylight savings times.
Combining Timing with Liquidity Zones the right way and in a clear, clean, and simple format.
Different than others this script also shows the "true" Asia range as it respects the "day open gap" which affects the Asia range in other scripts and it also covers the full 8 hours of Asia Session.
Additions
You can add in the settings menu the last week's high and low, the previous day's high and low, and also the day's open price by ticking the boxes in the settings menu
All colors of the boxes are fully adjustable and customizable for your personal preferences. Same for the previous weeks and day highs and lows. Just go to "Style" and you can adjust the Line types or colors to your preferred choice.
Recommended Use
The most beautiful display is on the M5 Timeframe as you have a clear overview of all sessions without losing the intraday view. You can also use it on the M1 for more details or the M15 for the bigger picture. The Template can hide on higher time frames starting from the H1 to not flood your chart with boxes.
How to use the Asia Session Range Box
Use the Asia Range Box as your intraday Guide, keep in mind that a Breakout of Asia high or low induces Liquidity and a common price behavior is a reversal after the fake breakout of that range.
How to use the London Open and NY Open Inducement Windows
Both grey boxes highlight the Open of either London Open or NY Open and you should keep an eye out for potential Liquditiy Graps or Mitigations during that times as this is when they introduce major Liquidity for the regarding Session.
How to use the Asia high, low and midline and day open price
After Asia Range got taken out in one direction, often price comes back to those levels to mitigate or bounce off, so you can imagine those zones as support and resistance on some occasions, recommended in combination with Imbalances.
How to use the previous day and week's highs and lows
Once added in the settings, you can display those price levels, you can use them either as Liquidity Targets or as Inducement Levels once they are taken out.
Enjoy!
Bitcoin Market Cap wave model weeklyThis Bitcoin Market Cap wave model indicator is rooted in the foundation of my previously developed tool, the : Bitcoin wave model
To derive the Total Market Cap from the Bitcoin wave price model, I employed a straightforward estimation for the Total Market Supply (TMS). This estimation relies on the formula:
TMS <= (1 - 2^(-h)) for any h.This equation holds true for any value of h, which will be elaborated upon shortly. It is important to note that this inequality becomes the equality at the dates of halvings, diverging only slightly during other periods.
Bitcoin wave model is based on the logarithmic regression model and the sinusoidal waves, induced by the halving events.
This chart presents the outcome of an in-depth analysis of the complete set of Bitcoin price data available from October 2009 to August 2023.
The central concept is that the logarithm of the Bitcoin price closely adheres to the logarithmic regression model. If we plot the logarithm of the price against the logarithm of time, it forms a nearly straight line.
The parameters of this model are provided in the script as follows: log(BTCUSD) = 1.48 + 5.44log(h).
The secondary concept involves employing the inherent time unit of Bitcoin instead of days:
'h' denotes a slightly adjusted time measurement intrinsic to the Bitcoin blockchain. It can be approximated as (days since the genesis block) * 0.0007. Precisely, 'h' is defined as follows: h = 0 at the genesis block, h = 1 at the first halving block, and so forth. In general, h = block height / 210,000.
Adjustments are made to account for variations in block creation time.
The third concept revolves around investigating halving waves triggered by supply shock events resulting from the halvings. These halvings occur at regular intervals in Bitcoin's native time 'h'. All halvings transpire when 'h' is an integer. These events induce waves with intervals denoted as h = 1.
Consequently, we can model these waves using a sin(2pih - a) function. The parameter determining the time shift is assessed as 'a = 0.4', aligning with earlier expectations for halving events and their subsequent outcomes.
The fourth concept introduces the notion that the waves gradually diminish in amplitude over the progression of "time h," diminishing at a rate of 0.7^h.
Lastly, we can create bands around the modeled sinusoidal waves. The upper band is derived by multiplying the sine wave by a factor of 3.1*(1-0.16)^h, while the lower band is obtained by dividing the sine wave by the same factor, 3.1*(1-0.16)^h.
The current bandwidth is 2.5x. That means that the upper band is 2.5 times the lower band. These bands are forming an exceptionally narrow predictive channel for Bitcoin. Consequently, a highly accurate estimation of the peak of the next cycle can be derived.
The prediction indicates that the zenith past the fourth halving, expected around the summer of 2025, could result in Total Bitcoin Market Cap ranging between 4B and 5B USD.
The projections to the future works well only for weekly timeframe.
Enjoy the mathematical insights!
Bitcoin wave modelBitcoin wave model is based on the logarithmic regression model and the sinusoidal waves, induced by the halving events.
This chart presents the outcome of an in-depth analysis of the complete set of Bitcoin price data available from October 2009 to August 2023.
The central concept is that the logarithm of the Bitcoin price closely adheres to the logarithmic regression model. If we plot the logarithm of the price against the logarithm of time, it forms a nearly straight line.
The parameters of this model are provided in the script as follows: log (BTCUSD) = 1.48 + 5.44log(h).
The secondary concept involves employing the inherent time unit of Bitcoin instead of days:
'h' denotes a slightly adjusted time measurement intrinsic to the Bitcoin blockchain. It can be approximated as (days since the genesis block) * 0.0007. Precisely, 'h' is defined as follows: h = 0 at the genesis block, h = 1 at the first halving block, and so forth. In general, h = block height / 210,000.
Adjustments are made to account for variations in block creation time.
The third concept revolves around investigating halving waves triggered by supply shock events resulting from the halvings. These halvings occur at regular intervals in Bitcoin's native time 'h'. All halvings transpire when 'h' is an integer. These events induce waves with intervals denoted as h = 1.
Consequently, we can model these waves using a sin(2pih - a) function. The parameter determining the time shift is assessed as 'a = 0.4', aligning with earlier expectations for halving events and their subsequent outcomes.
The fourth concept introduces the notion that the waves gradually diminish in amplitude over the progression of "time h," diminishing at a rate of 0.7^h.
Lastly, we can create bands around the modeled sinusoidal waves. The upper band is derived by multiplying the sine wave by a factor of 3.1*(1-0.16)^h, while the lower band is obtained by dividing the sine wave by the same factor, 3.1*(1-0.16)^h.
The current bandwidth is 2.5x. That means that the upper band is 2.5 times the lower band. These bands are forming an exceptionally narrow predictive channel for Bitcoin. Consequently, a highly accurate estimation of the peak of the next cycle can be derived.
The prediction indicates that the zenith past the fourth halving, expected around the summer of 2025, could result in prices ranging between 200,000 and 240,000 USD.
Enjoy the mathematical insights!
Personal Trading Hours (timezone Europe/Amsterdam)This Personal Trading Hours indicator is intended to specify the times you can trade and make them visible on the chart. Multiple sessions can be specified per specific day of the week and you can give each day its own color if you want.
This can be used perfectly if you are backtesting your strategy manually. You can indicate exactly when you have time to look at the charts and therefore only perform your backtest at those times. Making mistakes that you open en close trades during your sleeptime or worktime in your backtest are gone.
But this indicator is also suitable for live trading.
Filter out the times when you don't want to trade, for example during lunchtime, during opening hours of the exchanges or when you know that big news events will take place during your tradingweek. All the timesessions you do want to trade you can make visible on you chart.
The timezone that is used for this indicator is the timezone: Europe/Amsterdam and therefor only usable for traders in this timezone.
You can use this indicator for timeframes lower then the Daily timeframe with the normal settings. If you want to use this indicator on the Daily timeframe, all the settings in the upper part of the settingsmenu must be unchecked and only the part at the bottom of the settingsmenu can then be used.
This indicator doesn't work on timeframes higher than the Daily timeframe.
If you do not use all the tradingsessions on each day, you have to make sure that all the boxes are filled. So unused session boxes must have the same timeperiodes as the used boxes, otherwise the whole day will be highlighted on the chart.
Hybrid EMA AlgoLearner⭕️Innovative trading indicator that utilizes a k-NN-inspired algorithmic approach alongside traditional Exponential Moving Averages (EMAs) for more nuanced analysis. While the algorithm doesn't actually employ machine learning techniques, it mimics the logic of the k-Nearest Neighbors (k-NN) methodology. The script takes into account the closest 'k' distances between a short-term and long-term EMA to create a weighted short-term EMA. This combination of rule-based logic and EMA technicals offers traders a more sophisticated tool for market analysis.
⭕️Foundational EMAs: The script kicks off by generating a 50-period short-term EMA and a 200-period long-term EMA. These EMAs serve a dual purpose: they provide the basic trend-following capability familiar to most traders, akin to the classic EMA 50 and EMA 200, and set the stage for more intricate calculations to follow.
⭕️k-NN Integration: The indicator distinguishes itself by introducing k-NN (k-Nearest Neighbors) logic into the mix. This machine learning technique scans prior market data to find the closest 'neighbors' or distances between the two EMAs. The 'k' closest distances are then picked for further analysis, thus imbuing the indicator with an added layer of data-driven context.
⭕️Algorithmic Weighting: After the k closest distances are identified, they are utilized to compute a weighted EMA. Each of the k closest short-term EMA values is weighted by its associated distance. These weighted values are summed up and normalized by the sum of all chosen distances. The result is a weighted short-term EMA that packs more nuanced information than a simple EMA would.
ICT Clean Midnight [dR-Algo]
Are you a trader who values clean charts and precise indicators? Are you an avid follower of ICT Concepts? If so, the Midnight Marker is tailored for you. This ultra-simple, highly effective TradingView script draws a nearly transparent blue line at midnight on your chart, keeping your interface as clean as possible while delivering essential information.
Why is "ICT Clean Midnight" so Special?
Focus on Price Action: The minimalist design ensures that you can focus solely on price action, which is a core principle of ICT teachings.
Easy Back Testing: Whether you're trading live or back-testing strategies, the midnight marker helps you quickly identify key time points.
Customizable: Though designed to be subtle, the line's color and opacity can be easily customized to suit your charting needs.
This indicator embodies ICT's principle of maintaining a clutter-free, focus-driven trading environment. Perfect for both novice traders wanting to adopt ICT concepts and seasoned traders looking for minimalistic yet effective tools.
Pro Momentum CalculatorThe Pro Momentum Calculator Indicator is a tool for traders seeking to gauge market momentum and predict future price movements. It achieves this by counting consecutive candle periods above or below a chosen Simple Moving Average (SMA) and then providing a percentage-based probability for the direction of the next candle.
Here's how this principle works:
1. Counting Consecutive Periods: The indicator continuously tracks whether the closing prices of candles are either above or below the chosen SMA.
- When closing prices are above the SMA, it counts consecutive periods as "green" or indicating potential upward momentum.
- When closing prices are below the SMA, it counts consecutive periods as "red" or suggesting potential downward momentum.
2. Assessing Momentum: By monitoring these consecutive periods, the indicator assesses the strength and duration of the current market trend.
This is important information for traders looking to understand the market's behavior.
3. Predicting the Next Candle: Based on the historical data of consecutive green and red periods, the indicator calculates a percentage probability for the direction of the next candle:
- If there have been more consecutive green periods, it suggests a higher likelihood of the next candle being green (indicating a potential upward movement).
- If there have been more consecutive red periods, it suggests a higher likelihood of the next candle being red (indicating a potential downward movement).
The Pro Momentum Calculator indicator's versatility makes it suitable for a wide range of financial markets, including stocks, Forex, indices, commodities, cryptocurrencies...