Lyapunov Hodrick-Prescott Oscillator w/ DSL [Loxx]Lyapunov Hodrick-Prescott Oscillator w/ DSL is a Hodrick-Prescott Channel Filter that is modified using the Lyapunov stability algorithm to turn the filter into an oscillator. Signals are created using Discontinued Signal Lines.
What is the Lyapunov Stability?
As soon as scientists realized that the evolution of physical systems can be described in terms of mathematical equations, the stability of the various dynamical regimes was recognized as a matter of primary importance. The interest for this question was not only motivated by general curiosity, but also by the need to know, in the XIX century, to what extent the behavior of suitable mechanical devices remains unchanged, once their configuration has been perturbed. As a result, illustrious scientists such as Lagrange, Poisson, Maxwell and others deeply thought about ways of quantifying the stability both in general and specific contexts. The first exact definition of stability was given by the Russian mathematician Aleksandr Lyapunov who addressed the problem in his PhD Thesis in 1892, where he introduced two methods, the first of which is based on the linearization of the equations of motion and has originated what has later been termed Lyapunov exponents (LE). (Lyapunov 1992)
The interest in it suddenly skyrocketed during the Cold War period when the so-called "Second Method of Lyapunov" (see below) was found to be applicable to the stability of aerospace guidance systems which typically contain strong nonlinearities not treatable by other methods. A large number of publications appeared then and since in the control and systems literature. More recently the concept of the Lyapunov exponent (related to Lyapunov's First Method of discussing stability) has received wide interest in connection with chaos theory . Lyapunov stability methods have also been applied to finding equilibrium solutions in traffic assignment problems.
In practice, Lyapunov exponents can be computed by exploiting the natural tendency of an n-dimensional volume to align along the n most expanding subspace. From the expansion rate of an n-dimensional volume, one obtains the sum of the n largest Lyapunov exponents. Altogether, the procedure requires evolving n linearly independent perturbations and one is faced with the problem that all vectors tend to align along the same direction. However, as shown in the late '70s, this numerical instability can be counterbalanced by orthonormalizing the vectors with the help of the Gram-Schmidt procedure (Benettin et al. 1980, Shimada and Nagashima 1979) (or, equivalently with a QR decomposition). As a result, the LE λi, naturally ordered from the largest to the most negative one, can be computed: they are altogether referred to as the Lyapunov spectrum.
The Lyapunov exponent "λ" , is useful for distinguishing among the various types of orbits. It works for discrete as well as continuous systems.
λ < 0
The orbit attracts to a stable fixed point or stable periodic orbit. Negative Lyapunov exponents are characteristic of dissipative or non-conservative systems (the damped harmonic oscillator for instance). Such systems exhibit asymptotic stability; the more negative the exponent, the greater the stability. Superstable fixed points and superstable periodic points have a Lyapunov exponent of λ = −∞. This is something akin to a critically damped oscillator in that the system heads towards its equilibrium point as quickly as possible.
λ = 0
The orbit is a neutral fixed point (or an eventually fixed point). A Lyapunov exponent of zero indicates that the system is in some sort of steady state mode. A physical system with this exponent is conservative. Such systems exhibit Lyapunov stability. Take the case of two identical simple harmonic oscillators with different amplitudes. Because the frequency is independent of the amplitude, a phase portrait of the two oscillators would be a pair of concentric circles. The orbits in this situation would maintain a constant separation, like two flecks of dust fixed in place on a rotating record.
λ > 0
The orbit is unstable and chaotic. Nearby points, no matter how close, will diverge to any arbitrary separation. All neighborhoods in the phase space will eventually be visited. These points are said to be unstable. For a discrete system, the orbits will look like snow on a television set. This does not preclude any organization as a pattern may emerge. Thus the snow may be a bit lumpy. For a continuous system, the phase space would be a tangled sea of wavy lines like a pot of spaghetti. A physical example can be found in Brownian motion. Although the system is deterministic, there is no order to the orbit that ensues.
For our purposes here, we transform the HP by applying Lyapunov Stability as follows:
output = math.log(math.abs(HP / HP ))
You can read more about Lyapunov Stability here: Measuring Chaos
What is. the Hodrick-Prescott Filter?
The Hodrick-Prescott (HP) filter refers to a data-smoothing technique. The HP filter is commonly applied during analysis to remove short-term fluctuations associated with the business cycle. Removal of these short-term fluctuations reveals long-term trends.
The Hodrick-Prescott (HP) filter is a tool commonly used in macroeconomics. It is named after economists Robert Hodrick and Edward Prescott who first popularized this filter in economics in the 1990s. Hodrick was an economist who specialized in international finance. Prescott won the Nobel Memorial Prize, sharing it with another economist for their research in macroeconomics.
This filter determines the long-term trend of a time series by discounting the importance of short-term price fluctuations. In practice, the filter is used to smooth and detrend the Conference Board's Help Wanted Index (HWI) so it can be benchmarked against the Bureau of Labor Statistic's (BLS) JOLTS, an economic data series that may more accurately measure job vacancies in the U.S.
The HP filter is one of the most widely used tools in macroeconomic analysis. It tends to have favorable results if the noise is distributed normally, and when the analysis being conducted is historical.
What are DSL Discontinued Signal Line?
A lot of indicators are using signal lines in order to determine the trend (or some desired state of the indicator) easier. The idea of the signal line is easy : comparing the value to it's smoothed (slightly lagging) state, the idea of current momentum/state is made.
Discontinued signal line is inheriting that simple signal line idea and it is extending it : instead of having one signal line, more lines depending on the current value of the indicator.
"Signal" line is calculated the following way :
When a certain level is crossed into the desired direction, the EMA of that value is calculated for the desired signal line
When that level is crossed into the opposite direction, the previous "signal" line value is simply "inherited" and it becomes a kind of a level
This way it becomes a combination of signal lines and levels that are trying to combine both the good from both methods.
In simple terms, DSL uses the concept of a signal line and betters it by inheriting the previous signal line's value & makes it a level.
Included:
Bar coloring
Alerts
Signals
Loxx's Expanded Source Types
M-oscillator
SuperTrend Momentum TableMy goal creating this indicator : Provide a way to see the Past and Current Momentum of multiple different timeframes without using multiple charts.
The Underlying Concept / What is Momentum?
The Momentum shown is derived from a Mathematical Formula, SUPERTREND. When price closes above Supertrend Its bullish Momentum when its below Supertrend its Bearish Momentum.This indicator scans for bullish & bearish Momentum on the Timeframes selected by the user and when there is a shift in momentum on any of those time frames (price closes below or above SUPERTREND ) it notifies the trader with a color change on the Momentum Table.
Back Testing: This indicator will be key for back testing with the SuperTrend-Support-Resistance indicator
since the SuperTrend Momentum Table shows you the visual shift in momentum. Giving the Trader a Clear visual on how Each Support and Resistance Level was made .
Technical Inputs
- If you want to optimize the rate of signals to better fit your trading plan you would change the Factor input and ATR Length input. Increase factor and ATR Length to decrease the frequency of signals and decrease the Factor and ATR Length to increase the frequency of signals.
Quick TIP! : You can Sync all VFX SuperTrend Indicators together! All VFX SuperTrend indicators display unique information but its all derived from that same Momentum Formula. Keep the Factor input and ATR Length the same on other VFX SuperTrend indicators to have them operating on the same data.
Timeframe Inputs
- The indicator has 7 Time frame Displays where you can choose which Time Frames you would like to monitor.
- You can limit the amount of time frames being displayed by changing the Time Frame Amount
Display Inputs
- The trader can specify the bullish and bearish color of all 7 Timeframes
- You can toggle (on or off) the Momentum Switch if you want to highlight the exact candle where momentum switched from bullish to bearish and from bearish to bullish .
How it can be Used ? Check the momentum of other Timeframes and use that information as a variable to structure your trading plan.
- Use Momentum information to track the trend
- Plan and limit trades based on the current Momentum of multiple timeframes
- See if you have higher momentum to fuel your trades
- See breakouts on Multiple Time Frames
KERPD Noise Filter - Kaufman Efficiency Ratio and Price DensityThis indicator combines Kaufman Efficiency Ratio (KER) and Price Density theories to create a unique market noise filter that is 'right on time' compared to using KER or Price Density alone. All data is normalized and merged into a single output. Additionally, this indicator provides the ability to consider background noise and background noise buoyancy to allow dynamic observation of noise level and asset specific calibration of the indicator (if desired).
The basic theory surrounding usage is that: higher values = lower noise, while lower values = higher noise in market.
Notes: NON-DIRECTIONAL Kaufman Efficiency Ratio used. Threshold period of 30 to 40 applies to Kaufman Efficiency Ratio systems if standard length of 20 is applied; maintained despite incorporation of Price Density normalized data.
TRADING USES:
-Trend strategies, mean reversion/reversal/contrarian strategies, and identification/avoidance of ranging market conditions.
-Trend strategy where KERPD is above a certain value; generally a trend is forming/continuing as noise levels fall in the market.
-Mean reversion/reversal/contrarian strategies when KERPD exits a trending condition and falls below a certain value (additional signal confluence confirming for a strong reversal in price required); generally a reversal is forming as noise levels increase in the market.
-A filter to screen out ranging/choppy conditions where breakouts are frequently fake-outs and or price fails to move significantly; noise level is high, in addition to the background buoyancy level.
-In an adaptive trading systems to assist in determining whether to apply a trend following algorithm or a mean reversion algorithm.
THEORY / THOUGHT SPACE:
The market is a jungle. When apex predators are present it often goes quiet (institutions moving price), when absent the jungle is loud.
There is always background noise that scales with the anticipation of the silence, which has features of buoyancy that act to calibrate the beginning of the silence and return to background noise conditions.
Trend traders hunt in low noise conditions. Reversion traders hunt in the onset of low noise into static conditions. Ranges can be avoided during high noise and buoyant background noise conditions.
Distance between the noise line and background noise can help inform decision making.
CALIBRATION:
- Set the Noise Threshold % color change line so that the color cut off is where your trend/reversion should begin.
- Set the Background Noise Buoyancy Calibration Decimal % to match the beginning/end of the color change Noise Threshold % line. Match the Background Noise Baseline Decimal %' to the number set for buoyancy.
- Additionally, create your own custom settings; 33/34 and 50 length also provides interesting results.
- A color change tape option can be enabled by un-commenting the lines at the bottom of this script.
Market Usage:
Stock, Crypto, Forex, and Others
Excellent for: NDQ, J225, US30, SPX
Market Conditions:
Trend, Reversal, Ranging
Leavitt Convolution Slope [CC]The Leavitt Convolution Slope indicator was created by Jay Leavitt (Stocks and Commodities Oct 2019, page 11), who is most well known for creating the Volume-Weighted Average Price indicator. This indicator is very similar to the Leavitt Convolution indicator but the big difference is that it is getting the slope instead of predicting the next Convolution value. I changed quite a few things from the original source code so let me know if you like these changes. I added a normalization function using code from a good friend @loxx that I recommend to leave on but feel free to experiment with it. Last but not least, the unsure levels are essentially acting as a buy or sell threshold. I personally recommend to buy or sell for zero crossovers but another option would be to buy or sell for crossovers using the unsure levels. I have color coded the lines to turn light green for a normal buy signal or dark green for a strong buy signal and light red for a normal sell signal, and dark red for a strong sell signal.
This is another indicator in a series that I'm publishing to fulfill a special request from @ashok1961 so let me know if you ever have any special requests for me.
Softmax Normalized T3 Histogram [Loxx]Softmax Normalized T3 Histogram is a T3 moving average that is morphed into a normalized oscillator from -1 to 1.
What is the Softmax function?
The softmax function, also known as softargmax: or normalized exponential function, converts a vector of K real numbers into a probability distribution of K possible outcomes. It is a generalization of the logistic function to multiple dimensions, and used in multinomial logistic regression. The softmax function is often used as the last activation function of a neural network to normalize the output of a network to a probability distribution over predicted output classes, based on Luce's choice axiom.
What is the T3 moving average?
Better Moving Averages Tim Tillson
November 1, 1998
Tim Tillson is a software project manager at Hewlett-Packard, with degrees in Mathematics and Computer Science. He has privately traded options and equities for 15 years.
Introduction
"Digital filtering includes the process of smoothing, predicting, differentiating, integrating, separation of signals, and removal of noise from a signal. Thus many people who do such things are actually using digital filters without realizing that they are; being unacquainted with the theory, they neither understand what they have done nor the possibilities of what they might have done."
This quote from R. W. Hamming applies to the vast majority of indicators in technical analysis . Moving averages, be they simple, weighted, or exponential, are lowpass filters; low frequency components in the signal pass through with little attenuation, while high frequencies are severely reduced.
"Oscillator" type indicators (such as MACD , Momentum, Relative Strength Index ) are another type of digital filter called a differentiator.
Tushar Chande has observed that many popular oscillators are highly correlated, which is sensible because they are trying to measure the rate of change of the underlying time series, i.e., are trying to be the first and second derivatives we all learned about in Calculus.
We use moving averages (lowpass filters) in technical analysis to remove the random noise from a time series, to discern the underlying trend or to determine prices at which we will take action. A perfect moving average would have two attributes:
It would be smooth, not sensitive to random noise in the underlying time series. Another way of saying this is that its derivative would not spuriously alternate between positive and negative values.
It would not lag behind the time series it is computed from. Lag, of course, produces late buy or sell signals that kill profits.
The only way one can compute a perfect moving average is to have knowledge of the future, and if we had that, we would buy one lottery ticket a week rather than trade!
Having said this, we can still improve on the conventional simple, weighted, or exponential moving averages. Here's how:
Two Interesting Moving Averages
We will examine two benchmark moving averages based on Linear Regression analysis.
In both cases, a Linear Regression line of length n is fitted to price data.
I call the first moving average ILRS, which stands for Integral of Linear Regression Slope. One simply integrates the slope of a linear regression line as it is successively fitted in a moving window of length n across the data, with the constant of integration being a simple moving average of the first n points. Put another way, the derivative of ILRS is the linear regression slope. Note that ILRS is not the same as a SMA ( simple moving average ) of length n, which is actually the midpoint of the linear regression line as it moves across the data.
We can measure the lag of moving averages with respect to a linear trend by computing how they behave when the input is a line with unit slope. Both SMA (n) and ILRS(n) have lag of n/2, but ILRS is much smoother than SMA .
Our second benchmark moving average is well known, called EPMA or End Point Moving Average. It is the endpoint of the linear regression line of length n as it is fitted across the data. EPMA hugs the data more closely than a simple or exponential moving average of the same length. The price we pay for this is that it is much noisier (less smooth) than ILRS, and it also has the annoying property that it overshoots the data when linear trends are present.
However, EPMA has a lag of 0 with respect to linear input! This makes sense because a linear regression line will fit linear input perfectly, and the endpoint of the LR line will be on the input line.
These two moving averages frame the tradeoffs that we are facing. On one extreme we have ILRS, which is very smooth and has considerable phase lag. EPMA has 0 phase lag, but is too noisy and overshoots. We would like to construct a better moving average which is as smooth as ILRS, but runs closer to where EPMA lies, without the overshoot.
A easy way to attempt this is to split the difference, i.e. use (ILRS(n)+EPMA(n))/2. This will give us a moving average (call it IE /2) which runs in between the two, has phase lag of n/4 but still inherits considerable noise from EPMA. IE /2 is inspirational, however. Can we build something that is comparable, but smoother? Figure 1 shows ILRS, EPMA, and IE /2.
Filter Techniques
Any thoughtful student of filter theory (or resolute experimenter) will have noticed that you can improve the smoothness of a filter by running it through itself multiple times, at the cost of increasing phase lag.
There is a complementary technique (called twicing by J.W. Tukey) which can be used to improve phase lag. If L stands for the operation of running data through a low pass filter, then twicing can be described by:
L' = L(time series) + L(time series - L(time series))
That is, we add a moving average of the difference between the input and the moving average to the moving average. This is algebraically equivalent to:
2L-L(L)
This is the Double Exponential Moving Average or DEMA , popularized by Patrick Mulloy in TASAC (January/February 1994).
In our taxonomy, DEMA has some phase lag (although it exponentially approaches 0) and is somewhat noisy, comparable to IE /2 indicator.
We will use these two techniques to construct our better moving average, after we explore the first one a little more closely.
Fixing Overshoot
An n-day EMA has smoothing constant alpha=2/(n+1) and a lag of (n-1)/2.
Thus EMA (3) has lag 1, and EMA (11) has lag 5. Figure 2 shows that, if I am willing to incur 5 days of lag, I get a smoother moving average if I run EMA (3) through itself 5 times than if I just take EMA (11) once.
This suggests that if EPMA and DEMA have 0 or low lag, why not run fast versions (eg DEMA (3)) through themselves many times to achieve a smooth result? The problem is that multiple runs though these filters increase their tendency to overshoot the data, giving an unusable result. This is because the amplitude response of DEMA and EPMA is greater than 1 at certain frequencies, giving a gain of much greater than 1 at these frequencies when run though themselves multiple times. Figure 3 shows DEMA (7) and EPMA(7) run through themselves 3 times. DEMA^3 has serious overshoot, and EPMA^3 is terrible.
The solution to the overshoot problem is to recall what we are doing with twicing:
DEMA (n) = EMA (n) + EMA (time series - EMA (n))
The second term is adding, in effect, a smooth version of the derivative to the EMA to achieve DEMA . The derivative term determines how hot the moving average's response to linear trends will be. We need to simply turn down the volume to achieve our basic building block:
EMA (n) + EMA (time series - EMA (n))*.7;
This is algebraically the same as:
EMA (n)*1.7-EMA( EMA (n))*.7;
I have chosen .7 as my volume factor, but the general formula (which I call "Generalized Dema") is:
GD (n,v) = EMA (n)*(1+v)-EMA( EMA (n))*v,
Where v ranges between 0 and 1. When v=0, GD is just an EMA , and when v=1, GD is DEMA . In between, GD is a cooler DEMA . By using a value for v less than 1 (I like .7), we cure the multiple DEMA overshoot problem, at the cost of accepting some additional phase delay. Now we can run GD through itself multiple times to define a new, smoother moving average T3 that does not overshoot the data:
T3(n) = GD ( GD ( GD (n)))
In filter theory parlance, T3 is a six-pole non-linear Kalman filter. Kalman filters are ones which use the error (in this case (time series - EMA (n)) to correct themselves. In Technical Analysis , these are called Adaptive Moving Averages; they track the time series more aggressively when it is making large moves.
Included:
Bar coloring
Signals
Alerts
Loxx's Expanded Source Types
Squeeze Index [LuxAlgo]The Squeeze Index aims to measure the action of price being squeezed, and is expressed as a percentage, with higher values suggesting prices are subject to a higher degree of compression.
Settings
Convergence Factor: Convergence factor of exponential envelopes.
Length: Period of the indicator.
Src: Source input of the indicator.
Usage
Prices being squeezed refer to the action of price being compressed within a tightening area. Prices in a tight area logically indicate a period of stationarity, price breaking out of this area will generally indicate the trader whether to buy or sell depending on the breakout direction.
The convergence factor and length settings both play an important role in the returned indicator values. A convergence factor greater than the period value will detect more squeezed prices area, while a period greater than the convergence will return fewer detected squeezed areas.
We recommend using a convergence factor equal to the period setting or a convergence factor twice as high.
The above chart makes use of a convergence factor of 100 and a period of 10.
Due to the calculation method, it is possible to see retracements being interpreted as price squeezing. This effect can be emphasized with higher convergence factor values.
Details
In order to measure the effect of price being squeezed in a tighter area we refer to damping, where the oscillations amplitude of a system decrease over time. If the envelopes of a damped system can be estimated, then getting the difference between the upper and lower extremity of these envelopes would return a decreasing series of values.
This approach is used here. First the difference between the exponential envelopes extremities is obtained, the logarithm of this difference if obtained due to the extremities converging exponentially toward their input.
We then use the correlation oscillator to get a scaled measurement.
End-pointed SSA of Williams %R [Loxx]End-pointed SSA of Williams %R is an indicator that runes Williams %R SSA calculation through a Singular Spectrum Analysis (SSA) algorithm to derive a smoother final output. The reduction in noise from the traditional Williams %R is significant.
What is Williams %R?
Williams %R , also known as the Williams Percent Range, is a type of momentum indicator that moves between 0 and -100 and measures overbought and oversold levels. The Williams %R may be used to find entry and exit points in the market. The indicator is very similar to the Stochastic oscillator and is used in the same way. It was developed by Larry Williams and it compares a stock’s closing price to the high-low range over a specific period, typically 14 days or periods.
What is Singular Spectrum Analysis ( SSA )?
Singular spectrum analysis ( SSA ) is a technique of time series analysis and forecasting. It combines elements of classical time series analysis, multivariate statistics, multivariate geometry, dynamical systems and signal processing. SSA aims at decomposing the original series into a sum of a small number of interpretable components such as a slowly varying trend, oscillatory components and a ‘structureless’ noise. It is based on the singular value decomposition ( SVD ) of a specific matrix constructed upon the time series. Neither a parametric model nor stationarity-type conditions have to be assumed for the time series. This makes SSA a model-free method and hence enables SSA to have a very wide range of applicability.
For our purposes here, we are only concerned with the "Caterpillar" SSA . This methodology was developed in the former Soviet Union independently (the ‘iron curtain effect’) of the mainstream SSA . The main difference between the main-stream SSA and the "Caterpillar" SSA is not in the algorithmic details but rather in the assumptions and in the emphasis in the study of SSA properties. To apply the mainstream SSA , one often needs to assume some kind of stationarity of the time series and think in terms of the "signal plus noise" model (where the noise is often assumed to be ‘red’). In the "Caterpillar" SSA , the main methodological stress is on separability (of one component of the series from another one) and neither the assumption of stationarity nor the model in the form "signal plus noise" are required.
"Caterpillar" SSA
The basic "Caterpillar" SSA algorithm for analyzing one-dimensional time series consists of:
Transformation of the one-dimensional time series to the trajectory matrix by means of a delay procedure (this gives the name to the whole technique);
Singular Value Decomposition of the trajectory matrix;
Reconstruction of the original time series based on a number of selected eigenvectors.
This decomposition initializes forecasting procedures for both the original time series and its components. The method can be naturally extended to multidimensional time series and to image processing.
The method is a powerful and useful tool of time series analysis in meteorology, hydrology, geophysics, climatology and, according to our experience, in economics, biology, physics, medicine and other sciences; that is, where short and long, one-dimensional and multidimensional, stationary and non-stationary, almost deterministic and noisy time series are to be analyzed.
Included:
Bar coloring
[*Alerts
[*Signals
[*Loxx's Expanded Source Types
Related Williams %R Indicators
Williams %R on Chart w/ Dynamic Zones
Williams %R w/ Bollinger Bands
Intermediate Williams %R w/ Discontinued Signal Lines
Related SSA Indicators
End-pointed SSA of FDASMA
End-pointed SSA of Normalized Price Oscillator
Bull/Bear Candle % Oscillator█ OVERVIEW
This script determines the proportion of bullish and bearish candles in a given sample size. It will produce an oscillator that fluctuates between 100 and -100, where values > 0 indicate more bullish candles in the sample and values < 0 indicate more bearish candles in the sample. Data produced by this oscillator is normalized around the 50% value, meaning that an even 50/50 split between bullish and bearish candles makes this oscillator produce 0; this oscillator indirectly represents the percent proportion of bullish and bearish candles in the sample (see HOW TO USE/INTERPRETATION OF DATA ).
It has two overarching settings: 'classic' and 'range'.
█ CONCEPTS
This script will cover concepts related to candlestick analysis, volumetric analysis, and lower timeframes.
Candlestick Analysis - The idea behind this script is to solely look at the candlesticks themselves and derive information from them in a given sample. It separates candles into two categories, bullish (close > open) and bearish (close < open).
If the indicator's setting is set to 'classic', the size of candles do not matter and all are assigned a value of 1 or 0.
If the indicator's setting is set to 'range', specific candle ranges modify the proportion of bullish/bearish values. Bullish candle values include all bullish candles in the set from their lows to the close, plus the lower wicks of all bearish candles. Bearish candle values include all bearish candles in the set from their highs to the close, plus the upper wicks of all bullish candles.
Volumetric Analysis - One of this script's features allows the user to modify the bullish and bearish candle proportions by its 'weight' determined by its volume compared to the sample set's total volume. Volumetric analysis for the 'range' setting are more complex than 'classic' as described below.
Lower Timeframes - For volumetric analysis to be done on candle wicks, there needed to be a way to determine how much volume had occurred in the wick by itself to find the weight of upper and lower wicks. To accomplish this, I employed PineScrypt's request.security_lower_tf function to grab OHLC values of lower timeframe candles (as well as volume) to determine how much volume had occurred in the wicks of the chart resolution's candle. The default OHLC values used here are the lows for upper wicks and highs for lower wicks. These OHLC values are then compared to the chart resolution candle's close to determine if the volume of that lower timeframe candle should be shifted to the wick weight or stay in the current weight of that candle. The reason 'low' and 'high' are used here is to guarantee that 100% of the volume of a lower timeframe candle had occurred in the wick of the candle at the current resolution (see LIMITATIONS ).
Bullish candles will exclude volume of all lower timeframe candles whose lows were greater than that candle's close. Bearish candles will exclude volume of all lower timeframe candles whose highs were less than that candle's close. These wick volumes are then divided by the volume of the sample set, and wick sizes are then multiplied by this weight before being added to their specific bullish/bearish sums (lower wicks to bullish and upper wicks to bearish).
█ FEATURES
There are 13 inputs for the user to modify the behavior/visual representation of this script.
Sample Length - This determines how many candles are in the sample set to find the proportion of bullish and bearish candles.
Colors and Invert Colors - There are three colors set by the user: a bullish color, neutral color, and bearish color. The oscillator plots two lines, one at 0 and another that represents the proportion of bullish or bearish candles in the sample set (we'll call this the 'signal line'). If the oscillator is above 0, bullish color is used, bearish otherwise. This script generates a gradient to color a filled area between the 0 line and the signal line based on the historical values of the oscillator itself and the signal line. For bullish values, the closer the signal line is to the max (or restricted max described below) that the oscillator has experienced, the more colored toward bullish color the shaded area will be, using the neutral color as a starting point. The same is applied to the bearish values using the bearish color.
There is an additional input to invert the colors so that the bearish color is associated with bullish values and vise-versa.
Calculation Type - This determines the overarching behavior of the oscillator and has two settings:
Classic - The weight of candles are either 1 if they occurred and 0 if not.
Range - The weight of candles is determined by the size of specific sections as described in CONCEPTS - Candlestick Analysis .
Volume Weighted - This enables modifying the weights of candles as described in CONCEPTS - Volumetric Analysis and Lower Timeframes based on which Calculation Type is used.
Wick Slice Resolution - This is the lower timeframe resolution that will be used to slice the chart resolution's candle when determining the volumetric weight of wicks. Lower timeframe resolutions like '1 minute' will yield more precise results as they will give more data points to go off of (see LIMITATIONS ).
Upper/Lower Wick Source - These two inputs allow the user to select which OHLC values to compare against the chart resolution's candle close when determining which lower timeframe candles will have their volumes associated with the wicks of candles being analyzed at the chart's resolution.
Restrict Min/Max Data and Restriction - This will restrict the maximum and minimum values that will be used for the signal line when comparing its value to previous oscillator values and change how the color gradient is generated for the indicator. Restriction is the number of candles back that will determine these maximum and minimum values.
Display Min/Max Guide - This will plot two lines that are colored the corresponding bullish and bearish colors which follow what the maximum and minimum values are currently for the oscillator.
█ HOW TO USE/INTERPRETATION OF DATA
As mentioned in the OVERVIEW section, this oscillator provides an indirect representation of the percent proportion of bullish or bearish candles in a given sample. If the oscillator reads 80, this does not mean that 80% of all candles in the sample were bullish . To find the percentage of candles that were bullish or bearish, the user needs to perform the following:
50% + ((|oscillator value| / 100) * 50)%
If the oscillator value is negative, the value from above will represent the percentage of bearish candles in the sample. If it is positive, this value represents the percentage of bullish candles in the sample.
Example 1 (oscillator value = 80):
50% + ((|80| / 100) * 50)%
50% + ((0.80) * 50)%
50% + 40% = 90%
90% of the candles in the sample were bullish.
Example 2 (oscillator value = -43):
50% + ((|-43| / 100) * 50)%
50% + ((0.43) * 50)%
50% + 21.5% = 71.5%
71.5% of the candles in the sample were bearish.
An example use of this indicator would be to put in a 'buy' order when its value shows a significant proportion of the sampled candles were bearish, and put in a 'sell' order when a significant proportion of candles were bullish. Potential divergences of this oscillator may also be used to plan trades accordingly such as bearish divergence - price continues higher as the oscillator decreases in value and vise-versa.*
* Nothing in this script constitutes any form of financial advice. The user is solely responsible for their trading decisions and I will not be held liable for any losses or gains incurred with the use of this script. Please proceed with caution when using this script to assist with trading decisions.
█ LIMITATIONS
Range Volumetric Weights :
Because of the conditions that must be met in order for volume to be considered part of wicks, it is possible that the default settings and their intended reasoning will not produce reliable results. If all lower timeframe candles have highs or lows that are within the body of the candle at the chart's resolution, the volume for the wicks will effectively be 0, which is not an accurate representation of those wicks. This is one of the reasons why I included the ability to change the source values used for these conditions as certain OHLC values may produce more reliable/intended results under these conditions.
Wick Slice Resolution :
PineScript restricts the number of intrabar references to 100,000 total. This script uses 3 separate request.security_lower_tf calls and has a default resolution of 1 minute. This means that if the user were to set the oscillator to the Range setting, enable volume weighted, and had the Wick Slice Resolution set to 1 minute, this script will exceed this 100,000 reference restriction within 24 days of data and will not produce any results beyond the previous 23.14 days.
Below are example uses of all the different settings of this script, these are done on the 1D chart of COINBASE:BTCUSD :
Default Settings:
Classic - Volume Weighted:
Range - no Volume Weight:
Range - Volume Weighted (1 min slices):
Range - Volume Weighted (1 hour slices):
Display Min/Max Guide - No Restriction:
Display Min/Max Guide - Restriction:
Invert Colors:
TNT_UpgradedThe background of the indicator to show TrendingUp (Green) / TrendingDown (Red) / Range Bound (Blue) Regions.
The concept is very simple, at each candle we look at the size of the candle and use a moving average of these candle body size (ABS (close-open)) and compare it agains a double smoothened average, i.e. moving average of this average to find trending or not trending periods.
In the upgrade the moving average is now looking only at the current day for intraday timeframe, i.e. in the first 5 bars it is an average of last 5 values, for last 10 candles it is an average of 10 values with the max limited to 28 that is for candle 28 onwards the average is always for 28 candles for default values or as defined by user.
I find it useful primarily for entry in options, a green background is more favourable for call option buying, a red background is favourable for put option buying and blue background is more favourable for option selling.
The coloured ranges show the direction bias, this has been designed using RSI on 3 timeframes with different weight-ages, all customisable by the user.
PS, I only trade Bank Nifty for intraday, all my observations are driven only by Bank Nifty.
Williams %R (v.4)This is an upgrade and an update of my Williams %R indicator modification.
As before this implementation is enhanced with CCI in the form of background colors. These colors can be used as a confirmation signal and indication of a current trend. Thee also can be employed in deciding when to enter/exit the market.
Besides, added is a scaling function and Lower/Upper Bound inputs.
Price PressureThe Price Pressure indicator shows directional price movement similar to how MACD works but rather than showing the difference between 2 moving averages of different lengths it shows the changing behaviour of different types of moving averages of the same length.
Price spike pressure outside the moving high and lows can also be shown and divergence detection can be enabled.
There are multiple modes of colouring:-
4 colour mode off (based on fast MA crossing slow MA)
- green: up
- red: down
4 colour mode on (based on fast MA crossing slow MA and slowing fast MA)
- green: up
- yellow: weakening up
- red: down
- orange: weakening down
fast mode (only uses the fast MA direction)
- green: up
- red: down
SuperTrend Momentum Chart(My goal creating this indicator) : Provide a quick way to check the current momentum of multiple timeframes. The Smart Momentum Chart was intended to be a live trading tool that should be used when a trader has already defined his edge and no longer needs the past Momentum data.
The Underlying Concept
What is Momentum ?
The Momentum shown is derived from a Mathematical Formula SUPERTREND , when price is above SUPERTREND its bullish Momentum and when its below SUPERTREND its Bearish Momentum. This indicator scans for candle closes on the timeframes you've selected and when there is a shift in momentum it notifies the trader with a color change and an alert if one was set up.
Technical inputs
- If you want to optimize the rate of signals to better fit your trading plan you would change the Factor input and ATR Length input. Increase factor and ATR Length to decrease the frequency of signals and decrease the Factor and ATR Length to increase the frequency of signals.
Quick TIP! : You can Sync all VFX SuperTrend Indicators together! All VFX SuperTrend indicators display unique information but its all derived from that same Momentum Formula. Keep the Factor input and ATR Length the same on other VFX SuperTrend indicators to have them operating on the same data.
Time Frame Inputs
- Your able to fill the chart with up to 8 timeframes
- If You don't need all 8 you can limit the amount to display by changing the "Time Frame Amount"
Display Inputs
- You can change the size of the chart and the color of the text
- You can toggle ON if you want to be signaled when a momentum switch occurs ( bullish to bearish or bearish to bullish )
- Your able to pick the Bullish and Bearish Colors of the Momentum switch
How it can be used ?
- Easily check the momentum of other Timeframes and use that information as a variable in your trading plan.
- quickly glance and know the momentum of any time frame before you enter any trade
- always know the momentum of the higher time frames
- Eliminate the need to switch from current chart
- Get an abundance of information in one location
- Have clear variables to structure your trades around
Nonlinear Parametric Oscillator - PSOThis script is in development phase and may be buggy. use with your own risk. The idea here is to determine the sinusoidal directional changes in the supply and demand. Based on direction, you can enter and make huge gains. Recommended to use on 1 min chart. The sideways market would be indicated as flattening in the respective bands. There are four bands, bottom one is where market is in BEAR mode and top one is when market is in BULL mode.
The indicator doesnt work well when the ticker price is less than 10 dollars, i am working on it. Do not use on penny stocks, for the time. More-details when I make this a robust version.
Nasdaq DowJones STOCH+RSIAlternative & UPDATED version of my previous indicator for spread trading.
This indicator can work pretty well also with other indices or correlated assets such as nasdaq100 and dax40.
The spikes from one side of the channel or the orizzontal lines signal a possible entry signal for a spread trading strategy.
INEVITRADE Pro +INEVITRADE Pro + is an augmented version of standard Relative Strength Index ( RSI ) enhanced with a EMA cloud and some momentum background highlights & Strength Vs. Bitcoin as an added integration.
INEVITRADE Best IndicatorINEVITRADE Pro + is an augmented version of standard Relative Strength Index ( RSI ) enhanced with a EMA cloud and some momentum background highlights & Strength Vs. Bitcoin as an added integration.
Stable Coin Dominance RSIThe Stable Coin Dominance RSI evaluates the relative dominance of stable coins within the crypto ecosystem as compared to the total market cap. As stable coin dominance rises, it suggests that market participants are exiting out of crypto assets and into dollar pegged stable coins. The opposite is true inversely; as stable coin dominance diminishes, it suggests that market participants are divesting out of stable coins and into crypto assets.
Stable coin dominance can be expressed as a percentage of the total market cap as follows: Stable Coins / Total Crypto. The Stable Coin Dominance RSI indicator uses this percentage and converts it into an oscillator using the formula for the relative strength index.
The calculation for the indicator is: RSI
The users can select from USDT and USDC, two most dominant stable tokens by market cap, and compare their relative dominance against Bitcoin and the alt market.
The Stable Coin Dominance RSI may be useful on larger timeframes when attempting to identify the market’s appetite for risk along with oversold and undersold readings which may indicate pivots or turn arounds along market extremes.
The limitation of the indicator lies in the fact that stable coins continue to make up a growing percentage of the total market cap over time and thus comparisons to earlier cycles will not be a perfect apples-to-apples evaluation. This being said, the smoothing function of the RSI’s look back helps to moderate these comparative differences.
Ultimate Oscillator + Realtime DivergencesUltimate Oscillator (UO) + Realtime Divergences + Alerts + Lookback periods.
This version of the Ultimate Oscillator adds the following 5 additional features to the stock UO by Tradingview:
- Optional divergence lines drawn directly onto the oscillator in realtime
- Configurable alerts to notify you when divergences occur, as well as centerline crossovers.
- Configurable lookback periods to fine tune the divergences drawn in order to suit different trading styles and timeframes.
- Background colouring option to indicate when the UO has crossed the centerline, or optionally when both the UO and an external oscillator, which can be linked via the settings, have both crossed their centerlines.
- Alternate timeframe feature allows you to configure the oscillator to use data from a different timeframe than the chart it is loaded on.
This indicator adds additional features onto the stock Ultimate Oscillator by Tradingview, whose core calculations remain unchanged. Namely the configurable option to automatically and clearly draw divergence lines onto the oscillator for you as they occur in realtime. It also has the addition of unique alerts, so you can be notified as divergences occur without spending all day watching the charts. Furthermore, this version of the Ultimate Oscillator comes with configurable lookback periods, which can be configured in order to adjust the length of the divergences, in order to suit shorter or higher timeframe trading approaches.
The Ultimate Oscillator
Tradingview describes the Ultimate Oscillator as follows:
“The Ultimate Oscillator indicator (UO) indicator is a technical analysis tool used to measure momentum across three varying timeframes. The problem with many momentum oscillators is that after a rapid advance or decline in price, they can form false divergence trading signals. For example, after a rapid rise in price, a bearish divergence signal may present itself, however price continues to rise. The ultimate Oscillator attempts to correct this by using multiple timeframes in its calculation as opposed to just one timeframe which is what is used in most other momentum oscillators.”
More information on the history, use cases and calculations of the Ultimate Oscillator can be found here: www.tradingview.com
What are divergences?
Divergence is when the price of an asset is moving in the opposite direction of a technical indicator, such as an oscillator, or is moving contrary to other data. Divergence warns that the current price trend may be weakening, and in some cases may lead to the price changing direction.
There are 4 main types of divergence, which are split into 2 categories;
regular divergences and hidden divergences. Regular divergences indicate possible trend reversals, and hidden divergences indicate possible trend continuation.
Regular bullish divergence: An indication of a potential trend reversal, from the current downtrend, to an uptrend.
Regular bearish divergence: An indication of a potential trend reversal, from the current uptrend, to a downtrend.
Hidden bullish divergence: An indication of a potential uptrend continuation.
Hidden bearish divergence: An indication of a potential downtrend continuation.
Setting alerts.
With this indicator you can set alerts to notify you when any/all of the above types of divergences occur, on any chart timeframe you choose.
Configurable lookback values.
You can adjust the default lookback values to suit your prefered trading style and timeframe. If you like to trade a shorter time frame, lowering the default lookback values will make the divergences drawn more sensitive to short term price action.
How do traders use divergences in their trading?
A divergence is considered a leading indicator in technical analysis , meaning it has the ability to indicate a potential price move in the short term future.
Hidden bullish and hidden bearish divergences, which indicate a potential continuation of the current trend are sometimes considered a good place for traders to begin, since trend continuation occurs more frequently than reversals, or trend changes.
When trading regular bullish divergences and regular bearish divergences, which are indications of a trend reversal, the probability of it doing so may increase when these occur at a strong support or resistance level . A common mistake new traders make is to get into a regular divergence trade too early, assuming it will immediately reverse, but these can continue to form for some time before the trend eventually changes, by using forms of support or resistance as an added confluence, such as when price reaches a moving average, the success rate when trading these patterns may increase.
Typically, traders will manually draw lines across the swing highs and swing lows of both the price chart and the oscillator to see whether they appear to present a divergence, this indicator will draw them for you, quickly and clearly, and can notify you when they occur.
Disclaimer: This script includes code from the stock UO by Tradingview as well as the Divergence for Many Indicators v4 by LonesomeTheBlue.
True Strength Indicator + Realtime DivergencesTrue Strength Indicator (TSI) + Realtime Divergences + Alerts + Lookback periods.
This version of the True Strength Indicator adds the following 5 additional features to the stock TSI by Tradingview:
- Optional divergence lines drawn directly onto the oscillator in realtime.
- Configurable alerts to notify you when divergences occur, as well as when the TSI and lagline bands crossover one another, when the oscillator begins heading up, or heading down.
- Configurable lookback periods to fine tune the divergences drawn in order to suit different trading styles and timeframes.
- Background colouring option to indicate when the two TSI bands, the TSI line and the TSI lagline, have crossed one another, either moving upwards or downwards, or optionally when the two TSI bands have crossed upwards and an external oscillator, which can be linked via the settings, has crossed above its centerline, and the TSI bands have crossed downwards and the external oscillator has crossed below its centerline.
- Alternate timeframe feature allows you to configure the oscillator to use data from a different timeframe than the chart it is loaded on.
This indicator adds additional features onto the stock TSI by Tradingview, whose core calculations remain unchanged, although this version has different settings as default to suit a shorter time period (it uses 6, 13, 4 by default, whereas the stock TSI typically ships with higher values, e.g. 25, 13, 13). Namely the configurable option to automatically, quickly and clearly draw divergence lines onto the oscillator for you as they occur in realtime. It also has the addition of unique alerts, so you can be notified when divergences occur without spending all day watching the charts. Furthermore, this version of the TSI comes with configurable lookback periods, which can be configured in order to adjust the sensitivity of the divergences, in order to suit shorter or higher timeframe trading approaches.
The True Strength Indicator
Tradingview describes the True Strength Indicator as follows:
“The True Strength Index (TSI) is a momentum oscillator that ranges between limits of -100 and +100 and has a base value of 0. Momentum is positive when the oscillator is positive (pointing to a bullish market bias) and vice versa. It was developed by William Blau and consists of 2 lines: the index line and an exponential moving average of the TSI, called the signal line. Traders may look for any of the following 5 types of conditions: overbought, oversold, centerline crossover, divergence and signal line crossover. The indicator is often used in combination with other signals..”
What are divergences?
Divergence is when the price of an asset is moving in the opposite direction of a technical indicator, such as an oscillator, or is moving contrary to other data. Divergence warns that the current price trend may be weakening, and in some cases may lead to the price changing direction.
There are 4 main types of divergence, which are split into 2 categories;
regular divergences and hidden divergences. Regular divergences indicate possible trend reversals, and hidden divergences indicate possible trend continuation.
Regular bullish divergence: An indication of a potential trend reversal, from the current downtrend, to an uptrend.
Regular bearish divergence: An indication of a potential trend reversal, from the current uptrend, to a downtrend.
Hidden bullish divergence: An indication of a potential uptrend continuation.
Hidden bearish divergence: An indication of a potential downtrend continuation.
Setting alerts.
With this indicator you can set alerts to notify you when any/all of the above types of divergences occur, on any chart timeframe you choose.
Configurable lookback values.
You can adjust the default lookback values to suit your prefered trading style and timeframe. If you like to trade a shorter time frame, lowering the default lookback values will make the divergences drawn more sensitive to short term price action.
How do traders use divergences in their trading?
A divergence is considered a leading indicator in technical analysis , meaning it has the ability to indicate a potential price move in the short term future.
Hidden bullish and hidden bearish divergences, which indicate a potential continuation of the current trend are sometimes considered a good place for traders to begin, since trend continuation occurs more frequently than reversals, or trend changes.
When trading regular bullish divergences and regular bearish divergences, which are indications of a trend reversal, the probability of it doing so may increase when these occur at a strong support or resistance level . A common mistake new traders make is to get into a regular divergence trade too early, assuming it will immediately reverse, but these can continue to form for some time before the trend eventually changes, by using forms of support or resistance as an added confluence, such as when price reaches a moving average, the success rate when trading these patterns may increase.
Typically, traders will manually draw lines across the swing highs and swing lows of both the price chart and the oscillator to see whether they appear to present a divergence, this indicator will draw them for you, quickly and clearly, and can notify you when they occur.
Disclaimer: This script includes code from the stock TSI by Tradingview as well as the Divergence for Many Indicators v4 by LonesomeTheBlue
Indian Bank Nifty ScreenerIndian Bank Nifty Screener (IBNS) is a comprehensive table displaying the following parameters for Bank Nifty constituents:
Op = Open Price of the Day.
LaP = Last Price.
O-L = Open Price of the Day - Last Price.
ROC = Rate of Change .
SMA20 = Simple Moving Average 20 period.
S20d = Last Price - SMA 20.
SMA50 = Simple Moving Average 50 period.
S50d = Last Price - SMA 50.
SMA200 = Simple Moving Average 200 period.
S200d = Last Price - SMA 200.
ADX(14) = Average Directional Index.
RSI(14) = Relative Strength Index.
CCI(20) = Commodity Channel Index.
ATR(14) = Average True Range.
MOM(10) = Momentum.
CMF(20) = Chaikin Money Flow.
MACD = Moving Average Convergence Divergence.
Sig = MACD signal.
The first row displays individual banks on selection from Input Box in “Settings”.
User after visiting the “Settings” menu simply is required to select the “input symbol” from the stock listed in the “Option” Box. Automatically the selected bank name with parameter details is displayed in first row.
The other rows starting with “Nifty50” and with ” Bank Nifty” in second row, displays static individual Bank Nifty stocks starting from third row.
CoG RSI Momenum Ichimoku CloudThis indicator is inspired by "RSI ICHIMOKU CLOUD".
Script plots price bars based on selected indicator with Ichimoku Cloud around it.
In my version I have added different oscillators for bar calculations.
Specifically you can choose from:
Center of Gravity(CoG)
Momentum
RSI