Bitcoin Logarithmic Growth Curve 2024The Bitcoin logarithmic growth curve is a concept used to analyze Bitcoin's price movements over time. The idea is based on the observation that Bitcoin's price tends to grow exponentially, particularly during bull markets. It attempts to give a long-term perspective on the Bitcoin price movements.
The curve includes an upper and lower band. These bands often represent zones where Bitcoin's price is overextended (upper band) or undervalued (lower band) relative to its historical growth trajectory. When the price touches or exceeds the upper band, it may indicate a speculative bubble, while prices near the lower band may suggest a buying opportunity.
Unlike most Bitcoin growth curve indicators, this one includes a logarithmic growth curve optimized using the latest 2024 price data, making it, in our view, superior to previous models. Additionally, it features statistical confidence intervals derived from linear regression, compatible across all timeframes, and extrapolates the data far into the future. Finally, this model allows users the flexibility to manually adjust the function parameters to suit their preferences.
The Bitcoin logarithmic growth curve has the following function:
y = 10^(a * log10(x) - b)
In the context of this formula, the y value represents the Bitcoin price, while the x value corresponds to the time, specifically indicated by the weekly bar number on the chart.
How is it made (You can skip this section if you’re not a fan of math):
To optimize the fit of this function and determine the optimal values of a and b, the previous weekly cycle peak values were analyzed. The corresponding x and y values were recorded as follows:
113, 18.55
240, 1004.42
451, 19128.27
655, 65502.47
The same process was applied to the bear market low values:
103, 2.48
267, 211.03
471, 3192.87
676, 16255.15
Next, these values were converted to their linear form by applying the base-10 logarithm. This transformation allows the function to be expressed in a linear state: y = a * x − b. This step is essential for enabling linear regression on these values.
For the cycle peak (x,y) values:
2.053, 1.268
2.380, 3.002
2.654, 4.282
2.816, 4.816
And for the bear market low (x,y) values:
2.013, 0.394
2.427, 2.324
2.673, 3.504
2.830, 4.211
Next, linear regression was performed on both these datasets. (Numerous tools are available online for linear regression calculations, making manual computations unnecessary).
Linear regression is a method used to find a straight line that best represents the relationship between two variables. It looks at how changes in one variable affect another and tries to predict values based on that relationship.
The goal is to minimize the differences between the actual data points and the points predicted by the line. Essentially, it aims to optimize for the highest R-Square value.
Below are the results:
It is important to note that both the slope (a-value) and the y-intercept (b-value) have associated standard errors. These standard errors can be used to calculate confidence intervals by multiplying them by the t-values (two degrees of freedom) from the linear regression.
These t-values can be found in a t-distribution table. For the top cycle confidence intervals, we used t10% (0.133), t25% (0.323), and t33% (0.414). For the bottom cycle confidence intervals, the t-values used were t10% (0.133), t25% (0.323), t33% (0.414), t50% (0.765), and t67% (1.063).
The final bull cycle function is:
y = 10^(4.058 ± 0.133 * log10(x) – 6.44 ± 0.324)
The final bear cycle function is:
y = 10^(4.684 ± 0.025 * log10(x) – -9.034 ± 0.063)
The main Criticisms of growth curve models:
The Bitcoin logarithmic growth curve model faces several general criticisms that we’d like to highlight briefly. The most significant, in our view, is its heavy reliance on past price data, which may not accurately forecast future trends. For instance, previous growth curve models from 2020 on TradingView were overly optimistic in predicting the last cycle’s peak.
This is why we aimed to present our process for deriving the final functions in a transparent, step-by-step scientific manner, including statistical confidence intervals. It's important to note that the bull cycle function is less reliable than the bear cycle function, as the top band is significantly wider than the bottom band.
Even so, we still believe that the Bitcoin logarithmic growth curve presented in this script is overly optimistic since it goes parly against the concept of diminishing returns which we discussed in this post:
This is why we also propose alternative parameter settings that align more closely with the theory of diminishing returns.
Our recommendations:
Drawing on the concept of diminishing returns, we propose alternative settings for this model that we believe provide a more realistic forecast aligned with this theory. The adjusted parameters apply only to the top band: a-value: 3.637 ± 0.2343 and b-parameter: -5.369 ± 0.6264. However, please note that these values are highly subjective, and you should be aware of the model's limitations.
Conservative bull cycle model:
y = 10^(3.637 ± 0.2343 * log10(x) - 5.369 ± 0.6264)
LOGARITHMIC
E9 PLRRThe 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.
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 EUROTLX: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.
Linear and Logarithmic Fibonacci Levels and (Price&Time) FansIntroduction
The Fibonacci Retracement tool is a go-to for traders looking to spot potential support and resistance levels. By measuring the distance between swing highs and lows, you can apply Fibonacci ratios like 0.236, 0.382, and 0.618 to predict key market levels.
Traditionally, these levels are set by dividing this distance into equal parts—known as Linear Levels. A more refined approach, Logarithmic Price and Time Levels, divides the distance into proportionally equal segments. Plus, this indicator now includes Fibonacci fans, adding another layer of analysis by projecting potential price levels using trendlines based on Fibonacci ratios.
This tool makes it easier to identify both Linear and Logarithmic levels while also leveraging Fibonacci fans for a more complete market view.
Applications
Logarithmic Levels and Fibonacci fans are ideal for volatile markets. In crypto, they’re especially effective for BTCUSDT (check out the wick from January 23, 2024). They also help spot accumulation and distribution patterns in high-volume altcoins like FETUSDT . In traditional markets, they’re useful for tracking stocks like TSLA and NVDA with extreme price swings, as well as indices in inflation-affected markets like XU100 , or recession-hit currency pairs like JPYUSD .
How to Use
This indicator is intuitive and similar to TradingView’s Fibonacci Tool. Select your reference levels (Level 1 and Level 0), then tweak the settings to customize your analysis, including adding Fibonacci fans for extra insights.
Why It’s Different
Unlike TradingView’s tool, which forces you to switch to a logarithmic scale (messing with other indicators and trend lines), this indicator lets you view both Linear and Logarithmic levels—and Fibonacci fans on Price and Time Series—without changing your chart’s scale. The original Fibonacci Code was derived from zekicanozkanli, modified and upgraded to plot fib front and back fans as well. Due to TV Max Plot restrictions I need to publish just Front and Back and Front Fibs separately.
Linear and Logarithmic Fibonacci Levels and FansIntroduction
The Fibonacci Retracement tool is a go-to for traders looking to spot potential support and resistance levels. By measuring the distance between swing highs and lows, you can apply Fibonacci ratios like 0.236, 0.382, and 0.618 to predict key market levels.
Traditionally, these levels are set by dividing this distance into equal parts—known as Linear Levels. A more refined approach, Logarithmic Levels, divides the distance into proportionally equal segments. Plus, this indicator now includes Fibonacci fans, adding another layer of analysis by projecting potential price levels using trendlines based on Fibonacci ratios.
This tool makes it easier to identify both Linear and Logarithmic levels while also leveraging Fibonacci fans for a more complete market view.
Applications
Logarithmic Levels and Fibonacci fans are ideal for volatile markets. In crypto, they’re especially effective for BTCUSDT (check out the wick from January 23, 2024). They also help spot accumulation and distribution patterns in high-volume altcoins like FETUSDT . In traditional markets, they’re useful for tracking stocks like TSLA and NVDA with extreme price swings, as well as indices in inflation-affected markets like XU100 , or recession-hit currency pairs like JPYUSD .
How to Use
This indicator is intuitive and similar to TradingView’s Fibonacci Tool. Select your reference levels (Level 1 and Level 0), then tweak the settings to customize your analysis, including adding Fibonacci fans for extra insights.
Why It’s Different
Unlike TradingView’s tool, which forces you to switch to a logarithmic scale (messing with other indicators and trend lines), this indicator lets you view both Linear and Logarithmic levels—and Fibonacci fans—without changing your chart’s scale. The original Fibonacci Code was derived from zekicanozkanli, modified and upgraded to plot fib fans as well.
Linear Regression ChannelLinear Regression Channel with Logarithmic Scale Option
This advanced Linear Regression Channel indicator offers traders a powerful tool for technical analysis, with unique features that set it apart from standard implementations.
Key Features:
Logarithmic Scale Option: One of the most distinctive aspects of this indicator is the ability to switch between classic and logarithmic scales. This feature is particularly valuable for long-term analysis, as it ensures that equal percentage changes are represented equally, regardless of the price level.
Flexible Start Date: Unlike many indicators that rely on a fixed number of periods, this tool allows users to set a specific start date and time. This feature provides precise control over the regression analysis timeframe, enhancing its adaptability to various trading strategies.
Customizable Channel Settings: Users can adjust the upper and lower deviation multipliers, allowing for fine-tuning of the channel width to suit different market conditions and trading styles.
Trend Strength Indicator: An optional feature that displays the strength of the trend based on the Pearson correlation coefficient, offering additional insight into the reliability of the current trend.
Comprehensive Visual Customization: The indicator offers extensive color and style options for the regression line, upper and lower channel lines, and fill areas, allowing traders to create a visually appealing and easy-to-read chart setup.
Extended Line Options: Users can choose to extend the regression lines to the left, right, or both, facilitating projection and analysis of future price movements.
Multiple Alert Conditions: The indicator includes four alert conditions for crossing the upper deviation, lower deviation, and the main regression line in both directions, enhancing its utility for active traders.
Why Choose This Indicator:
The combination of logarithmic scale option and flexible start date setting makes this Linear Regression Channel uniquely suited for both short-term and long-term analysis. The logarithmic scale is particularly beneficial for analyzing assets with significant price changes over time, as it normalizes percentage moves across different price levels. This feature, coupled with the ability to set a precise start date, allows traders to perform more accurate and relevant regression analyses, especially when studying specific market cycles or events.
Moreover, the trend strength indicator and customizable visual elements provide traders with a comprehensive tool that not only identifies potential support and resistance levels but also offers insight into the reliability and strength of the current trend.
In summary, this Linear Regression Channel indicator combines flexibility, precision, and insightful analytics, making it an invaluable tool for traders seeking to enhance their technical analysis capabilities on TradingView.
Bitcoin Logarithmic Regression
This indicator displays logarithmic regression channels for Bitcoin. A logarithmic regression is a function that increases or decreases rapidly at first, but then steadily slows as time moves. The original version of this indicator/model was created as an open source script by a user called Owain but is not available on TradingView anymore. So I decided to update the code to the latest version of pinescript and fine tune some of the parameters.
How to read and use the logarithmic regression:
There are 3 different regression lines or channels visible:
Green Channel: These lines represent different levels of support derived from the logarithmic regression model.
Purpose: The green channel is used to identify potential support levels where the price might find a bottom or bounce back upwards.
Interpretation:
If the price is approaching or touching the lower green lines, it might indicate a buying opportunity or an area where the price is considered undervalued.
------------------------------------------------
Red Channel: These lines represent different levels of resistance derived from the logarithmic regression model.
Purpose: The red channel is used to identify potential resistance levels where the price might encounter selling pressure or face difficulty moving higher.
Interpretation:
If the price is approaching or touching the upper red lines, it might indicate a selling opportunity or an area where the price is considered overvalued.
-------------------------------------------------
Purple Line This line represents to so-called "fair price" of Bitcoin according to the regression model.
Purpose: The purple line can be used to identify if the current price of Bitcoin is under- or overvalued.
Interpretation: A simple interpretation here would be that over time the price will have the tendency to always return to its "fair price", so starting to DCA more when price is under the line and less when it is over the line could be a suitable investment strategy.
----------------------------------------------------
Practical Application:
You can use this regression channel to build your own, long term, trading strategies. Notice how Bitcoin seems to always act in kind of the same 4 year cycle:
- Price likes to trade around the purple line at the time of the halvings
- After the halvings we see an extended sideways range for up to 300 days
- After the sideways range Bitcoin goes into a bull market frenzy (the area between the green and red channel)
- The price tops out at the upper red channel and then enters a prolonged bear market.
Buying around the purple line or lower line of the green channel and selling once the price reaches the red channel can be a suitable and very profitable strategy.
Exponential Grid [Phi, Pi, Euler]If you disagree with one of the EMH principles that price is too random, then by definition you must agree that historic price has deterministic function to a scenario ahead.
I personally believe that constants like phi, pi and e can mimic exponential growth of the price.
In this script, first grid is based on the Lowest price multiplied with self fraction of the constant.
For example:
If you are familiar with fib ratio 1.272, then you must know that it is 1.618 to the power of 0.5.
With default settings of exponent step 0.25
First grid = Lowest price x phi^0.25
Second grid = Lowest price x phi^0.25x2
Third grid = Lowest price x phi^0.25x3 and so on
The script will automatically find the lowest price and update the grid values.
Or you can set up your custom Lowest price manually if you feel like the All Time Low level loses its relevance value after long period.
There are 64 grids including Lowest price level. And it wasn't by a chance. Pine Script has a limitation of max 64 plots. Number of grids shown in the chart depends on the highest price. Once price breaks above ATH a couple of next grids will be plotted automatically. In most cases if everything is plotted, the chart appears squeezed and you'll need to zoom in to see it. Therefore, I adjusted it relatively to the scale of the chart for the comfort.
In some cases 64 plots aren't enough to cover the whole chart. For example, let's take a look at NVIDIA chart:
Since the price has started with 0.0333, it is way too small to cover all with default settings.
We are left with 2 choices:
Either Enable "Round"
OR increase Exponent Step (from 0.25 to 0.5 in the particular example below)
If you set constant to pi or e which is a bigger number than phi, expect the gaps to be bigger. To reduce it to a more gradual way of expansion you can decrease Exponent Step.
ChartRage - ELMAELMA - Exponential Logarithmic Moving Average
This is a new kind of moving average that is using exponential normalization of a logarithmic formula. The exponential function is used to average the weight on the moving average while the logarithmic function is used to calculate the overall price effect.
Features and Settings:
◻️ Following rate of change instead of absolute levels
◻️ Choose input source of the data
◻️ Real time signals through price interaction
◻️ Change ELMA length
◻️ Change the exponential decay rate
◻️ Customize base color and signal color
Equation of the ELMA:
This formula calculates a weighted average of the logarithm of prices, where more recent prices have a higher weight. The result is then exponentiated to return the ELMA value. This approach emphasizes the relative changes in price, making the ELMA sensitive to the % rate of change rather than absolute price levels. The decay rate can be adjusted in the settings.
Comparison EMA vs ELMA:
In this image we see the differences to the Exponential Moving Average.
Price Interaction and earlier Signals:
In this image we have added the bars, so we can see that the ELMA provides different signals of resistance and support zones and highlights them, by changing to the color yellow, when prices interact with the ELMA.
Strategy by trading Support and Resistance Zones:
The ELMA helps to evaluate trends and find entry points in bullish market conditions, and exit points in bearish conditions. When prices drop below the ELMA in a bull market, it is considered a buying signal. Conversely, in a bear market, it serves as an exit signal when prices trade above the ELMA.
Volatile Markets:
The ELMA works on all timeframes and markets. In this example we used the default value for Bitcoin. The ELMA clearly shows support and resistance zones. Depending on the asset, the length and the decay rate should be adjusted to provide the best results.
Real Time Signals:
Signals occur not after a candle closes but when price interacts with the ELMA level, providing real time signals by shifting color. (default = yellow)
Disclaimer* All analyses, charts, scripts, strategies, ideas, or indicators developed by us are provided for informational and educational purposes only. We do not guarantee any future results based on the use of these tools or past data. Users should trade at their own risk.
This work is licensed under Attribution-NonCommercial-ShareAlike 4.0 International
creativecommons.org
Adaptive Trend Finder (log)In the dynamic landscape of financial markets, the Adaptive Trend Finder (log) stands out as an example of precision and professionalism. This advanced tool, equipped with a unique feature, offers traders a sophisticated approach to market trend analysis: the choice between automatic detection of the long-term or short-term trend channel.
Key Features:
1. Choice Between Long-Term or Short-Term Trend Channel Detection: Positioned first, this distinctive feature of the Adaptive Trend Finder (log) allows traders to customize their analysis by choosing between the automatic detection of the long-term or short-term trend channel. This increased flexibility adapts to individual trading preferences and changing market conditions.
2. Autonomous Trend Channel Detection: Leveraging the robust statistical measure of the Pearson coefficient, the Adaptive Trend Finder (log) excels in autonomously locating the optimal trend channel. This data-driven approach ensures objective trend analysis, reducing subjective biases, and enhancing overall precision.
3. Precision of Logarithmic Scale: A distinctive characteristic of our indicator is its strategic use of the logarithmic scale for regression channels. This approach enables nuanced analysis of linear regression channels, capturing the subtleties of trends while accommodating variations in the amplitude of price movements.
4. Length and Strength Visualization: Traders gain a comprehensive view of the selected trend channel, with the revelation of its length and quantification of trend strength. These dual pieces of information empower traders to make informed decisions, providing insights into both the direction and intensity of the prevailing trend.
In the demanding universe of financial markets, the Adaptive Trend Finder (log) asserts itself as an essential tool for traders, offering an unparalleled combination of precision, professionalism, and customization. Highlighting the choice between automatic detection of the long-term or short-term trend channel in the first position, this indicator uniquely caters to the specific needs of each trader, ensuring informed decision-making in an ever-evolving financial environment.
Logarithmic CVD [IkkeOmar]The LCVD is another Mean-Reversion Indicator. it doesn't detect trends and does not give a signal per se. However the logarithmic transformation is made to visualize the direction of the trend for the volume. This allows you to see if money is flowing in or out of an asset.
What it does is tell you if we have a flashcrash based on the difference in volume.
Think of this indicator like a form of a volatility index.
Smoothing input:
The only input is an input for the smoothing length of the logDelta.
Volume Calculation:
// @IkkeOmar
//@version=5
indicator('Logarithmic CVD', shorttitle='CVD', overlay=false)
smooth = input.int(defval = 25, title = "Smoothing Distance")
// Calculate buying and selling volume
askVolume = volume * (close > open ? 1 : 0) // Assuming higher close than open indicates buying
bidVolume = volume * (close < open ? 1 : 0) // Assuming lower close than open indicates selling
// Delta is the difference between buying and selling volume
delta = askVolume - bidVolume
// Apply logarithmic transformation to delta
// Adding a check to ensure delta is not zero as log(0) is undefined
logDelta = delta > 0 ? math.log(math.abs(delta)) * math.sign(delta) : - math.log(math.abs(delta)) * math.sign(delta)
// use the the ta lib for calculating the sma of the logDelta
smoothLogDelta = ta.sma(logDelta, smooth)
// Create candlestick plot
plot(logDelta, color= color.green, title='Logarithmic CVD')
plot(smoothLogDelta, color= color.rgb(145, 37, 1), title='Smooth CVD')
These lines calculate the buying and selling volumes. askVolume is calculated as the total volume when the closing price is higher than the opening price, assuming this indicates buying pressure. bidVolume is calculated as the total volume when the closing price is lower than the opening price, assuming selling pressure.
The Delta is simply the difference between buying and selling volumes.
Logarithmic Transformation:
logDelta = delta > 0 ? math.log(math.abs(delta)) * math.sign(delta) : - math.log(math.abs(delta)) * math.sign(delta)
Applies a logarithmic transformation to delta. The math.log function is used to calculate the natural logarithm of the absolute value of delta. The sign of delta is preserved to differentiate between positive and negative values. This transformation helps in scaling the delta values, especially useful when dealing with large numbers.
This script essentially provides a visual representation of the buying and selling pressures in a market, transformed logarithmically for better scaling and smoothed for trend analysis.
Hope it makes sense!
Stay safe everyone!
Don't hesitate to ask any questions if you have any!
Logarithmic Volatility Direction Index [IkkeOmar]The LVDI is a Mean-Reversion Indicator. it doesn't detect trends and does not give a signal per se.
What it does is tell you if we have a flashcrash based on the price action and volume that is available. It is not always easy to see with the naked eye, so this indicator can help you DCA into an asset in a smarter way, if you couple it with other trend systems.
Think of this indicator like a form of a volatility index.
Inputs:
len and lenWMA are integers representing different lengths for calculations, and src is the data source
Keep in mind that "Length" is the lookback for the WMA, and the Length smooting is the lookback for the SMA of the "volume_weighted".
WMA Calculation
wma_basic = math.log10(ta.wma(src, len))
This calculates the logarithm (base 10) of the Weighted Moving Average (WMA) of the source data over len periods. WMA is a type of moving average giving more importance to recent data. The reason I use log10, is to make it transformative over a longer timeframe. This makes it easier to see the growth direction. I like to use this for crypto, since there is asymetric upside.
Volume Filter:
average_volume = ta.sma(volume, lenWMA)
volume_weighted = math.log10(wma_basic * (volume / math.log10(average_volume)))
Here, the script first calculates the Simple Moving Average (SMA) of the trading volume over lenWMA periods. Then, it computes a volume-weighted value of the WMA, adjusted by the logarithmic ratio of current volume to average volume.
Distance and Score Calculation:
distance = math.log10(src) - math.log10(volume_weighted)
score = math.sign(distance) * math.pow(math.abs(distance), 2)
The script calculates the logarithmic difference between the source data and the volume-weighted WMA. The score is determined by the sign of this distance multiplied by its square. This potentially amplifies the impact of larger distances.
Plotting:
plot(volume_weighted, title="Volume Weighted WMA", color=color.blue, linewidth = 2)
plot(ta.sma(volume_weighted, lenWMA), title="Volume Weighted WMA", color=color.rgb(189, 160, 0))
Mathematical concepts
Weighted Moving Average (WMA):
WMA is a moving average that assigns more weight to recent data points. The idea is that recent prices are more relevant to the current trend than older prices.
Logarithms:
The use of log10 (logarithm base 10) is interesting. Logarithms help in normalizing data and can make certain patterns more visible, especially when dealing with exponential growth or decay.
Volume Weighting:
Multiplying the WMA by the ratio of current volume to average volume (both logarithmic) integrates volume into the analysis. High trading volume can signify stronger market interest and can thus validate price movements.
Distance and Score:
The distance measures how far the current price is from the volume-weighted WMA on a logarithmic scale. The score squares this distance, potentially highlighting large divergences.
Case example
In the case above (which is a low timeframe that shouldn't be your main system) we see the blue line going up before going below the moving average line (orange). This indicates a local bottom zone. Does that mean that we wont go lower? No! What you can do is calculate a zone range.
We have an average line, you can get that from the POC with the VRVP.
Then you take the low and high of that zone and take the average:
(3.17% + 2.33%) / 2 = 2.75%
This means that we expect that the price can fall an additional 2.75%! Low and behold. When you check the same chart as above:
Hope it makes sense!
Stay safe everyone!
Don't hesitate to ask any questions if you have any!
Nadaraya-Watson Envelope Strategy (Non-Repainting) Log ScaleIn the diverse world of trading strategies, the Nadaraya-Watson Envelope Strategy offers a different approach. Grounded in mathematical analysis, this strategy utilizes the Nadaraya-Watson kernel regression, a method traditionally employed for interpreting complex data patterns.
At the core of this strategy lies the concept of 'envelopes', which are essentially dynamic volatility bands formed around the price based on a custom Average True Range (ATR). These envelopes help provide guidance on potential market entry and exit points. The strategy suggests considering a buy when the price crosses the lower envelope and a sell when it crosses the upper envelope.
One distinctive characteristic of the Nadaraya-Watson Envelope Strategy is its use of a logarithmic scale, as opposed to a linear scale. The logarithmic scale can be advantageous when dealing with larger timeframes and assets with wide-ranging price movements.
The strategy is implemented using Pine Script v5, and includes several adjustable parameters such as the lookback window, relative weighting, and the regression start point, providing a level of flexibility.
However, it's important to maintain a balanced view. While the use of mathematical models like the Nadaraya-Watson kernel regression may provide insightful data analysis, no strategy can guarantee success. Thorough backtesting, understanding the mathematical principles involved, and sound risk management are always essential when applying any trading strategy.
The Nadaraya-Watson Envelope Strategy thus offers another tool for traders to consider. As with all strategies, its effectiveness will largely depend on the trader's understanding, application, and the specific market conditions.
Adaptive Price Channel (log scale)The field of technical analysis is consistently expanding, with numerous indicators used for market forecasting. Amongst them, a novel indicator dubbed the Adaptive Price Channel (log scale), inspired by the renowned Nadaraya-Watson Envelope (LuxAlgo) from LuxAlgo, is gaining traction for its distinctive features and versatility. Unlike its predecessor, the Adaptive Price Channel (log scale) is applicable on a logarithmic scale, thereby allowing it to be utilized on both smaller and larger timeframes.
1. Key Features
The Adaptive Price Channel (log scale) is founded on the trading view Pinescript language, version 5, with its primary aim to maximize the versatility and scalability of trading indicators. It allows traders to adapt it according to their preferred timeframe, thereby making it applicable for a wide range of trading strategies.
Its bandwidth can be adjusted through the input parameters, offering traders the flexibility to manipulate the indicator according to their strategic requirements. Furthermore, it provides an option for repainting smoothing. This option enables users to control the repainting effect in which the historical output of the indicator may change over time. When disabled, the indicator provides the endpoints of the calculations, ensuring consistency in historical values.
Moreover, the Adaptive Price Channel (log scale) allows for color customization, thereby improving visibility and user-friendliness. The colors of the indicator's upward and downward directions can be changed according to the user's preference.
2. Working Mechanism
The Adaptive Price Channel (log scale) uses the logarithm of the source, which is typically the closing price of a trading instrument. It leverages a Gaussian function that exponentially decreases the further the price moves away from the mean, accounting for both positive and negative values. The bandwidth of the Gaussian function can be adjusted to adapt to different market conditions.
Additionally, the Adaptive Price Channel (log scale) features an array of 500 lines for each bar, which helps in defining the boundaries or envelope for price movements. The calculations are executed using the Nadaraya-Watson estimator, which uses kernel regression for non-parametric analysis.
The calculated values for the upper and lower bounds of the envelope are then converted back from the logarithmic scale using the exponential function. This calculation process continues for each bar until the last bar in the data set.
To ensure optimal performance, the Adaptive Price Channel (log scale) uses dynamic repainting. If the repainting mode is enabled, it adjusts the smoothing of the indicator for the entire historical data, making the results more accurate.
3. Visualization and Alerts
The Adaptive Price Channel (log scale) offers an array of visual aids, including labels and plots. The upper and lower bounds of the envelope are plotted, and the indicator triggers labels at points where the closing price crosses these boundaries. These labels serve as alerts for potential trading opportunities.
4. Conclusion
The Adaptive Price Channel (log scale) is an innovative and adaptable trading indicator, drawing inspiration from its predecessor but introducing unique features to increase its versatility. By providing a repainting option, it ensures consistent historical values, thereby enhancing the reliability of the indicator. Furthermore, the capability to operate on a logarithmic scale broadens its usability for different timeframes. The Adaptive Price Channel (log scale) is a powerful tool for any trader, facilitating a better understanding of market dynamics, and enabling more informed decision-making.
Nadaraya-Watson Envelope (Non-Repainting) Logarithmic ScaleIn the fast-paced world of trading, having a reliable and accurate indicator can make all the difference. Enter the Nadaraya-Watson Envelope Indicator, a cutting-edge tool designed to provide traders with valuable insights into market trends and potential price movements. In this article, we'll explore the advantages of this non-repainting indicator and how it can empower traders to make informed decisions with confidence.
Accurate Price Analysis:
The Nadaraya-Watson Envelope Indicator operates in a logarithmic scale, allowing for more accurate price analysis. By considering the logarithmic nature of price movements, this indicator captures the subtle nuances of market dynamics, providing a comprehensive view of price action. Traders can leverage this advantage to identify key support and resistance levels, spot potential breakouts, and anticipate trend reversals.
Non-Repainting Reliability:
One of the most significant advantages of the Nadaraya-Watson Envelope Indicator is its non-repainting nature. Repainting indicators can mislead traders by changing historical signals, making it difficult to evaluate past performance accurately. With the non-repainting characteristic of this indicator, traders can have confidence in the reliability and consistency of the signals generated, ensuring more accurate backtesting and decision-making.
Customizable Parameters:
Every trader has unique preferences and trading styles. The Nadaraya-Watson Envelope Indicator offers a range of customizable parameters, allowing traders to fine-tune the indicator to their specific needs. From adjusting the lookback window and relative weighting to defining the start of regression, traders have the flexibility to adapt the indicator to different timeframes and trading strategies, enhancing its effectiveness and versatility.
Envelope Bounds and Estimation:
The Nadaraya-Watson Envelope Indicator calculates upper and lower bounds based on the Average True Range (ATR) and specified factors. These envelope bounds act as dynamic support and resistance levels, providing traders with valuable reference points for potential price targets and stop-loss levels. Additionally, the indicator generates an estimation plot, visually representing the projected price movement, enabling traders to anticipate market trends and make well-informed trading decisions.
Visual Clarity with Plots and Fills:
Clear visualization is crucial for effective technical analysis. The Nadaraya-Watson Envelope Indicator offers plots and fills to enhance visual clarity and ease of interpretation. The upper and lower boundaries are plotted, along with the estimation line, allowing traders to quickly assess price trends and volatility. Fills between the boundaries provide a visual representation of different price regions, aiding in identifying potential trading opportunities and risk management.
Conclusion:
The Nadaraya-Watson Envelope Indicator is a powerful tool for traders seeking accurate and reliable insights into market trends and price movements. With its logarithmic scale, non-repainting nature, customizable parameters, and visual clarity, this indicator equips traders with a competitive edge in the financial markets. By harnessing the advantages offered by the Nadaraya-Watson Envelope Indicator, traders can navigate the complexities of trading with confidence and precision. Unlock the potential of this advanced indicator and elevate your trading strategy to new heights.
Linear Regression Channel (Log)The Linear Regression Channel (Log) indicator is a modified version of the Linear Regression channel available on TradingView. It is designed to be used on a logarithmic scale, providing a different perspective on price movements.
The indicator utilizes the concept of linear regression to visualize the overall price trend in a specific section of the chart. The central line represents the linear regression calculation, while the upper and lower lines indicate a certain number of standard deviations away from the central line. These bands serve as support and resistance levels, and when prices remain outside the channel for an extended period, a potential reversal may be anticipated.
I have replaced the Pearson values with trend strength levels to enhance understanding for individuals unfamiliar with Pearson correlation.
Weighted Bollinger Band (+ Logarithmic)ENG)
Weighted BB is more responsive to price changes than original Bollinger Bands.
the calculation formula uses a weighted method based on the current price.
Instead of using a standard deviation, I used a weighted standard deviation that weights the current price, and instead of a simple moving average, I used a weighted moving average.
Also included is a formula to log the Bollinger Bands for users who view charts on a logarithmic scale.
KOR)
원본 볼밴보다 가격변화에 대한 반응성이 높습니다.
계산식에는 현재가격에 가중을 주는 방식을 사용하였습니다.
표준편차를 사용하는 대신 저는 현재가격에 가중을 두는 가중표준편차를 사용하였고, 단순이동평균 대신 가중이동평균을 사용하였습니다.
또한 로그스케일로 차트를 보는 유저를 위해 볼린저밴드를 log화 하는 수식도 포함하였습니다.
Hussarya Volume cumulated. Buy Sell.
Volume frome curent chart or cumulated volume from Binance, Bybit Kraken, Ftx and Coinbase.
You can chose also. log scale on simple or cumulated volume.
Colors:
Grey. total volume
Red. sell Volume
Green. Buy volume
Red or green shows only bigger value
L'MACD GUNHi all!
I would like to present you my universal MACD module.
In addition to the standard functions I have added several improvements:
Source Selection.
In addition to the standard calculation of the moving average "EMA", in the parameter "MA Type" I have added 52 more methods for calculating the MA! :
ADXMA, AHMA, ALF, ALMA, ARI, ARSI, BlackFilter, CTI, DoubleEma, DTA, DWMA, EEO, EHMA, ELA, EMARSI, EREA, HEMA, hma, HWMA, JAMA, KA, KAMA, LSMA, LWMA, McGinley_2, MNMA, PAW, REMA, rma, RMF, RMTA, RWMA, sma, SMMA, SuperSmooth, THMA, TilsonT3, TMA, TRAMA, TripleEma, TSF, VAMA, VAR, VHMA, VIDYA, VVMA, vwma, WCD, wma, WWMA, ZEMA, ZLMA !
Additional histogram and lines from the higher timeframe. With the parameter "Multiple of TF" you can specify on which timeframe the standard histogram should be zoomed.
The Zoom function allows increasing or decreasing the size of the histogram. (It does not affect the calculations in any way, it is only used for visualization purposes.)
How to use it?
I recommend using it as a standard MACD. You can test different types of moving averages thanks to my modules and choose the one you find most suitable.
Tips:
The script is slightly heavy and may take a little longer to load than usual.
All MA types are in alphabetical order and tied to numbers.
Next to the "MA Type" parameter there is a hint which method of calculating MA corresponds to the figure. The default is 15. In the hint 15 = EMA. This is the standard method of calculating the MAСD.
To select the MA more quickly. You can switch them with the mouse wheel or the arrows on the keyboard.
I use the standard parameters prescribed in the script.
The code is calibrated for any TF and displays as correctly as possible. Can be used on any type of chart.
Bitcoin Best Value CorridorHere is my interpretation of the "Best Time To Buy" Bitcoin over its lifetime using a logarithmic regression trendline. The upper and lower lines are 10% deviations from the centre line. I calculated the trendline in excel and then coded my results into pine script.
Bitcoin Inflation-Adjusted Support and Resistance5year breakeven inflation rate fitted for log BTC chart as Support and Resistance
Logarithmic Bollinger BandsLogarithmic Bollinger Bands
Published by Eric Thies on January 14, 2022
Summary
In this script I have taken the standard Bollinger band pinescript and made efforts to eliminate the behavior experienced in periods of high volatility in which we see the bands disappear completely off the chart by adding exponential plotting and logarithmic sourcing to the tool.
This tool will also show periods of Bearish and Bullish Expansion for users to see when volatility is running high in the market.
More On Bollinger Bands
Bollinger Bands consist of a center line representing the moving average of a security’s price over a certain period, and two additional parallel lines (called the upper and lower trading bands) one of which is just the moving average plus k-times the standard deviation over the selected time frame, and the other being the moving average minus k-times the standard deviation over that same timeframe. This technique has been developed in the 1980’s by John Bollinger, who lately registered the terms “Bollinger Bands” as a U.S. trademark in 2011. Technical analysts typically use 20 periods and k = 2 as default settings to build Bollinger Bands, while they can choose a simple or exponential moving average. Bollinger Bands provide a relative definition of high and low prices of a security. When the security is trading within the upper band, the price is considered high, while it is considered low when the security is trading within the lower band.
There is no general consensus on the use of Bollinger Bands among traders. Some traders see a buy signal when the price hits the lower Bollinger Band and close their position when the price hits the moving average. Some others buy when the price crosses over the upper band and sell when the price crosses below the lower band. We can see here two opposing interpretations based on different rationales, depending whether we are in a reversal or continuation pattern. Another interesting feature of the Bollinger Bands is that they give an indication of the volatility levels; a widening gap between the upper and lower bands indicates an increasing volatility, while a narrowing band indicates a decreasing volatility. Moreover, when the bands have an almost flat slope (parallel to the x-axis) the price will generally oscillate between the bands as if trading through a channel.
// © 2022 KINGTHIES THIS SOURCE CODE IS SUBJECT TO TERMS OF MOZILLA PUBLIC LICENSE 2.0 (MOZILLA.ORG/MPL/2.0)
//@version=5
//## !<---------------- © KINGTHIES --------------------->
indicator('Logarithmic Bollinger Bands (kingthies)',shorttitle='LogBands_KT',overlay=true)
// { BBANDS
src = math.log(input(close,title="Source"))
lenX = input(20,title='lenX')
highlights = input(false,title="Highlight Bear and Bull Expansions?")
mult = 2
bbandBasis = ta.sma(src,lenX)
dev = 2 * ta.stdev(src, 20)
upperBB = bbandBasis + dev
lowerBB = bbandBasis - dev
bbw = (upperBB-lowerBB)/bbandBasis
bbr = (src - lowerBB)/(upperBB - lowerBB)
// }
// { BBAND EXPANSIONS
bullExp= ta.rising(upperBB,1) and ta.falling(lowerBB,1) and ta.rising(bbandBasis,1) and ta.rising(bbw,1) and ta.rising(bbr,1)
bearExp= ta.rising(upperBB,1) and ta.falling(lowerBB,1) and ta.falling(bbandBasis,1) and ta.rising(bbw,1) and ta.falling(bbr,1)
// }
// { COLORS
greenBG = color.rgb(9,121,105,75), redBG = color.rgb(136,8,8,75)
bullCol = highlights and bullExp ? greenBG : na, bearCol = highlights and bearExp ? redBG : na
// }
// { INDICATOR PLOTTING
lowBB=plot(math.exp(lowerBB),title='Low Band',color=color.aqua),plot(math.exp(bbandBasis),title='BBand Basis',color=color.red),
highBB=plot(math.exp(upperBB),title='High Band',color=color.aqua),fill(lowBB,highBB,title='Band Fill Color',color=color.rgb(0,128,128,75))
bgcolor(bullCol,title='Bullish Expansion Highlights'),bgcolor(bearCol,title='Bearish Expansion Highlights')
// }
Universal logarithmic growth curves, with support and resistanceLogarithmic regression is used to model data where growth or decay accelerates rapidly at first and then slows over time. This model is for the long term series data (such as 10 years time span).
The user can consider entering the market when the price below 25% or 5% confidence and consider take profit when the price goes above 75% or 95% confidence line.
This script is:
- Designed to be usable in all tickers. (not only for bitcoin now!)
- Logarithmic regression and shows support-resistance level
- Shape of lines are all linear adjustable
- Height difference of levels and zones are customizable
- Support and resistance levels are highlighted
Input panel:
- Steps of drawing: Won't change it unless there are display problems.
- Resistance, support, other level color: self-explanatory.
- Stdev multipliers: A constant variable to adjust regression boundaries.
- Fib level N: Base on the relative position of top line and base line. If you don't want all fib levels, you might set all fib levels = 0.5.
- Linear lift up: vertically lift up the whole set of lines. By linear multiplication.
- Curvature constant: It is the base value of the exponential transform before converting it back to the chart and plotting it. A bigger base value will make a more upward curvy line.
FAQ:
Q: How to use it?
A: Click "Fx" in your chart then search this script to get it into your chart. Then right click the price axis, then select "Logarithmic" scale to show the curves probably.
Q: Why release this script?
A: - This script is intended to to fix the current issues of bitcoins growth curve script, and to provide a better version of the logarithmic curve, which is not only for bitcoin , but for all kinds of tickers.
- In the public library there is a hardcoded logarithmic growth curve by @quantadelic . But unfortunately that curve was hardcoded by his manual inputs, which makes the curve stop updating its value since 2019 the date he publish that code. Many users of that script love using it but they realize it was stop updating, many users out there based on @quantadelic version of "bitcoin logarithmic growth curves" and they tried their best to update the coordinates with their own hardcode input values. Eventually, a lot of redundant hardcoded "Bitcoin growth curve" scripts was born in the public library. Which is not a good thing.
Q: What about looking at the regression result with a log scale price axis?
A: You can use this script that I published in a year ago. This script display the result in a log scale price axis.
JC Log($/SMA)Simple script with user-definable:
• SMA denominator days.
• A handy and subtle smoothing function for the numerator, in EMA days. Set to 0 to just use the standard current price. (Defaults to 3 for barely noticeable lag and smoothing.)
• User-definable time resolution, independent of the chart. (Or you can set to use the same as the chart.)