OPEN-SOURCE SCRIPT

E9 PLRR

The E9 PLRR (Power Law Residual Ratio) is a custom-built indicator designed to evaluate the overvaluation or undervaluation of an asset, specifically by utilizing logarithmic price data and a power law-based model. It leverages a dynamic regression technique to assess the deviation of the current price from its expected value, giving insights into how much the price deviates from its long-term trend.

This indicator is primarily used to detect market extremes and cycles, often used in the analysis of long-term price movements in assets like Bitcoin, where cyclical behavior and significant price deviations are common.

ảnh chụp nhanh
This chart is back from 2019 and shows (From left to right) 2018 Bear market bottom at 3.5k (Dark Blue) , following a peak at 12k (dark red) before the Covid crash back down to 4K (Dark blue)

Key Components

Logarithmic Price Data:
The indicator works with logarithmic price data (ohlc4), which represents the average of open, high, low, and close prices. The logarithmic transformation is crucial in financial modeling, especially when analyzing long-term price data, as it normalizes exponential price growth patterns.

Dynamic Exponent 𝑘:
The model calculates a dynamic exponent k using regression, which defines the power law relationship between time and price. This exponent is essential in determining the expected power law price return and how far the current price deviates from that expected trend.

Power Law Price Return:
The power law price return is computed using the dynamic exponent
k over a defined period, such as 365 days (1 year). It represents the theoretical price return based on a power law relationship, which is used to compare against the actual logarithmic price data.

Risk-Free Rate:
The indicator incorporates an adjustable risk-free rate, allowing users to model the opportunity cost of holding an asset compared to risk-free alternatives. By default, the risk-free rate is set to 0%, but this can be modified depending on the user's requirements.

Volatility Adjustment:
A key feature of the PLRR is its ability to adjust for price volatility. The indicator smooths out short-term price fluctuations using a moving average, helping to detect longer-term cycles and trends.

PLRR Calculation:

The core of the indicator is the calculation of the Power Law Residual Ratio (PLRR). This is derived by subtracting the expected power law price return and risk-free rate from the logarithmic price return, then multiplying the result by a user-defined multiplier.

Color Gradient:
The PLRR values are represented visually using a color gradient. This gradient helps the user quickly identify whether the asset is in an undervalued, fair value, or overvalued state:
Dark Blue to Light Blue: Indicates undervaluation, with increasing blue tones representing a higher degree of undervaluation.
Green to Yellow: Represents fair value, where the price is aligned with the expected power law return.
Orange to Dark Red: Indicates overvaluation, with increasing red tones representing a higher degree of overvaluation.

Zero Line:
A zero line is plotted on the indicator chart, serving as a reference point. Values above the zero line suggest potential overvaluation, while values below indicate potential undervaluation.

Dots Visualization:
The PLRR is plotted using dots, with each dot color-coded based on the PLRR value. This dot-based visualization makes it easier to spot significant changes or reversals in market sentiment without overwhelming the user with continuous lines.

Bar Coloring:
The chart’s bars are colored in accordance with the PLRR value at each point in time, making it visually clear when an asset is potentially overvalued or undervalued.

Indicator Functionality
Cycle Identification: The E9 PLRR is especially useful for identifying cyclical market behavior. In assets like Bitcoin, which are known for their boom-bust cycles, the PLRR can help pinpoint when the market is likely entering a peak (overvaluation) or a trough (undervaluation).

Overvaluation and Undervaluation Detection: By comparing the current price to its expected power law return, the PLRR helps traders assess whether an asset is trading above or below its fair value. This is critical for long-term investors seeking to enter the market at undervalued levels and exit during periods of overvaluation.

Trend Following: The indicator helps users identify the broader trend by smoothing out short-term volatility. This makes it useful for both momentum traders looking to ride trends and contrarian traders seeking to capitalize on market extremes.

Customization
The E9 PLRR allows users to fine-tune several parameters based on their preferences or specific market conditions:

Lookback Period:
The user can adjust the lookback period (default: 100) to modify how the moving average and regression are calculated.
Risk-Free Rate:
Adjusting the risk-free rate allows for more realistic modeling of the opportunity cost of holding the asset.
Multiplier:
The multiplier (default: 5.688) amplifies the sensitivity of the PLRR, allowing users to adjust how aggressively the indicator responds to price movements.

This indicator was inspired by the works of Ashwin & PlanG and their work around powerLaw. Thank you. I hall be working on the calculation of this indicator moving forward to make improvements and optomisations.
bitcoinpredictionbitcointrendCentered OscillatorsCyclesLOGARITHMICplanbpowerlawTrend Analysistrendpattern

Mã nguồn mở

Theo tinh thần TradingView thực sự, tác giả của tập lệnh này đã xuất bản dưới dạng nguồn mở để các nhà giao dịch có thể hiểu và xác minh. Chúc mừng tác giả! Bạn có thể sử dụng miễn phí. Tuy nhiên, bạn cần sử dụng lại mã này theo Quy tắc nội bộ. Bạn có thể yêu thích nó để sử dụng nó trên biểu đồ.

Bạn muốn sử dụng tập lệnh này trên biểu đồ?


Ngoài ra, trên:

Thông báo miễn trừ trách nhiệm