LPPL Critical Pulse (by BigBlueCheese) Version 1.1LPPL Critical Pulse (by BigBlueCheese)
I couldn’t locate a single script on TradingView that utilized the Log-Periodic Power Law (LPPL) and period doubling—key tools used by street professionals. Here is my first script…More to come.
Log-Periodic Power Law (LPPL)
LPPL is a mathematical framework used to model asset price bubbles that can help predict market crashes or corrections. It is based on the idea that speculative bubbles exhibit self-reinforcing, positive feedback behavior that leads to increasingly unsustainable price growth, followed by a crash or correction. But the big news is that because of the speculative behavior it can identify, it has equal application across many other instruments & timeframes.
The LPPL, has been around since the 1950’s and 1960’s where its theoretical foundation lies in the concepts of renormalized group theory and critical point behavior. Physicists Lev Landau, Vitaly Ginzburg & Kenneth Wilson contributed to how we can understand systems behave at critical points and was further developed by Benoit Mandelbrot via the concept of discrete scale invariance and log-periodicity. The concepts were popularized by Didier Sornette in Why Stock Markets Crash, where he used his model to detect when markets are experiencing extreme price movements, indicating the potential for a bubble to burst or a significant correction to occur. It is suspected that others like Jim Simons was an early adopter/adapter of this (and other) advanced mathematical concepts. LPPL is especially valuable for traders trying to anticipate rapid price movements—both upward and downward.
What is a Speculative Bubble?
A speculative bubble forms when an asset’s price skyrockets due to excitement from investors, pushing it well beyond its true value. At some point, this unsustainable growth leads to a crash, as the bubble “pops.” However, these crashes don’t need to be massive market-shaking events. They can also emerge from short-term price anomalies in any market or timeframe…..and they apply equally to upward & downward price moves. That is you can use this approach for both long and short trades.
Power Law & Log-Periodicity
The Power Law aspect describes how prices accelerate as they approach a critical point, forming a steep curve that signals instability.
The Log-Periodic component captures the oscillations that grow increasingly frequent as the price nears this tipping point, marking rising volatility.
Criticality in Trading: Feedback Loops, Attractors and Repellers
LPPL can be applied to financial markets by comparing them to natural systems prone to critical points, like avalanches or earthquakes. The key concept is criticality—the idea that, just like pressure building in an earthquake zone or snow stacking up on a mountain, there’s a feedback loop in markets where investor behavior becomes increasingly synchronized. This creates a self-reinforcing cycle, accelerating price movements until the system can no longer sustain the tension, and it collapses—similar to a critical phase shift in nature when physical systems experience sudden, catastrophic events when they reach a critical threshold.
In this context, the LPPL model aims to identify these critical points in financial markets by recognizing specific patterns in price movements, providing insight into the potential timing of major market shifts.
This is how markets can behave like attractors (drawing prices into unsustainable growth or collapses) or repellers (pushing them away through sudden corrections), depending on the balance of forces. LPPL captures this dynamic, helping traders anticipate when the market is nearing these critical moments.
Attractors are states or patterns that a system tends to gravitate towards over time, representing points of stability or equilibrium. Repellers are states that the system tends to avoid or move away from, representing instability or points of divergence.
In the context of the LPPL model, the market is seen as a dynamic system that is moving towards a critical point—often a bubble or a crash. The critical point itself can be viewed as an attractor, pulling the market toward a period of instability as prices accelerate and oscillations become more frequent. This movement reflects positive feedback loops, where investor behavior (e.g., herd mentality or speculative buying) reinforces the trend until it reaches an unsustainable level.
Conversely, once the critical point is reached, it can act as a repeller, causing the system (market) to rapidly move away from that state, often resulting in a crash or market correction. In essence, the LPPL model tries to identify these phases of movement toward or away from critical points, using attractors and repellers to describe the behavior of the system before and after major market events.
This dynamic interaction between stability and instability, or attractors and repellers, is a key feature of how Sornette’s LPPL approach models financial markets, emphasizing the market’s ability to oscillate between periods of calm and critical shifts.
Bubbles and Crashes in Any Timeframe
While people often think of bubbles and crashes as huge events like the Crash of 87, the Global Financial Crisis or COVID-19, they can also be much smaller or instrument specific. A short-term spike in a stock or a sudden currency drop can behave like a miniature bubble. LPPL helps spot these shorter-term price anomalies, making it versatile for traders looking for opportunities in all instruments and timeframes.
How Can I Use LPPL Critical Pulse?
Monitor price acceleration that signals unsustainable growth/movement .
Spot volatility, oscillations, extensions and compressions and exhaustion as the market nears critical instability and levels.
Combine with other indicators to help time entries and exits, manage risk as markets approach/consolidate/leave critical levels.
LPPL Critical Pulse (LPPLCP)
LPPLCP is based on LPPL principles that identify potential upward and downward market movements, exhaustion and consolidation periods.
Visualization
The LPPL line is smoothed using a moving average to reduce noise, and the result is scaled to fit within the price range of the past 100 bars, aligning the LPPL line with the price movements on the chart.
Dynamic LPPL Line Plot:
A smoothed and scaled LPPL line plotted directly on the price chart.
• Color-Coded Trend Analysis: The LPPL line changes color dynamically based on the conditions of slope and acceleration to reflect market behaviors such as period doubling or exhaustion.
1. White (Exhaustion/Consolidation Condition): Indicates that both the slope and the acceleration of the LPPL line are zero, suggesting a potential market flattening or exhaustion/consolidation. At the end of this period, a new trend may emerge OR the prior trend may reassert itself.
2. Purple (Period Doubling): This color appears when the LPPL model detects rapid changes in acceleration, indicating the potential for a market turning point (period doubling). The slope of the LPPL line during this period suggests whether the market is moving upward or downward.
3. Green (Positive Slope with Increasing Acceleration): A green LPPL line suggests that the market is in an upward trend, with increasing acceleration.
4. Red (Negative Slope with Decreasing Acceleration): A red LPPL line indicates a downward market trend with decreasing acceleration.
5. Yellow (Neutral): Yellow is the default color when none of the specific conditions (exhaustion, period doubling, positive/negative slope with acceleration) are met, i.e. generally a continuation of the prior condition but at a slower pace.
Customization for Any Market
LPPL Critical Pulse has application across most time frames for pretty much whatever you want to trade…stocks, commodities, currencies, futures, and more. You will have to tweak the inputs to optimize for the market(s) you choose to trade.
Inputs
1. Lookback Period for Adaptation
o Type: Integer
o Default: 1
o Description: Defines the lookback period for calculating the Simple Moving Average (SMA) and Standard Deviation (StDev) used in the LPPL model. A higher value smooths the calculations over a longer period.
2. Period Doubling Threshold
o Type: Float
o Default: 0.01
o Description: Determines the sensitivity for detecting period doubling in the LPPL line. A lower threshold increases sensitivity.
3. Flattening Threshold
o Type: Float
o Default: 0.01
o Description: This input is not actively used in the current version but can be modified for further customizations in the LPPL model.
4. Period Doubling Acceleration Threshold
o Type: Float
o Default: 0.02
o Description: This controls the threshold for detecting rapid changes in the LPPL acceleration, helping identify when period doubling occurs.
Calculation Components
The LPPL line is calculated using several components:
• SMA (A): The simple moving average of the closing prices over the selected lookback period.
• Standard Deviation (B, C): These parameters are calculated based on the standard deviation of prices and control the amplitude of the LPPL oscillations.
• Exponential Decay: The LPPL line decays as it approaches a theoretical critical time (tc), where market crashes or rapid changes may occur.
Disclaimer.
Not investment advice. Use at your own risk. Past results do not represent and are not indicative of future results
Bubble
Bitcoin Bubble Risk (Adjusted for Diminishing Returns)Description:
This indicator offers a unique lens through which traders can assess risk in the Bitcoin market, specifically tailored to recognize the phenomenon of diminishing returns. By calculating the natural logarithm of the price relative to a 20-month Simple Moving Average (SMA) and applying a dynamic normalization process, this tool highlights periods of varying risk based on historical price movements and adjusted returns. The indicator is designed to provide nuanced insights into potential risk levels, aiding traders in their decision-making processes.
Usage:
To effectively use this indicator, apply it to your chart while ensuring that Bitcoin's price is set to display in monthly candles. This setting is vital for the indicator to accurately reflect the market's risk levels, as it relies on long-term data aggregation to inform its analysis.
This tool is especially beneficial for traders focused on medium to long-term investment horizons in Bitcoin, offering insights into when the market may be entering higher or lower risk phases. By incorporating this indicator into your analysis, you can gain a deeper understanding of potential risk exposures based on the adjusted price trends and market conditions.
Originality and Utility:
This script stands out for its innovative approach to risk analysis in the cryptocurrency space. By adjusting for the diminishing returns seen in mature markets, it provides a refined perspective on risk levels, enhancing traditional methodologies. This script is a significant contribution to the TradingView community, offering a unique tool for traders aiming to navigate the complexities of the Bitcoin market with informed risk management strategies.
Important Note:
This indicator is for informational purposes only and should not be considered investment advice. Users are encouraged to conduct their own research and consult with financial professionals before making investment decisions. The accuracy of the indicator's predictions can only be ensured when applied to monthly candlestick charts of Bitcoin.
HPK Crash IndicatorFrom Hari P. Krishnan's book, The Second Leg Down: Strategies for Profiting after a Market Sell-Off :
"We start by specifying the year on year (YoY) change in the index. Next, we calculate the 5 year trailing Z score of the YoY returns. We also calculate the 5 year trailing Z score of 1 month historical volatility for the index, using daily returns. Our crisis warning indicator flashes if both Z scores are above 2. In other words, recent price increases and current volatility need to be at least 2 standard deviations above normal.
It can be seen that this basic implementation is reasonably effective, accepting that the effective sample set is small. A false signal is given in mid-2006, but the signal is quickly washed away. The remaining signals occur fairly close to the point of collapse. The idea that elevated volatility is predictive of danger is not new and underpins many asset allocation schemes. However, Sornette deserves credit for moving away from a largely valuation-based approach to predicting crises to one that relies upon price action itself."
Bubbles BB futuresQuick and simple BB bubble indicator for Futures
Draw an arrow if candle corpse is out of Bollinger Band (Upper / Lower)
It's not a signal.
I use it to off-load my charts
Pinescript Bubble Sort using ArraysThe new feature of arrays allows for a multitude of new possibilities within Pinescript. This script implements a bubble sort function with most probable efficiency of О(n^2) with a best-case being O(n). This sort does not require large amounts of memory to process and has advantages when sorting small lists of data.
The main advantages: Bubble sort is an in-place sorting algorithm. It does not require extra memory or even stack space like in the case of merge sort or quicksort.
The main disadvantages: In the worst case the time complexity is equal to O(n^2) which is not efficient in comparison to other sorts which can have a time complexity of O(n*logn).
The Pseudocode for a bubble sort is as follows:
begin BubbleSort(list)
for all elements of list
if list > list
swap(list , list )
end if
end for
return list
end BubbleSort
The results of the sort are plotted against the unsorted list and overlayed on the chart.
A big thanks to Alex Grover for the help.
No BubbleSimply removes a period of time from the chart and replaces it with no value. This can help with scaling or bias.
[STRATEGY] Follow the Janet YellenIn the era of central bank's helicopter money, the market will always be skyrocketing up and up given enough time.
What's the strategy to profit from indices?
Only short the market when its in a state of euphoria /irrational exuberance bubble, or sell when it is confirmed (20% drawdown). Otherwise, you really have no reason not to long at every chance.
Conclusion:
Follow the printing press like a sheep.