Top - Bottom Using MAThis script is used decide weather stock is overbought or oversold in given length/days from the settings.
using close difference from ohlc4 moving average ratio.
Settings Available
1) moving average length
2) Highest / Lowest ratio length
3) Difference Between Highest and Lowest Line
this script plot/display 4 lines
1) highest difference from moving averages in provided length.
2) lowest difference from moving averages in provided length.
3) ratio of moving average and ohlc4
4) linear regression moving averages of ratio of moving average and ohlc4
How to use this script
1) when ratio line is touch 2 days to highest ratio line means we are consider stock is in overbought levels or linear regression moving average above highest ratio line means overbought.
2) when ratio lines cross below its linear regression moving average then we consider final exit or book profit.
3) when linear regression moving average below lowest ratio line means stock is in oversold.
4) when linear regression moving average below lowest ratio line and linear regression line start rising after fall it means there is change in trend.
5) when linear regression moving average cross above lowest ratio line it means trend is changed and linear regression line turns green.
Regressions
Multi Kernel Regression [ChartPrime]The "Multi Kernel Regression" is a versatile trading indicator that provides graphical interpretations of market trends by using different kernel regression methods. It's beneficial because it smoothes out price data, creating a clearer picture of price movements, and can be tailored according to the user's preference with various options.
What makes this indicator uniquely versatile is the 'Kernel Select' feature, which allows you to choose from a variety of regression kernel types, such as Gaussian, Logistic, Cosine, and many more. In fact, you have 17 options in total, making this an adaptable tool for diverse market contexts.
The bandwidth input parameter directly affects the smoothness of the regression line. While a lower value will make the line more sensitive to price changes by sticking closely to the actual prices, a higher value will smooth out the line even further by placing more emphasis on distant prices.
It's worth noting that the indicator's 'Repaint' function, which re-estimates work according to the most recent data, is not a deficiency or a flaw. Instead, it’s a crucial part of its functionality, updating the regression line with the most recent data, ensuring the indicator measurements remain as accurate as possible. We have however included a non-repaint feature that provides fixed calculations, creating a steady line that does not change once it has been plotted, for a different perspective on market trends.
This indicator also allows you to customize the line color, style, and width, allowing you to seamlessly integrate it into your existing chart setup. With labels indicating potential market turn points, you can stay on top of significant price movements.
Repaint : Enabling this allows the estimator to repaint to maintain accuracy as new data comes in.
Kernel Select : This option allows you to select from an array of kernel types such as Triangular, Gaussian, Logistic, etc. Each kernel has a unique weight function which influences how the regression line is calculated.
Bandwidth : This input, a scalar value, controls the regression line's sensitivity towards the price changes. A lower value makes the regression line more sensitive (closer to price) and higher value makes it smoother.
Source : Here you denote which price the indicator should consider for calculation. Traditionally, this is set as the close price.
Deviation : Adjust this to change the distance of the channel from the regression line. Higher values widen the channel, lower values make it smaller.
Line Style : This provides options to adjust the visual style of the regression lines. Options include Solid, Dotted, and Dashed.
Labels : Enabling this introduces markers at points where the market direction switches. Adjust the label size to suit your preference.
Colors : Customize color schemes for bullish and bearish trends along with the text color to match your chart setup.
Kernel regression, the technique behind the Multi Kernel Regression Indicator, has a rich history rooted in the world of statistical analysis and machine learning.
The origins of kernel regression are linked to the work of Emanuel Parzen in the 1960s. He was a pioneer in the development of nonparametric statistics, a domain where kernel regression plays a critical role. Although originally developed for the field of probability, these methods quickly found application in various other scientific disciplines, notably in econometrics and finance.
Kernel regression became really popular in the 1980s and 1990s along with the rise of other nonparametric techniques, like local regression and spline smoothing. It was during this time that kernel regression methods were extensively studied and widely applied in the fields of machine learning and data science.
What makes the kernel regression ideal for various statistical tasks, including financial market analysis, is its flexibility. Unlike linear regression, which assumes a specific functional form for the relationship between the independent and dependent variables, kernel regression makes no such assumptions. It creates a smooth curve fit to the data, which makes it extremely useful in capturing complex relationships in data.
In the context of stock market analysis, kernel regression techniques came into use in the late 20th century as computational power improved and these techniques could be more easily applied. Since then, they have played a fundamental role in financial market modeling, market prediction, and the development of trading indicators, like the Multi Kernel Regression Indicator.
Today, the use of kernel regression has solidified its place in the world of trading and market analysis, being widely recognized as one of the most effective methods for capturing and visualizing market trends.
The Multi Kernel Regression Indicator is built upon kernel regression, a versatile statistical method pioneered by Emanuel Parzen in the 1960s and subsequently refined for financial market analysis. It provides a robust and flexible approach to capturing complex market data relationships.
This indicator is more than just a charting tool; it reflects the power of computational trading methods, combining statistical robustness with visual versatility. It's an invaluable asset for traders, capturing and interpreting complex market trends while integrating seamlessly into diverse trading scenarios.
In summary, the Multi Kernel Regression Indicator stands as a testament to kernel regression's historic legacy, modern computational power, and contemporary trading insight.
Intraday trading period indicatorI have created this indicator because I was in a need of simple indication of personal session time for my backtesting while practicing intraday Futures trading.
How it works:
1. Define your timezone.
2. Set Trading session start/end time.
3. Choose the colour you want to see your intraday session in.
Actual result: Your selected session is displayed with selected colour and within selected time period. Your are good to go.
It is not perfect for sure but it does what it needs to do and I think it is awesome.
Hope it will be useful for you and let the Profit be with you!
Regression Candle Conversion IndicatorHey everyone!
I got a pseudo-request a while ago for something like this, essentially the ability to track where another ticker would fall based on an alternative ticker.
I did create my ticker correlation reference indicator which directly looks at the correlation between 2 tickers. However, this is an indicator that operates on the same principle but is more pragmatic for trading.
What does it do?
Well, in keeping with the theme of what I call my indicators, this has a title that explains exactly what it does, "Regression Candle Conversion Indicator" or "RCCI" for short. It uses simple regression to convert one ticker to another. So while you are tracking one indicator, you can see where the expected value should fall on the other.
Applications?
The big application of this for me is being able to track where SPY/QQQ or IWM is falling during overnight trading sessions. Extended trading hours close at 8 pm NYSE time. After that, you have to guess where futures prices will put the ETF version of it. This indicator will allow you to track where, theoretically, the underlying ETF ticker will fall based on the current trading behaviour.
Some other applications are just the ability to track how similar or dissimilar one stock is to the other. For example, if we wanted to trade, say, Boeing using shares of DFEN or ITA (a defence specific ETF), here is what we get:
In the chart above we can see BA as the primary chart and ITA as the RCCI converted chart. We will see 2 major things that should cause us concern.
First, there is a really poor correlation between the two tickers. This indicates that ITA may not produce the best exposure if I am directly looking for Boeing exposure.
Second, there is a wide standard error. this means that the results that the RCCI is providing may be skewed up to +/- 2 points (as indicated by the standard error chart).
Let's take a look at BA and DFEN:
In the above, we can see that the correlation is not great, but the standard error is quite low.
This means that, while this may not be the best ticker for Boeing exposure, the RCCI is able to confidently calculate the ticker within +/- 0.50 cents based on BA's underlying data.
However, its important to note that it is not advisable to really rely on these results if the correlation is less than + 0.5 or greater than -0.5.
Let's take a look at a few more examples:
Above we have BA (NYSE) vs BA (NEO TSX CAD Hedged). We can see the strong relationship and high confidence calculations.
And some others:
SPX (primary) and ES1! (secondary):
RTY and IWM:
ES1! and SPY:
Customizations:
As you can see above, it is pretty straight forward. There are 3 options:
Lookback Length: Determines the length of assessment for correlation and the regression assessment.
Manual Ticker Input: The indicator will pull the data from your current chart and compare it against a manually selected indicator. You must tell the indicator which ticker you are comparing against.
Data Table: This will show you the data table which contains the standard error assessment and the correlation assessment. These are determined by your lookback length. The lookback length is defaulted to 500.
And that's the indicator! It's pretty straight forward. Hopefully you find it helpful, especially if you track futures during overnight sessions.
Leave your comments/questions and feedback below.
Thanks for checking it out!
Visible Range Linear Regression Channel [vnhilton](OVERVIEW)
This indicator calculates the linear regression channel for the visible bars shown on the chart instead of the traditional fixed length linear regression channel TradingView provides (and is more accurate I believe). Inspired by TradingView's Linear Regression Channel and Visible Average Price indicator, and the DAS Trader linear regression indicator.
(FEATURES)
- Ability to extend lines to the right
- Show/hide individual lines
- Adjust standard deviation of bands
- Adjust line style and width of basis and band lines
- Change individual line colours and plot fills between the lines
(DIFFERENCES)
If you compare this indicator to TradingView's Linear Regression Channel, you will notice some differences (as of 11th June, 2023). Differences and reasons are:
1) The intercept is wrong. The formula TradingView uses to calculate the intercept includes the addition of the gradient, which I believe is incorrect. Difference #2 is also why the intercept is wrong. This indicator omits that addition. This was verified by comparing the gradient calculated in this indicator with the gradient determined by Excel with the same data.
2) The gradient is "wrong". In quotations as essentially TradingView's code attempts to find the line of best fit, with the y-axis on the most recent bar instead of the oldest bar. This leads to the gradient being the opposite to the gradient found in this indicator, which isn't wrong, but the later formula used to calculate the intercept doesn't take this into account, resulting in an incorrect intercept value. The gradient and intercept values in this indicator matches those found in Excel.
3) Standard deviation bands of both indicators. I believe the code TradingView uses to calculate standard deviation is incorrect (basing this just through visuals). This indicator uses the array.stdev function to find the correct value (verified with Excel numbers).
Trend Finder++ (by Alex L.)This indicator seeks for a short term trend within a bigger long term trend and displays both in a channel with an extension lines (optional).
Use of this indicator is quite simple: when the stock is near the trend line bottom (default RED) it can be a good time to buy and when the stock is near the trend line top (default GREEN) it can be a good time to sell.
What new ideas and cool stuff this indicator offers:
- 'Trend (Months)' -
Trend channels will always be displayed over the period: last 'X' months (regardless of the 'Time Interval' set in your chart)
This allows you to go into a larger or smaller resolution and still see the same trend lines!
- ' Trend (Bars)' -
Optional. You can choose to display the Trend channel based on bars instead of months.
This can be useful for advanced traders, or in case a security is new and there isn't even 1 month of data.
- 'Show long-term trend' -
Optional. Displays a larger 3rd (even more long-term) trend in addition to the two current trends.
This is for advanced traders who want to see an even more bigger picture. It is best viewed on a weekly time interval.
- Customizable channel size, channel colors and channel style.
- 'Extend lines' -
Optional (default: yes). Trend channels' can be displayed with extension or without using this option.
- Internal Feature -
When trend channel goes below zero (can happen if stock's price falls sharply) - its below-zero portion will be drawn as 'extension' instead.
This is useful if such occurs, and we're in an auto-scaled chart - the lines will take less space on screen (for cleaner view).
Based on an idea/indicator by @ DevLucem called "Linear Regression ++"
Open Source.
Enjoy!
Hobbiecode - SP500 IBS + HigherThis is a simple strategy that is working well on SPY but also well performing on Mini Futures SP500. The strategy is composed by the followin rules:
1. Today is Monday.
2. The close must be lower than the close on Friday.
3. The IBS must be below 0.5.
4. If 1-3 are true, then enter at the close.
5. Sell 5 trading days later (at the close).
If you backtest it on Mini Futures SP500 you will be able to track data from 1993. It is important to select D1 as timeframe.
Please share any comment or idea below.
Have a good trading,
Ramón.
Kernel Regression ToolkitThis toolkit provides filters and extra functionality for non-repainting Nadaraya-Watson estimator implementations made by @jdehorty. For the sake of ease I have nicknamed it "kreg". Filters include a smoothing formula and zero lag formula. The purpose of this script is to help traders test, experiment and develop different regression lines. Regression lines are best used as trend lines and can be an invaluable asset for quickly locating first pullbacks and breaks of trends.
Other features include two J lines and a blend line. J lines are featured in tools like Stochastic KDJ. The formula uses the distance between K and D lines to make the J line. The blend line adds the ability to blend two lines together. This can be useful for several tasks including finding a center/median line between two lines or for blending in the characteristics of a different line. Default is set to 50 which is a 50% blend of the two lines. This can be increased and decreased to taste. This tool can be overlaid on the chart or on top of another indicator if you set the source. It can even be moved into its own window to create a unique oscillator based on whatever sources you feed it.
Below are the standard settings for the kernel estimation as documented by @jdehorty:
Lookback Window: The number of bars used for the estimation. This is a sliding value that represents the most recent historical bars. Recommended range: 3-50
Weighting: Relative weighting of time frames. As this value approaches zero, the longer time frames will exert more influence on the estimation. As this value approaches infinity, the behavior of the Rational Quadratic Kernel will become identical to the Gaussian kernel. Recommended range: 0.25-25
Level: Bar index on which to start regression. Controls how tightly fit the kernel estimate is to the data. Smaller values are a tighter fit. Larger values are a looser fit. Recommended range: 2-25
Lag: Lag for crossover detection. Lower values result in earlier crossovers. Recommended range: 1-2
For more information on this technique refer to to the original open source indicator by @jdehorty located here:
Nonlinear Regression, Zero-lag Moving Average [Loxx]Nonlinear Regression and Zero-lag Moving Average
Technical indicators are widely used in financial markets to analyze price data and make informed trading decisions. This indicator presents an implementation of two popular indicators: Nonlinear Regression and Zero-lag Moving Average (ZLMA). Let's explore the functioning of these indicators and discuss their significance in technical analysis.
Nonlinear Regression
The Nonlinear Regression indicator aims to fit a nonlinear curve to a given set of data points. It calculates the best-fit curve by minimizing the sum of squared errors between the actual data points and the predicted values on the curve. The curve is determined by solving a system of equations derived from the data points.
We define a function "nonLinearRegression" that takes two parameters: "src" (the input data series) and "per" (the period over which the regression is calculated). It calculates the coefficients of the nonlinear curve using the least squares method and returns the predicted value for the current period. The nonlinear regression curve provides insights into the overall trend and potential reversals in the price data.
Zero-lag Moving Average (ZLMA)
Moving averages are widely used to smoothen price data and identify trend directions. However, traditional moving averages introduce a lag due to the inclusion of past data. The Zero-lag Moving Average (ZLMA) overcomes this lag by dynamically adjusting the weights of past values, resulting in a more responsive moving average.
We create a function named "zlma" that calculates the ZLMA. It takes two parameters: "src" (the input data series) and "per" (the period over which the ZLMA is calculated). The ZLMA is computed by first calculating a weighted moving average (LWMA) using a linearly decreasing weight scheme. The LWMA is then used to calculate the ZLMA by applying the same weight scheme again. The ZLMA provides a smoother representation of the price data while reducing lag.
Combining Nonlinear Regression and ZLMA
The ZLMA is applied to the input data series using the function "zlma(src, zlmaper)". The ZLMA values are then passed as input to the "nonLinearRegression" function, along with the specified period for nonlinear regression. The output of the nonlinear regression is stored in the variable "out".
To enhance the visual representation of the indicator, colors are assigned based on the relationship between the nonlinear regression value and a signal value (sig) calculated from the previous period's nonlinear regression value. If the current "out" value is greater than the previous "sig" value, the color is set to green; otherwise, it is set to red.
The indicator also includes optional features such as coloring the bars based on the indicator's values and displaying signals for potential long and short positions. The signals are generated based on the crossover and crossunder of the "out" and "sig" values.
Wrapping Up
This indicator combines two important concepts: Nonlinear Regression and Zero-lag Moving Average indicators, which are valuable tools for technical analysis in financial markets. These indicators help traders identify trends, potential reversals, and generate trading signals. By combining the nonlinear regression curve with the zero-lag moving average, this indicator provides a comprehensive view of the price dynamics. Traders can customize the indicator's settings and use it in conjunction with other analysis techniques to make well-informed trading decisions.
Time Series Model IndicatorHello,
I am releasing this time series modelling indicator.
Brief overview of the indicator's functionality:
The Time Series Model indicator is a technical analysis tool that calculates and visualizes a linear regression line based on historical price data. It assesses the trend direction and provides an outer band around the regression line to indicate potential support and resistance levels. The indicator also detects outliers in the price data and calculates correlations between the time variable and the closing price. It offers various customization options such as input length, user-defined hours in advance, display settings for tables and fills, and the ability to show variable correlations. Overall, this indicator aims to help traders identify trends, potential reversals, and price extremes in a given time series.
Specific Functions:
Slope Calculations: The indicator calculates the slope and intercept of the regression line using the specified length of assessment (user defined). It also computes the residuals, standard error of the regression, and the upper and lower bounds of the standard error region. Additionally, it calculates multiple standard deviation bands around the regression line. The slope will change to green if the stock is in an uptrend and to red if the stock is in a downtrend.
Outliers: This feature detects extreme positive and negative outliers based on the z-score calculated from the price data. It highlights the outliers with a red background color to red if this option is selected.
Correlation to Time Assessments: This feature performs trend assessments based on the correlation between time and price data. It identifies uptrends, downtrends, falling trends, rising trends, etc.
Outerband Plots: This feature plots the regression line, standard error bands, and multiple standard deviation bands around the regression line. It also fills the areas between these lines.
Trend Assessment: This feature further assesses the trend based on the strength of the correlation. It identifies strong up or down trends, moderate trends, weak trends, no trend, etc.
Linear Regression Time Data: This section retrieves price data (close, high, low, open) for the specified timeframe and stores them in arrays for a linear regression analysis.
Define LinReg Variables: This section calculates linear regression lines and their upper and lower control limits for the close, low and high prices. It also calculates the correlation between close price and time.
Manual assessments: This feature allows for the manual assessment of time series data. The user can input a look forward for hours in the future and get the predicted price range based on the current time relationship. See image below:
Calculating model "fit": The indicator will display the amount of time the stock closes within and outside its respective bands to ascertain the degree of "fit" (see image below):
Explanations:
The outer cloud: The outer, tealish green cloud represents the regression line + 1.5 standard deviations from the regression line.
The inner cloud: The inner, white coloured cloud represents the immediate time series range calculated through regression of the open, high and low price of the ticker.
Correlations:
The ability of the indicator to calculate correlations on both the smaller and larger timeframes are its strongest feature. You can see the formation of trends by tracking the correlation over the length of the time series model's assessment. You can also track the degree of change. The image below shows the correlation table:
In this image, we can see that the stock is in a moderate downtrend manifested by a correlation of -0.73 (purple arrow).
This downtrend is weakening as manifested by a positive change of 0.05 on the shorter timeframe.
If we scroll down on the table and see the Close, High and Low, we can see that the larger trend over time is a downtrend and that this downtrend is actually strengthening. We know this by the negative change (negative change = significant inverse relationship to time is increasing. i.e. as time increases, the stock price decreases proportionately).
So what does negative correlation to time mean?
If a stock's price exhibits a negative correlation to time, it implies that there is a systematic relationship between the passage of time and the stock's price movement in the opposite direction. This finding could have several potential implications for traders and investors. Firstly, it suggests that the stock's price tends to decrease as time progresses, indicating a downward trend or bearish sentiment. This information might be useful for traders looking to capitalize on short-selling or hedging strategies. Secondly, it could indicate a potential opportunity to predict future price movements based on the timing of negative correlations. By understanding the relationship between time and price, investors may be able to make more informed decisions about when to buy or sell the stock. Lastly, a negative correlation to time may also suggest the influence of external factors or market conditions that systematically impact the stock's performance over time. Therefore, monitoring this correlation can provide insights into broader market dynamics and help investors better understand the stock's behavior.
What about a positive correlation to time?
If a stock's price demonstrates a positive correlation to time, it means that there is a consistent relationship between the passage of time and the stock's price movement in the same direction. This positive correlation to time can have significant implications for traders and investors. Firstly, it indicates a potential upward trend or bullish sentiment, suggesting that the stock's price tends to increase as time progresses. This information can be valuable for investors seeking long-term growth opportunities or looking to capitalize on upward price movements. Secondly, a positive correlation to time may provide insights into the stock's historical performance patterns and help identify potential buying or selling opportunities based on the timing of positive correlations. Additionally, understanding this correlation can aid in assessing the stock's overall trajectory and identifying potential market trends. It's important to note that positive correlation to time does not guarantee future performance, but it can offer valuable information to inform investment decisions.
Because this indicator is pretty big, I have done an overview and tutorial video which I will link below:
As always, please leave your comments and suggestions below.
I thank you for taking the time to read and check out this indicator.
Safe trades everyone and enjoy your weekend!
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.
Auto Trend ProjectionAuto Trend Projection is an indicator designed to automatically project the short-term trend based on historical price data. It utilizes a dynamic calculation method to determine the slope of the linear regression line, which represents the trend direction. The indicator takes into account multiple length inputs and calculates the deviation and Pearson's R values for each length.
Using the highest Pearson's R value, Auto Trend Projection identifies the optimal length for the trend projection. This ensures that the projected trend aligns closely with the historical price data.
The indicator visually displays the projected trend using trendlines. These trendlines extend into the future, providing a visual representation of the potential price movement in the short term. The color and style of the trendlines can be customized according to user preferences.
Auto Trend Projection simplifies the process of trend analysis by automating the projection of short-term trends. Traders and investors can use this indicator to gain insights into potential price movements and make informed trading decisions.
Please note that Auto Trend Projection is not a standalone trading strategy but a tool to assist in trend analysis. It is recommended to combine it with other technical analysis tools and indicators for comprehensive market analysis.
Overall, Auto Trend Projection offers a convenient and automated approach to projecting short-term trends, empowering traders with valuable insights into the potential price direction.
Strongest TrendlineUnleashing the Power of Trendlines with the "Strongest Trendline" Indicator.
Trendlines are an invaluable tool in technical analysis, providing traders with insights into price movements and market trends. The "Strongest Trendline" indicator offers a powerful approach to identifying robust trendlines based on various parameters and technical analysis metrics.
When using the "Strongest Trendline" indicator, it is recommended to utilize a logarithmic scale . This scale accurately represents percentage changes in price, allowing for a more comprehensive visualization of trends. Logarithmic scales highlight the proportional relationship between prices, ensuring that both large and small price movements are given due consideration.
One of the notable advantages of logarithmic scales is their ability to balance price movements on a chart. This prevents larger price changes from dominating the visual representation, providing a more balanced perspective on the overall trend. Logarithmic scales are particularly useful when analyzing assets with significant price fluctuations.
In some cases, traders may need to scroll back on the chart to view the trendlines generated by the "Strongest Trendline" indicator. By scrolling back, traders ensure they have a sufficient historical context to accurately assess the strength and reliability of the trendline. This comprehensive analysis allows for the identification of trendline patterns and correlations between historical price movements and current market conditions.
The "Strongest Trendline" indicator calculates trendlines based on historical data, requiring an adequate number of data points to identify the strongest trend. By scrolling back and considering historical patterns, traders can make more informed trading decisions and identify potential entry or exit points.
When using the "Strongest Trendline" indicator, a higher Pearson's R value signifies a stronger trendline. The closer the Pearson's R value is to 1, the more reliable and robust the trendline is considered to be.
In conclusion, the "Strongest Trendline" indicator offers traders a robust method for identifying trendlines with significant predictive power. By utilizing a logarithmic scale and considering historical data, traders can unleash the full potential of this indicator and gain valuable insights into price trends. Trendlines, when used in conjunction with other technical analysis tools, can help traders make more informed decisions in the dynamic world of financial markets.
MultiMovesCombines 3 different moving averages together with the linear regression. The moving averages are the HMA, EMA, and SMA. The script makes use of two different lengths to allow the end user to utilize common crossovers in order to determine entry into a trade. The edge of each "cloud" is where each of the moving averages actually are. The bar color is the average of the shorter length combined moving averages.
-The Hull Moving Average (HMA), developed by Alan Hull, is an extremely fast and smooth moving average. In fact, the HMA almost eliminates lag altogether and manages to improve smoothing at the same time. A longer period HMA may be used to identify trend.
-The exponential moving average (EMA) is a technical chart indicator that tracks the price of an investment (like a stock or commodity) over time. The EMA is a type of weighted moving average (WMA) that gives more weighting or importance to recent price data.
-A simple moving average (SMA) is an arithmetic moving average calculated by adding recent prices and then dividing that figure by the number of time periods in the calculation average.
-The Linear Regression Indicator plots the ending value of a Linear Regression Line for a specified number of bars; showing, statistically, where the price is expected to be. Instead of plotting an average of past price action, it is plotting where a Linear Regression Line would expect the price to be, making the Linear Regression Indicator more responsive than a moving average.
The lighter colors = default 50 MA
The darker colors = default 200 MA
Cross Period Comparison IndicatorReally excited to be sharing this indicator!
This is the cross-period comparison indicator, AKA the comparison indicator.
What does it do?
The cross-period comparison indicator permits for the qualitative assessment of two points in time on a particular equity.
What is its use?
At first, I was looking for a way to determine the degree of similarity between two points, such as using Cosine similarity values, Euclidean distances, etc. However, these tend to trigger a lot of similarities but without really any context. Context matters in trading and thus what I wanted really was a qualitative assessment tool to see what exactly was happening at two points in time (i.e. How many buyers were there? What was short interest like? What was volume like? What was the volatility like? RSI? Etc.)
This indicator permits that qualitative assessment, displaying things like total buying volume during each period, total selling volume, short interest via Put to Call ratio activity, technical information such as Stochastics and RSI, etc.
How to use it?
The indicator is fairly self explanatory, but some things require a little more in-depth discussion.
The indicator will display the Max and Min technical values of a period, as well as a breakdown in the volume information and put to call information. The user can then make the qualitative determination of degrees of similarity. However, I have included some key things to help ascertain similarity in a more quantitative way. These include:
1. Adding average period Z-Score
2. Adding CDF probability distributions for each respective period
3. Adding Pearson correlations for each respective period over time
4. Providing the linear regression equation for each period
So let us discuss these 4 quantitative measures a bit more in-depth.
Adding Period Z-Score
For those who do not know, Z-Score is a measure of the distance from a mean. It generally spans 0 (at the mean) to 3 (3 standard deviations away from the mean). Z-Score in the stock market is very powerful because it is actually our indicator of volatility. Z-Score forms the basis of IV for option traders and it generally is the go to, to see where the market is in relation to its overall mean.
Adding Z-Score lets the user make 2 big determinations. First and foremost, it’s a measure of overall volatility during the period. If you are getting a Z-Score that is crazy high (1.5 or greater), you know there was a lot of volatility in that period marked by frequent deviations from its mean (since on average it was trading 1.5 standard deviations away from its mean).
The other thing it tells you is the overall sentiment of that time. If the average Z Score was 1.5 for example, we know that buying interest was high and the sentiment was somewhat optimistic, as the stock was trading, on average, + 1.5 SDs away from its mean.
If, on the other hand, the average was, say, - 1.2, then we know the sentiment was overall pessimistic. There was frequent selling and the stock was frequently being pushed below its mean with heavy selling pressure.
We can also check these assumptions of buying / selling buy verifying the volume information. The indicator will list the Buy to Sell Ratio (number of Buyers to Sellers), as well as the total selling volume and total buying volume. Thus, the user can see, objectively, whether sellers or buyers led a particular period.
Adding CDF Probability
CDF probabilities simply mean the extent a stock traded above or below its normal distribution levels.
To help you understand this, the indicator lists the average close price for a period. Directly below that, it lists the CDF probabilities. What this is telling you, is how often and how likely, during that period, the stock was trading below its average. For example, in the main chart, the average close price for BTC in Period A is 29869. The CDF probability is 0.51. This means, during Period A, 51% of the time, BTC was trading BELOW 29869. Thus, the other 49% of the time it was trading ABOVE 29869.
CDF probabilities also help us to assess volatility, similar to Z-Score. Generally speaking, the CDF should consistently be reading about 0.50 to 0.51. This is the point of an average value, half the values should be above the average and half the values should be below. But in times of heightened volatility, you may actually see the CDF creep up to 0.54 or higher, or 0.48 or lower. This means that there was extremely extensive volatility and is very indicative of true “whipsaw” type price action history where a stock refuses to average itself out in one general area and frequently jumps up and down.
Adding Pearson Correlation
Most know what this is, but just in case, the Pearson correlation is a measure of statistical significance. It ranges from 0 (not significant) to 1 (very significant). It can be positive or negative. A positive signifies a positive relationship (i.e. as one value increases so too does the other value being compared). If it is a negative value, it means an inverse relationship (i.e. one value increases proportionately to the other’s decline).
In this indicator, the Pearson correlation is measured against time. A strong positive relationship (a value of 0.5 or greater) indicates that the stock is trading positive to time. As time goes by, the stock goes up. This is a normal relationship and signifies a healthy uptrend.
Inversely, if the Pearson correlation is negative, it means that as time increases, the stock is going down proportionately. This signifies a strong downtrend.
This is another way for the user to interpret sentiment during a specific period.
IF the Pearson correlation is less than 0.5 or -0.5, this signifies an area of indecision. No real trend formed and there was no real strong relationship to time.
Adding Linear Regression Equation
A linear regression equation is simply the slope and the intercept. It is expressed with the formula y= mx + b.
The indicator does a regression analysis on each period and presents this formula accordingly. The user can see the slope and intercept.
Generally speaking, when two periods share the same slope (m value) but different intercept (b value), it can be said that the relationship to time is identical but the starting point is different.
If the slope and intercept are different, as you see in the BTC chart above, it represents a completely different relationship to time and trajectory.
Indicator Specific Information:
The indicator retains the customizability you would expect. You can customize all of your lengths for technical, change and Z-Score. You can toggle on or off Period data, if you want to focus on a single period. You can also toggle on a difference table that directly compares the % difference between Period A to Period B (see image below):
You will also see on the input menu a input for “Threshold” assessments. This simply modifies the threshold parameters for the technical readings. It is defaulted to 3, which means when two technical (for example Max Stochastics) are within +/- 3 of each other, the indicator will light these up as green to indicate similarities. They just clue the user visually to areas where there are similarities amongst the qualitative technical data.
Timeframes
This is best used on the daily timeframe. You can use it on the smaller timeframe but the processing time may take a bit longer. I personally like it for the Daily, Weekly and 4 hour charts.
And this is the indicator in a nutshell!
I will provide a tutorial video in the coming day on how to use it, so check back later!
As always, leave your comments/questions and suggestions below. I have been slowly modifying stuff based on user suggestions so please keep them coming but be patient as it does take some time and I am by no means a coder or expert on this stuff.
Safe trades to all!
Bitcoin Rainbow Logarithmic CurvesThis indicator shows the logarithmic regression curves for BTC and color codes it based on how extended we are from the best fit line (middle).
MACD TrueLevel StrategyThis strategy uses the MACD indicator to determine buy and sell signals. In addition, the strategy employs the use of "TrueLevel Bands," which are essentially envelope bands that are calculated based on the linear regression and standard deviation of the price data over various lengths.
The TrueLevel Bands are calculated for 14 different lengths and are plotted on the chart as lines. The bands are filled with a specified color to make them more visible. The highest upper band and lowest lower band values are stored in variables for easy access.
The user can input the lengths for the TrueLevel Bands and adjust the multiplier for the standard deviation. They can also select the bands they want to use for entry and exit, and enable long and short positions.
The entry conditions for a long position are either a crossover of the MACD line over the signal line or a crossover of the price over the selected entry lower band. The entry conditions for a short position are either a crossunder of the MACD line under the signal line or a crossunder of the price under the selected exit upper band.
The exit conditions for both long and short positions are not specified in the code and are left to the user to define.
Overall, the strategy aims to capture trends by entering long or short positions based on the MACD and TrueLevel Bands, and exiting those positions when the trend reverses.
RSI TrueLevel StrategyThis strategy is a momentum-based strategy that uses the Relative Strength Index (RSI) indicator and a TrueLevel envelope to generate trade signals.
The strategy uses user-defined input parameters to calculate TrueLevel envelopes for 14 different lengths. The TrueLevel envelope is a volatility-based technical indicator that consists of upper and lower bands. The upper band is calculated by adding a multiple of the standard deviation to a linear regression line of the price data, while the lower band is calculated by subtracting a multiple of the standard deviation from the same regression line.
The strategy generates long signals when the RSI crosses above the oversold level or when the price crosses above the selected lower band of the TrueLevel envelope. It generates short signals when the RSI crosses below the overbought level or when the price crosses below the selected upper band of the TrueLevel envelope.
The strategy allows for long and short trades and sets the trade size as a percentage of the account equity. The colors of the bands and fills are also customizable through user-defined input parameters.
In this strategy, the 12th TrueLevel band was chosen due to its ability to capture significant price movements while still providing a reasonable level of noise reduction. The strategy utilizes a total of 14 TrueLevel bands, each with varying lengths. The 12th band, with a length of 2646, strikes a balance between sensitivity to market changes and reducing false signals, making it a suitable choice for this strategy.
RSI Parameters:
In this strategy, the RSI overbought and oversold levels are set at 65 and 40, respectively. These values were chosen to filter out more noise in the market and focus on stronger trends. Traditional RSI overbought and oversold levels are set at 70 and 30, respectively. By raising the oversold level and lowering the overbought level, the strategy aims to identify more significant trend reversals and potential trade opportunities.
Of course, the parameters can be adjusted to suit individual preferences.
Trend forecasting by c00l75----------- ITALIANO -----------
Questo codice è uno script di previsione del trend creato solo a scopo didattico. Utilizza una media mobile esponenziale (EMA) e una media mobile di Hull (HMA) per calcolare il trend attuale e prevedere il trend futuro. Il codice utilizza anche una regressione lineare per calcolare il trend attuale e un fattore di smorzamento per regolare l’effetto della regressione lineare sulla previsione del trend. Infine il codice disegna due linee tratteggiate per mostrare la previsione del trend per i periodi futuri specificati dall’utente. Se ti piace l'idea mettimi un boost e lascia un commento!
----------- ENGLISH -----------
This code is a trend forecasting script created for educational purposes only. It uses an exponential moving average (EMA) and a Hull moving average (HMA) to calculate the current trend and forecast the future trend. The code also uses a linear regression to calculate the current trend and a damping factor to adjust the effect of the linear regression on the trend prediction. Finally, the code draws two dashed lines to show the trend prediction for future periods specified by the user. If you like the idea please put a boost and leave a comment!
RSI and Stochastic Probability Based Price Target IndicatorHello,
Releasing this beta indicator. It is somewhat experimental but I have had some good success with it so I figured I would share it!
What is it?
This is an indicator that combines RSI and Stochastics with probability levels.
How it works?
This works by applying a regression based analysis on both Stochastics and RSI to attempt to predict a likely close price of the stock.
It also assess the normal distribution range the stock is trading in. With this information it does the following:
2 lines are plotted:
Yellow line: This is the stochastic line. This represents the smoothed version of the stochastic price prediction of the most likely close price.
White Line: This is the RSI line. It represents the smoothed version of the RSI price prediction of the most likely close price.
When the Yellow Line (Stochastic Line) crosses over the White Line (the RSI line), this is a bearish indication. It will signal a bearish cross (red arrow) to signal that some selling or pullback may follow.
IF this bearish cross happens while the stock is trading in a low probability upper zone (anything 13% or less), it will trigger a label to print with a pullback price. The pullback price is the "regression to the mean" assumption price. Its the current mean at the time of the bearish cross.
The inverse is true if it is a bullish cross. If the stock has a bullish cross and is trading in a low probability bearish range, it will print the price target for a regression back to the upward mean.
Additional information:
The indicator also provides a data table. This data table provides you with the current probability range (i.e. whether the stock is trading in the 68% probability zone or the outer 13, 2.1 or 0.1 probability zones), as well as the overall probability of a move up or down.
It also provides the next bull and bear targets. These are calculated based on the next probability zone located immediately above and below the current trading zone of the stock.
Smoothing vs Non-smoothed data:
For those who like to assess RSI and Stochastic for divergences, there is an option in the indicator to un-smooth the stochastic and RSI lines. Doing so looks like this:
Un-smoothing the RSI and stochastic will not affect the analysis or price targets. However it does add some noise to the chart and makes it slightly difficult to check for crosses. But whatever your preference is you can use.
Cross Indicators :
A bearish cross (stochastic crosses above RSI line) is signalled with a red arrow down shape.
A bullish cross (RSI crosses above stochastic line) is signalled with a green arrow up shape.
Labels vs Arrows:
The arrows are lax in their signalling. They will signal at any cross. Thus you are inclined to get false signals.
The labels are programmed to only trigger on high probability setups.
Please keep this in mind when using the indicator!
Warning and disclaimer:
As with all indicators, no indicator is 100% perfect.
This will not replace the need for solid analysis, risk management and planning.
This is also kind of beta in its approach. As such, there are no real rules on how it should be or can be applied rigorously. Thus, its important to exercise caution and not rely on this alone. Do your due diligence before using or applying this indicator to your trading regimen.
As it is kind of different, I am interested in hearing your feedback and experience using it. Let me know your feedback, experiences and suggestions below.
Also, because it does have a lot of moving parts, I have done a tutorial video on its use linked below:
Thanks for checking it out, safe trades everyone and take care!
Trading pirate 2Trading Pirate Regression Candles. This turns regular candle sticks into regression candles. Colors are Gray and Red.
BTC Log High/Low ChartThis indicator calculates the logarithmic values of the high and low prices of BTC based on a mathematical formula and plots them on the chart. The code uses the current time and width of the chart to calculate the logarithmic values of the high and low prices. It defines functions to convert a timestamp to the number of days since January 1st, 2009.
You can use it with BTC Log High/Low:
Correlation AnalysisAs the name suggests, this indicator is a market correlation analysis tool.
It contains two main features:
- The Curve: represents the historic correlation coefficient between the current chart and the “Reference Market” input from the settings menu. It aims to give more depth to the current correlation values found in the second feature.
- The Screener: this second feature displays all correlation coefficient values between the (max) 20 markets inputs. You can use it to create several screeners for several market types (crypto, forex, metals, etc.) or even replicate your current portfolio of investments and gauge the correlation of its components.
Aside from these two previous features, you can visually plot the variation rate from one bar to another along with the covariance coefficient (both used in the correlation calculation). Finally, a simple “signal” moving average can be applied to the correlation coefficient .
I might add alerts to this script or even turn it into a strategy to do some backtesting. Do not hesitate to contact me or comment below if this is something you would be interested in or if you have any suggestions for improvement.
Enjoy!!