Cycle
Ark Crypto HeatlineThis is the 'on chart' indicator. See also "Ark Crypto Heatband" indicator for a side-by-side BTC view, without a re-scaled line.
The crypto landscape is largely dominated by BTC and characterised by cyclical stages with varying degrees of mean reversion.
To understand what stage of the cycle we are currently experiencing, it is useful to examine to what degree the current price has extended beyond the long term average that BTC has established. This is true even when analysing other crypto assets as BTC is the dominant force in the crypto asset class.
This indicator uses the 1400 period daily SMA , which is broadly the 200 period weekly SMA. This can be configured, but historically has represented a baseline to which BTC commonly returns.
The graph plots current price in terms of multiples of this long term average. Traditionally, at multiples beyond 10, BTC is considered overextended with a higher likelihood of trending towards the mean thereafter. Colors indicate the extent of price extension.
Where the indicator is applied to non BTCUSD pairs, a smoothed conversion is applied, seeking to superimpose the BTC long period SMA onto the current chart.
The indicator specifically references BTC by default on all charts, as it is designed to use BTC as general purpose indication of where crypto as a whole currently sits. Accordingly the indicator is only to be used on crypto charts.
For best results on BTC, using BNC:BLX will give the longest historical view.
Ark Crypto HeatbandThe crypto landscape is largely dominated by BTC and characterised by cyclical stages with varying degrees of mean reversion.
To understand what stage of the cycle we are currently experiencing, it is useful to examine to what degree the current BTC price has extended beyond a long term average. This is true even when analysing other crypto assets and helpful to view side by side.
This indicator uses the 1400 period daily SMA, which is broadly the 200 period weekly SMA. This can be configured, but historically has represented a baseline to which BTC commonly returns.
The graph plots current price in terms of multiples of this long term average. Traditionally, at multiples beyond 10, BTC is considered overextended with a higher likelihood of trending towards the mean thereafter. Colors indicate the extend of price extension.
The indicator specifically references BTC by default on all charts as it is designed to use BTC as general purpose indication of where crypto as a whole currently sits. Accordingly the indicator is only to be used on crypto charts.
Cycle Swing MomentumAdaptive Ultra-Smooth Momentum indicator
The Cycle-Swing-Indicator "CSI" provides an optimized "momentum" oscillator based on the current dominant cycle by looking at the swing of the dominant cycle instead of the raw source momentum. Offering the following improvements:
Smoothness
Zero delay
Sharpness at turning points
Robust and adaptable to market conditions
Accurate deviation detection
The following common problems with standard indicators are solved by this indicator:
First, normal indicators introduce a lot of false signals due to their noisy signal line. Second, to compensate for the noise, one would normally try to add some smoothing. But this only results in adding more delay to the indicator, which makes it almost useless. Third, standard indicators require a length adjustment to derive reliable signals. However, you never know how to set the right length.
All three problems described above are solved by the developed adaptive cyclic algorithm.
The above chart shows current Bitcoin 4h data from the last days as of writing with the proposed signal reading for this indicator. The standard momentum indicator is included for comparison.
HOW TO USE
The indicator works without any parameter and can be applied to any chart and any time-frame. It will adapt automatically to the Dominant Cycle and use the dominant cycle of the source data to derive the ultra smooth momentum curve. Adaptive upper/lower bands are included and highlight areas with extreme readings. Automatic divergence detection can be turned off/on.
HOW TO READ
The indicator can be used like any oscillator. In addition, it provides adaptive high and low bands.
* Look for turns above the upper/lower bands
* Look for divergences between source and signals line
Further reading/Original source:
The indicator uses the dominant cycle to optimize signal, smoothing and cyclic memory. To get more in-depth information on the Cycle Swing Indicator, please read Chapter 10 "Cycle Swing Indicator: Trading the swing of the dominant cycle" of the book "Decoding the Hidden Market Rhythm, Part 1" available at your favorite book store.
Related ideas:
Please also check the cyclic RSI indicator which also uses cyclic information to improve the signal.
[blackcat] L2 Ehlers Dual Differential Cycle Period MeasurerLevel: 2
Background
John F. Ehlers introuced Dual Differential Cycle Period Measurer in his "Rocket Science for Traders" chapter 7. The In-phase and Quadrature components are computed with the Hilbert Transformer using procedures identical to those in the Dual Differentiator.
Function
blackcat L2 Ehlers Homodyne Discriminator Cycle Period Measurer is used to measure Dominant Cycle (DC). This is one of John Ehlers three major methods to measure DC. These components undergo a complex averaging and are smoothed in an EMA to avoid any undesired cross products in the multiplication step that follows. The period is solved directly from the smoothed Inphase and Quadrature components. The interim calculation for the denominator is performed as Value1 to ensure that the denominator will not have a zero value. The sign of Valuel is reversed relative to the theoretical equation because the differences are looking backward in time.
Key Signal
Smooth --> 4 bar WMA w/ 1 bar lag
Detrender --> The amplitude response of a minimum-length HT can be improved by adjusting the filter coefficients by
trial and error. HT does not allow DC component at zero frequency for transformation. So, Detrender is used to remove DC component/ trend component.
Q1 --> Quadrature phase signal
I1 --> In-phase signal
Period --> Dominant Cycle in bars
SmoothPeriod --> Period with complex averaging
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 4th 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.
[blackcat] L2 Ehlers Phase Accumulator Cycle Period MeasurerLevel: 2
Background
John F. Ehlers introuced Phase Accumulation technique of cycle period measurement in his "Rocket Science for Traders" chapter 7. It is perhaps the easiest to comprehend. In this technique, John Ehlers measures the phase at each sample by taking the arctangent of the ratio of the Quadrature component to the In-phase component. A delta phase is generated by taking the difference of the phase between successive samples. At each sample Dr. Ehlers then looks backward, adding up the delta phases. When the sum of the delta phases reaches 360 degrees (2*pi in tradingview), we must have passed through one full cycle, on average. The process is repeated for each new sample.
Function
blackcat L2 Ehlers Phase Accumulator Cycle Period Measurer is used to measure Dominant Cycle (DC). This is one of John Ehlers three major methods to measure DC. The Phase Accumulation method of cycle measurement always uses one full cycle’s worth of historical data. This is both an advantage and disadvantage. The advantage is the lag in obtaining the answer scales directly with the cycle period. That is, the measurement of a short cycle period has less lag than the measurement of a longer cycle period. However, the number of samples used in making the measurement means the averaging period is variable with cycle period. Longer averaging reduces the noise level compared to the signal. Therefore, shorter cycle periods necessarily have a higher output Signal-to-Noise Ratio (SNR).
Key Signal
Smooth --> 4 bar WMA w/ 1 bar lag
Detrender --> The amplitude response of a minimum-length HT can be improved by adjusting the filter coefficients by
trial and error. HT does not allow DC component at zero frequency for transformation. So, Detrender is used to remove DC component/ trend component.
Q1 --> Quadrature phase signal
I1 --> In-phase signal
Period --> Dominant Cycle in bars
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 2nd 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 Cyber Cycle [CC]The Cyber Cycle was created by John Ehlers (Cybernetic Analysis For Stocks And Futures pg 34) and this is one of my favorite Ehlers indicators. I use it personally for exits but it has several uses. It gives great entry and exit signals when you enter when it is at the bottom or at the very top during a cycle. When it is above 0 then the stock is in a strong uptrend and when it is below 0 then the stock is in a strong downtrend. It is also very reactive as well with zero lag according to Ehlers. 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 Sinewave Indicator V2 [CC]The Sinewave Indicator was created by John Ehlers (Cybernetic Analysis For Stocks And Futures pgs 154-155) and this is an updated version of his original Sinewave Indicator which in my opinion seems to be more reactive to changes. Buy when the blue line crosses over the red line and sell when the blue line crosses under the red line. Also keep in mind that this indicator is based on cycles so it won't act the same as a typical indicator.
Let me know if there are other scripts you would like to see me publish or if you want something custom done!
Price Distance to its MA by DGTPrices high above the moving average (MA) or low below it are likely to be remedied in the future by a reverse price movement as stated in an Article by Denis Alajbeg, Zoran Bubas and Dina Vasic published in International Journal of Economics, Commerce and Management
Here comes a study to indicate the idea of this article, Price Distance to its Moving Averages (P/MA Ratio)
The analysis expressed in the paper indicates that there is a connection between the distance of the prices to moving averages and subsequent returns : portfolios of stocks with lower prices to moving averages generally outperformed portfolios of stocks with higher prices to moving averages. This “overextended” effect is more pronounced when using shorter moving averages of 20 and 50 days, and is especially strong in short-term holding periods like one and two weeks. The highest annual returns are recorded when buying in the range of 0-5% below shorter moving averages of 20/50 days, and 0-10% below longer moving averages of 100/200 days. However, buying very far below almost all moving averages on almost all holding periods produces the lowest returns.
The concept of this study recognizes three different modes of action.
In a clearly established upward trend traders should be buying when prices are near or below the MA line and selling when prices move too far above the MA.
Conversely, in downward trend stocks should be shorted when reaching or going above the moving average and covered when they drop too far below the MA line.
In a sideways movement traders are advised to buy if the price is too low below the moving average and sell when it goes too far above it
Short-term traders can expect to outperform in a one or two week time window if buying stocks with lower prices compared to their 20 and 50 SMA/EMA, one to two-week holding periods is quite high, ranging from 72,09% to 90,61% for the SMA(20, 50) and 85,03% to 87,5% for the EMA(20, 50). The best results for the SMA 20 and 50, on average, are concentrated in the region of 0-5% below the MA for the majority of holding periods. Buying very far below almost all MA in almost all holding periods turns out to be the worst possible option
Candle patterns, momentum could be used in conjunction with this indicator for better results. Try Colored DMI and Ichimoku colored SuperTrend by DGT
[RS]Cyclic Interval Average PriceEXPERIMENTAL:
Cyclic interval price averaging at every x bars.
Lines for trend line and intra trend slope(not working as intended).
Narrow Bandpass FilterIn technical analysis most bandpass filters like the MACD, TRIX, AO, or COG will have a non-symmetrical frequency response, in fact, this one is generally right-skewed. As such these oscillators will not fully remove lower and higher frequency components from the input signal, the following indicator is a bandpass filter with a more symmetrical frequency response with the possibility to have a narrow bandwidth, this allows the indicator to potentially isolate sinusoids from the input signal.
Indicator & Settings
The filter is calculated via convolution, if we take into account that the frequency response of a filter is the Fourier transform of its weighting function we can deduce that we can get a narrow response by using a sinusoid sin(2𝛑nf) as the weighting function, with the peak of the frequency response being equal to f , this makes the filter quite easy to control by the user, as this one can choose the frequency to be isolated. The length of the weighting function controls the bandwidth of the frequency response, with a higher length returning an ever-smaller frequency response width.
In the indicator settings the "Cycle Period" determine the period of the sinusoid used as a weighting function, while "Bandwidth" determine the filter passband width, with higher values returning a narrower passband, this setting also determine the length of the convolution, because the sum of the weights must add to 0 we know that the length of the convolution must be a multiple of "Cycle Period", so the length of the convolution is equal to "Cycle Period × Bandwidth".
Finally, the windowing option determines if a window is applied to the weighting function, a weighting function allow to remove ripples in the filter frequency response
Above both indicators have a Cycle period of 100 and a Bandwidth of 4, we can see that the indicator with no windowing don't fully remove the trend component in the price, this is due to the presence of ripples allowing lower frequency components to pass, this is not the case for the windowed version.
In theory, an ultra-narrow passband would allow to fully isolate pure sinusoids, below the cycle period of interest is 20
using a bandwidth equal to 10 allow to retain that sinusoid, however, note that this sinusoid is subject to phase shift and that it might not be a dominant frequency in the price.
Ehlers Spectrum Derived Filter Bank [CC]The Spectrum Derived Filter Bank was created by John Ehlers (Stocks & Commodities V. 26:3 (16-22)) and this is technically two indicators in one. This will let you know the current cycle period which is in blue and the other indicator will let you know if you should buy the stock or not. Buy when it is green and sell when it is red.
Let me know if you would like me to publish other scripts or if you want something custom done!
Note: I'm republishing this because the original script couldn't be found in searches so this will fix that.
Ehlers Dominant Cycle Tuned Bypass Filter [CC]The Dominant Cycle Tuned Bypass Filter was created by John Ehlers (Stocks & Commodities V. 26:3 (16-22)) and this is a particularly unique indicator because this does a pretty good job at predicting the future stock movements. If the blue line crosses over the red then a few bars from now the stock price will most likely go up and if the blue line crosses below the red then a few bars from now the stock price should go down. Since this is such a unique indicator to use with entry and exit points, I don't have them color coded but try this out and let me know what you think.
This was a special request so let me know what other scripts you would like to see me publish or if you want anything custom done!
Note: I'm republishing this because the original script couldn't be found in searches so this will fix that.
Week Start - Highlights the first candle of the weekSome users asked in PM about a script that highlights the start of the week. Consequently, I decided to publish it open for anyone finding it useful.
Furthermore, I will update the script soon with more useful features and customisation options.
Ehlers Correlation Cycle IndicatorThe Correlation Cycle Indicator was created by John Ehlers (Stocks & Commodities V. 38:06 (8–15)) and this is technically part of three indicators in one so I'm splitting each one to a separate script. This particular indicator was designed for trend direction and trend strength and simply buy when it is green and sell when it turns red. Also keep in mind that the higher the indicator is above the signal then the stronger the trend and when they are close together, conditions get choppy.
Let me know if you would like to see me publish other scripts or if you want something custom done!
Correlation Cycle, CorrelationAngle, Market State - John EhlersHot off the press, I present this "Correlation Cycle, CorrelationAngle, and Market State" multicator employing PSv4.0, originally formulated by Dr. John Ehlers for TASC - June 2020 Traders Tips. Basically it's an all-in-one combination of three Ehlers' indicators. This power packed triplet indicator, being less than a 100 line implementation at initial release, is a heavily modified version of the original indicator using novel techniques that surpass John Ehlers' original intended design.
This is also a profound script in numerous ways. First of all, these three indicators are directly from the illustrious mastermind himself Dr. John Ehlers. Secondarily, this is my "50th" script published on TV, which makes it even more significant. I'm especially proud of this script to "degrees" of imagination I once didn't know was theoretically possible in code. My intellect has once again been mathemagically unlocked pondering new innovations with this code revelation. Thirdly, this PSv4.0 script shows the empowering beauty and elegance of hacking the stock markets with TV's ultra utilitarian Pine Editor(PE) in a common browser! Some of you may be wondering if I worked on this for days... nope! This only took a few hours, followed by writing this description for another hour plus.
I have created many of Ehlers' indicators in PE, a few of which I have published in my profile, but I wanted to show how programming with Pine Script can be an artistic form of craftsmanship and poetry. None of this would be possible without the ingeniously minded Tradingview staff revolutionizing algorithmic trading at it's finest. If you should ever encounter them by chance, ponder humbly thanking these computing wizards for their diligence and dedication. They are providing, and shall award to us members, some of the most fascinating conceptualized tech imaginable in the coming future. I can assure you, much, much more is yet to be unveiled for us TV members/enthusiasts. Thank you TV and all you offer to this community.
As always, I have included advanced Pine programming techniques that conform to proper "Pine Etiquette" by example. There are so many Pine mastery techniques included, I don't have an abundance of time to elaborate on all of them. For those of you are code savvy, you may have notice I only used one "for" loop for increased server efficiency, instead of the two "for" loops in the original formulation. For those of you who are newcomers to Pine Script, this code release may also help you comprehend the immense "Power of Pine" by employing advanced programming techniques while exhibiting code utilization in a most effective manner. This is commonly what my dense intricate code looks like behind the veil. If you are wondering why there is hardly any notes, that's because the notation is primarily in the variable naming.
Features List Includes:
Dark Background - Easily disabled in indicator Settings->Style for "Light" charts or with Pine commenting
AND a few more... Why list them, when you have the source code!
The comments section below is solely just for commenting and other remarks, ideas, compliments, etc... regarding only this indicator, not others. When available time provides itself, I will consider your inquiries, thoughts, and concepts presented below in the comments section, should you have any questions or comments regarding this indicator. When my indicators achieve more prevalent use by TV members, I may implement more ideas when they present themselves as worthy additions. As always, "Like" it if you simply just like it with a proper thumbs up, and also return to my scripts list occasionally for additional postings. Have a profitable future everyone!
Pi Cycle Bitcoin top indicatorThe Pi Cycle Top Indicator has historically been effective in picking out the timing of market cycle highs to within 3 days.
It uses the 111 day moving average (111DMA) and a newly created multiple of the 350 day moving average, the 350DMA x 2.
Note: The multiple is of the price values of the 350DMA not the number of days.
For the past three market cycles, when the 111DMA moves up and crosses the 350DMA x 2 we see that it coincides with the price of Bitcoin peaking.
It is also interesting to note that 350 / 111 is 3.153, which is very close to Pi = 3.142. In fact, it is the closest we can get to Pi when dividing 350 by another whole number.
It once again demonstrates the cyclical nature of Bitcoin price action over long time frames. Though in this instance it does so with a high degree of accuracy over the past 7 years.
Full Credit to PositiveCrypto
Reflex Oscillator - Dr. John EhlersHot off the press, I present this NEW "Reflex Oscillator" employing PSv4.0, originally formulated by Dr. John Ehlers for TASC - February 2020 Traders Tips. John Ehlers might describe it's novel characteristics as being a reversal sensitive near zero-lag averaging indicator retaining the CYCLE component. Also, I would add that irregardless of the sampling interval, this indicator has a bound range between +/-2.0 on "1 second" candles all the way up to "1 month" candle durations. This indicator also has a companion indicator entitled "TrendFlex Oscillator". I have published it in tandem with this one in my scripts profile.
One notable difference between this and the original formulation is that I have added an independent control for the Super Smoother. This "tweak" is enabled by applying the override and adjusting it's period. There is a "Post Smooth" input() that "tweaks" the internal Reflex EMA too. Keep in mind that my intention of adding tweaks is solely for experimentation with the original formulation.
I also added adjustable levels for those of you that may wish to employ alertcondition()s to this indicator somehow. Providing a more utilitarian approach, I created this with an easy to use reusable function named reflex(). As always, I have included advanced Pine programming techniques that conform to proper "Pine Etiquette". Being this is one of John Ehlers' first two simultaneously released indicators for 2020, I felt a few more bells and whistles were appropriate as a proper contribution to the Tradingview community.
Features List Includes:
Dark Background - Easily disabled in indicator Settings->Style for "Light" charts or with Pine commenting
AND much, much more... You have the source!
The comments section below is solely just for commenting and other remarks, ideas, compliments, etc... regarding only this indicator, not others. When available time provides itself, I will consider your inquiries, thoughts, and concepts presented below in the comments section, should you have any questions or comments regarding this indicator. When my indicators achieve more prevalent use by TV members, I may implement more ideas when they present themselves as worthy additions. As always, "Like" it if you simply just like it with a proper thumbs up, and also return to my scripts list occasionally for additional postings. Have a profitable future everyone!
Schaff Trend Cycle [ChuckBanger]The Schaff Trend Cycle is a method, developed by Doug Schaff and based on the concept that trends also have repeating high and low patterns, or cycles. This is a modified MACD line, run through a modified stochastic algorithm and smoothed with Wilders’ smoothing in order to estimate the final Schaff Trend Cycle (STC) indicator. Its purpose is to identify the direction, in which a trend cycle is moving and possible peaks and bottoms within this cycle.
If this is interesting you should also take a look at MACD Leader:
For more info about Schaff Trend Cycle Indicator:
www.investopedia.com
Enhanced Instantaneous Cycle Period - Dr. John EhlersThis is my first public release of detector code entitled "Enhanced Instantaneous Cycle Period" for PSv4.0 I built many months ago. Be forewarned, this is not an indicator, this is a detector to be used by ADVANCED developers to build futuristic indicators in Pine. The origins of this script come from a document by Dr. John Ehlers entitled "SIGNAL ANALYSIS CONCEPTS". You may find this using the NSA's reverse search engine "goggles", as I call it. John Ehlers' MESA used this measurement to establish the data window for analysis for MESA Cycle computations. So... does any developer wish to emulate MESA Cycle now??
I decided to take instantaneous cycle period to another level of novel attainability in this public release of source code with the following methods, if you are curious how I ENHANCED it. Firstly I reduced the delay of accurate measurement from bar_index==0 by quite a few bars closer to IPO. Secondarily, I provided a limit of 6 for a minimum instantaneous cycle period. At bar_index==0, it would provide a period of 0 wrecking many algorithms from the start. I also increased the instantaneous cycle period's maximum value to 80 from 50, providing a window of 6-80 for the instantaneous cycle period value window limits. Thirdly, I replaced the internal EMA with another algorithm. It reduces the lag while extracting a floating point number, for algorithms that will accept that, compared to a sluggish ordinary EMA return. You will see the excessive EMA delay with adding plot(ema(ICP,7)) as it was originally designed. Lastly it's in one simple function for reusability in a nice little package comprising of less than 40 lines of code. I hope I explained that adequately enough and gave you the reader a glimpse of the "Power of Pine" combined with ingenuity.
Be forewarned again, that most of Pine's built-in functions will not accept a floating-point number or dynamic integers for the "length" of it's calculation. You will have to emulate the built-in functions by creating Pine based custom functions, and I assure you, this is very possible in many cases, but not all without array support. You may use int(ICP) to extract an integer from the smoothICP return variable, which may be favorable compared to the choppiness/ringing if ICP alone.
This is commonly what my dense intricate code looks like behind the veil. If you are wondering why there is barely any notation, that's because the notation is in the variable naming and this is intended primarily for ADVANCED developers too. It does contain lines of code that explore techniques in Pine that may be applicable in other Pine projects for those learning or wishing to excel with Pine.
Showcased in the chart below is my free to use "Enhanced Schaff Trend Cycle Indicator", having a common appeal to TV users frequently. If you do have any questions or comments regarding this indicator, I will consider your inquiries, thoughts, and ideas presented below in the comments section, when time provides it. As always, "Like" it if you simply just like it with a proper thumbs up, and also return to my scripts list occasionally for additional postings. Have a profitable future everyone!
NOTICE: Copy pasting bandits who may be having nefarious thoughts, DO NOT attempt this, because this may violate Tradingview's terms, conditions and/or house rules. "WE" are always watching the TV community vigilantly for mischievous behaviors and actions that exploit well intended authors for the purpose of increasing brownie points in reputation scores. Hiding behind a "protected" wall may not protect you from investigation and account penalization by TV staff. Be respectful, and don't just throw an ma() in there branding it as "your" gizmo. Fair enough? Alrighty then... I firmly believe in "innovating" future state-of-the-art indicators, and please contact me if you wish to do so.
Recursive DifferenciatorIntroduction
Cycles can be spotted by using a wide range of methods, most of them will involve bandpass filtering, here i will show a method using recursion with the change() function.
The Indicator
As i explained in other indicators using recursion i posted rescaling the input is important, i will use the rsi of an exponential moving average as input. alpha control the amount of output the indicator will use as input, values closer to 0.5 will use more input resulting in more periodic results.
Lowering alpha when length is higher can help get more periodic results.
Conclusion
I have showed a new cycle indicator using recursion. Recursion with oscillators can highlights cycles in price thus being easier to predict.
Thanks for reading !
Zero-Lag Smoothed CycleOld indicator ! But its a simple trick to have a zero-lag smoothing effect, i think i did it because the smoothing was kinda asymmetrical with the detrended line. So even if the result appear quite good take into account that the detrended line isn't always correlated with the price.