Intraday Mean Reversion MainThe Intraday Mean Reversion Indicator works well on certain stocks. It should be used for day trading stocks but need to be applied on the Day to Day timeframe.
The logic behind the indicator is that stocks that opens substantially lower than yesterdays close, very often bounces back during the day and closes higher than the open price, thus the name Intraday Mean reversal. The stock so to speak, reverses to the mean.
The indicator has 7 levels to choose from:
0.5 * standard deviation
0.6 * standard deviation
0.7 * standard deviation
0.8 * standard deviation
0.9 * standard deviation
1.0 * standard deviation
1.1 * standard deviation
The script can easily be modified to test other levels as well, but according to my experience these levels work the best.
The info box shows the performance of one of these levels, chosen by the user.
Every Yellow bar in the graph shows a buy signal. That is: The stocks open is substantially lower (0.5 - 1.1 standard deviations) than yesterdays close. This means we have a buy signal.
The Multiplier shows which multiplier is chosen, the sum shows the profit following the strategy if ONE stock is bought on every buy signal. The Ratio shows the ratio between winning and losing trades if we followed the strategy historically.
We want to find stocks that have a high ratio and a positive sum. That is More Ups than downs. A ratio over 0.5 is good, but of course we want a margin of safety so, 0.75 is a better choice but harder to find.
If we find a stock that meets our criteria then the strategy will be to buy as early as possible on the open, and sell as close as possible on the close!
Déviation Standard
Z-Score(Slope(OBV(LBC)))Summary : Market price is simply a dance of liquidity to the specific market.
tl;dr: "Cash come-in, market moon; Cash go-out, market doom"
In Simple Language : Large changes in the money flow to an asset often mark local price extremia.
Academic paper:
Title: Z-Score(Slope(OBV)): An Efficient Indicator for Identifying Local Extremes in Asset Prices
Abstract: This paper presents a novel trading indicator, Z-Score(Slope(OBV)), that aims to predict local extremes in asset prices by analyzing the patterns of money flow. The indicator is constructed using the Z-score of the slope of the On Balance Volume (OBV).
Hypothesis: The price levels at which the money flows into and out of an asset often mark local extremes. This notion underpins our exploration of the Z-Score(Slope(OBV)) indicator's potential in identifying these critical points.
1. On Balance Volume (OBV): The OBV is a momentum indicator that leverages the volume flow to forecast potential changes in asset prices. It operates on the premise that changes in volume often presage shifts in price. The OBV algorithm adds a period's volume to the cumulative total when the closing price is up and subtracts it when the closing price is down. Therefore, an ascending OBV suggests positive volume pressure, potentially heralding higher prices, while a declining OBV signifies negative volume pressure, possibly indicating lower prices.
2. Slope: In this context, the slope represents the rate of change of the OBV. It is a measure of the rise-over-run for a linear regression line through the OBV data points. By evaluating the slope of the OBV, we can extract valuable insights into the momentum of the volume. A positive slope indicates increasing volume momentum, suggesting growing interest in the asset, while a negative slope implies declining volume momentum, potentially reflecting dwindling interest.
3. Z-Score: The Z-score is a statistical measure that delineates a data point's relationship to the mean of a group of values, expressed in terms of standard deviations from the mean. For instance, a Z-score of 0 reveals that the data point's score aligns with the mean score. Positive Z-scores indicate values higher than the mean, and negative Z-scores represent values lower than the mean. Applying the Z-score to the slope of the OBV allows us to comprehend the degree of deviation of the current OBV slope from its historical mean.
A Z-score of 1 suggests that the OBV's slope is one standard deviation from the mean, which implies that the slope is within the range of values where approximately 68% (not 67%) of all values lie.
A Z-score of 2 implies that the slope is two standard deviations from the mean, thus within the range where roughly 95% of all values lie.
A Z-score of 3 indicates that the slope is three standard deviations from the mean, putting it within the range where about 99.7% of all values lie.
Z-scores of 4 and 5 and beyond are increasingly rare and represent extreme values.
4. The Z-Score(Slope(OBV)) Indicator and Line Break Chart Synergy: The Z-Score(Slope(OBV)) indicator's efficiency is further amplified when visualized using a Line Break chart. This chart type disregards time, concentrating solely on price changes, thus providing a clear visualization of market trends. When combined with the Line Break chart, the Z-Score(Slope(OBV(LBC))) indicator can help traders identify trend shifts more accurately and promptly, reinforcing the hypothesis that price levels where money flows into and out of an asset often mark local extremes.
In summary, the Z-Score(Slope(OBV)) indicator, combining volume, momentum, and statistical analysis, provides a robust tool for traders to predict local extremes in asset prices.
Regarding Implementation:
- This is implemented using Pinescript V5
- Uses inbuilt ta module
- Very effective and simple and efficient computation in 30 lines of code
Expected VolatilityExpected Volatility
Hello and welcome to my first indicator! I'm publishing this indicator as free to use and modify because I think it's a great place to learn and I hope I can teach you something.
There are some terms which you need to understand before I begin explaining this indicator and what it does for you:
Daily Settlement - The price at which a market closes when the trading day closes (RTH or Regular Trading Hours close)
Standard Deviation - A measure in statistics that declares how far away a data point is from the mean when compared with all the data points before it to an extent
Now for the history behind this indicator:
Rule of 16. This goes back to the VIX, or S&P 500 volatility index. The idea behind the volatility index is to determine what magnitude of movement could be expected from the market the following day based on recent movement. The rule of 16 is an easier way to refer to the square root of the number of trading days in a year. There are 252 trading days in a year and the square root of 252 is approximately 15.87. We estimate it to be 16 because it's easier to talk about when it's easier to say and therefore easier to remember.
The relevance of this rule is that when the VIX is at 16, we can expect a market movement of 1% or so unless some special circumstances overrule this estimate. To get the expected market movement, we take 16 and divide by 16 and get 1, or 1%. If the VIX is trading at 24, we get 24/16 or 1.5 which is 1.5% movement. This indicator seeks to simplify the math and lay it out in a visual way to show the highest probability of range the market is expected to trade.
Thanks for taking the time to read my description, I hope you like my indicator.
Special thanks to my trading friends and coaches for helping me complete this indicator.
Deviations from ARL (DARL)Similar to Bollinger Bands, this indicator uses standard deviations but from Adaptive Rebound Lines (See: 'ARL').
The adaptiveness of the 'ARL' is further affected by volatility and helps greatly in spotting the possible strength and direction of rebounds.
All this information is presented with minimal lag thanks to the rebound qualities of the 'ARL' adapting to market volatility.
----- HOW TO USE IT -----
1) Use with 1h time frame.
2) Smaller width typically means that price will be moving is smaller movements.
3) Small price movements while the width is increasing typically means that a large price move will occur soon.
4) Larger width typically means that price will be moving in larger movements.
5) Very large width with sideways price typically means that the price will have a bias towards the center.
Note: A V-Offset of 1 is also a good setting alternative for this indicator.
----- HOW THIS INDICATOR IS ORIGINAL; WHAT IT DOES AND HOW IT DOES IT -----
This indicator has an original, unique ability in anticipating the strength and direction of a price rebound while at the same time showing the bias of the rebound with minimal lag.
It does this by letting the adaptive qualities of the 'ARL' be affected by market volatility, not just by price movement alone.
----- VERSION -----
This indicator is not a variation, replacement, or presentation of the 'ARL' or the 'ARL' Bands -- it merely derives its base calculations for standard deviations from the 'ARL'.
However, this indicator affects the calculations of the standard 'ARL' with volatility and creates a new, unique calculation.
It thus presents a totally different context for price action.
A standard 'ARL' helps in finding possible rebounds but it does not help in finding the strength of them or the directional bias of a rebound.
This is because a standard 'ARL' is more negligent of market volatility and adapts to price movement alone.
In contrast, this indicator does help in anticipating the strength and direction of the rebound because it adapts deviations from an 'ARL' to market volatility.
Therefore, the lines cannot be adjusted individually but in pairs and only further from their respective, mirroring lines.
GamCP Multi-timeframe v0.1Measures compression on different timeframes, on demand. A high compression precedes high volatilty.
v0.1 - by mufaxor
Ladder StDevThis indicator shows the upwards (green) and downward (red) volatility of the market. It is a standard deviation of the price but with a twist! For the upwards volatility , only the green candles are taken into account, and for the downwards only the red candles are.
Compared to my previous "Ladder ATR" indicator this a different approach to measure the the upwards and downwards volatility of the market by utilizing the standard deviation instead of the ATR. When both measure the volatility they have different "dynamics". Standard deviation increases the weight of larger values over smaller values. The ATR indicator is based on the average of absolute changes. So, if we apply the indicators on a daily chart , ATR considers intraday and between-day data, while the standard deviation calculation includes only daily returns (source price).
[Hoss] VWAP ADThe VWAP ( Volume Weighted Average Price ) Deviation script is a powerful tool designed for traders to analyze the relationship between price and volume . By calculating deviations around the VWAP , the script allows users to identify key support and resistance levels that can help in making better-informed trading decisions.
The script calculates VWAP based on the chosen data source (default is closing price) and then computes deviations above and below the VWAP using either the Average Deviation or the Standard Deviation method. The user can select the desired method through the script's input options. These deviations are then plotted as bands on the chart, providing a visual representation of the areas where the price may potentially revert or experience a breakout.
A unique and valuable feature of this script is the addition of a monitor that counts the number of times the price crosses above the Upper Deviation level 2 and below the Lower Deviation level 2 within a user-defined lookback period. This monitor is displayed as a table in the bottom right corner of the chart and can be enabled or disabled through an input option.
The cross count monitor serves as a valuable aid to traders by providing insights into the historical frequency of price crossing the deviation levels. This information can be used to identify potential trading opportunities based on historical price behavior around these levels.
Historical Volatility Scale [ChartPrime]This indicator outputs a visual scale representing the level of volatility in the market relative to the timeframe selected on the users chart. The method of volatility used is "historical volatility" which is calculated by taking the standard deviation of a series of "x" length which contains the current closing price divided by the previous closing price for all nodes. The output of the volatility is standardized by also running an additional percentrank calculation over the raw volatility values to allow the volatility scale to oscillate properly between its minimum of 0 and maximum of 100.
📗 SETTINGS
Length: The length determines how many bars/nodes should be considered when calculating the standard deviation. In simple terms, the higher the length, the less sensitive and less reactive the scale will be to current price action, and larger moves would be required to trigger the scale.
🧰 UTILITY
The arrow or "The Pin" will move upwards towards the "fire" emoji when the volatility is higher than the majority of values for the amount of bars back that you set the "length" setting to. Vise Versa for when the pin is lowering towards the "snooze" emoji, the volatility is less than the majority of nodes/values for the past "length" amount of values.
When the volatility is low, a trader could consider utilizing more leading indicators to make their trading decisions as opposed to lagging indicator such as trend indicators. When the volatility is low, the price action is consolidation which would be bad for a trend following strategy. Vise Versa for trend strategies, having a higher volatility may be better for such strategies.
Its important to remember that this indicator itself is a lagging indicator, in that it relies on historical data to showcase the current state of the markets volatility. This means that although the recommendation in the previous paragraph may make logical sense, it is not a guarantee that if the volatility is showcasing a trending market, that your trend strategies will necessarily be profitable.
Inter-Exchanges Crypto Price Spread Deviation (Tartigradia)Measures the deviation of price metrics between various exchanges. It's a kind of realized volatility indicator, as the idea is that in times of high volatility (high emotions, fear, uncertainty), it's more likely that market inefficiencies will appear for the same asset between different market makers, ie, the price can temporarily differ a lot. This indicator will catch these instants of high differences between exchanges, even if they lasted only an instant (because we use high and low values).
Both standard deviation and median absolute deviation (more robust to outliers, ie, exchanges with a very different price from others won't influence the median absolute deviation, but the standard deviation yes).
Compared to other inter-exchanges spread indicators, this one offers two major features:
* The symbol automatically adapts to the symbol currently selected in user's chart. Hence, switching between tickers does not require the user to modify any option, everything is dynamically updated behind the scenes.
* It's easy to add more exchanges (requires some code editing because PineScript v5 does not allow dynamical request.security() calls).
Limitations/things to know:
* History is limited to what the ticker itself display. Ie, even if the exchanges specified in this indicator have more data than the ticker currently displayed in the user's chart, the indicator will show only a timeperiod as long as the chart.
* The indicator can manage multiple exchanges of different historical length (ie, some exchanges having more data going way earlier in the past than others), in which case they will simply be ignored from calculations when far back in the past. Hence, you should be aware that the further you go in the past, the less exchanges will have such data, and hence the less accurate the measures will be (because the deviation will be calculated from less sources than more recent bars). This is thanks to how the array.* math functions behave in case of na values, they simply skip them from calculations, contrary to math.* functions.
Weighted Deviation Bands [Loxx]What are Weighted Deviation Bands?
Variation of the Bollinger bands but it uses linear weighted average and weighted deviation via Mladen Rakic.
What is Weighted Deviation?
This weighted deviation is a sort of all linear weighted deviation. It uses linear weighting in all the steps calculated (which makes it different from the built in deviation in a case when linear weighted ma is used in the ma method). It is more responsive than the standard deviation
Included
Bar coloring
Fibonacci Volatility BandsFibonacci Volatility Bands are just an alternative that allows for more margin than regular Bollinger Bands. They are created based on an average of moving averages that use the Fibonacci sequence as lookback periods.
The use of the Fibonacci Volatility Bands is exactly the same as the Bollinger Bands.
DEVIATION OF THE STOCHASTIC INDICATORThis new technical indicator uses the stochastic oscillator as its base and calculates the deviation of its moving average, generating an alternative view of market volatility.
Fair value bands / quantifytools— Overview
Fair value bands, like other band tools, depict dynamic points in price where price behaviour is normal or abnormal, i.e. trading at/around mean (price at fair value) or deviating from mean (price outside fair value). Unlike constantly readjusting standard deviation based bands, fair value bands are designed to be smooth and constant, based on typical historical deviations. The script calculates pivots that take place above/below fair value basis and forms median deviation bands based on this information. These points are then multiplied up to 3, representing more extreme deviations.
By default, the script uses OHLC4 and SMA 20 as basis for the bands. Users can form their preferred fair value basis using following options:
Price source
- Standard OHLC values
- HL2 (High + low / 2)
- OHLC4 (Open + high + low + close / 4)
- HLC3 (High + low + close / 3)
- HLCC4 (High + low + close + close / 4)
Smoothing
- SMA
- EMA
- HMA
- RMA
- WMA
- VWMA
- Median
Once fair value basis is established, some additional customization options can be employed:
Trend mode
Direction based
Cross based
Trend modes affect fair value basis color that indicates trend direction. Direction based trend considers only the direction of the defined fair value basis, i.e. pointing up is considered an uptrend, vice versa for downtrend. Cross based trends activate when selected source (same options as price source) crosses fair value basis. These sources can be set individually for uptrend/downtrend cross conditions. By default, the script uses cross based trend mode with low and high as sources.
Cross based (downtrend not triggered) vs. direction based (downtrend triggered):
Threshold band
Threshold band is calculated using typical deviations when price is trading at fair value basis. In other words, a little bit of "wiggle room" is added around the mean based on expected deviation. This feature is useful for cross based trends, as it allows filtering insignificant crosses that are more likely just noise. By default, threshold band is calculated based on 1x median deviation from mean. Users can increase/decrease threshold band width via input menu for more/less noise filtering, e.g. 2x threshold band width would require price to cross wiggle room that is 2x wider than typical, 0x erases threshold band altogether.
Deviation bands
Width of deviation bands by default is based on 1x median deviations and can be increased/decreased in a similar manner to threshold bands.
Each combination of customization options produces varying behaviour in the bands. To measure the behaviour and finding fairest representation of fair and unfair value, some data is gathered.
— Fair value metrics
Space between each band is considered a lot, named +3, +2, +1, -1, -2, -3. For each lot, time spent and volume relative to volume moving average (SMA 20) is recorded each time price is trading in a given lot:
Depending on the asset, timeframe and chosen fair value basis, shape of the distributions vary. However, practically always time is distributed in a normal bell curve shape, being highest at lots +1 to -1, gradually decreasing the further price is from the mean. This is hardly surprising, but it allows accurately determining dynamic areas of normal and abnormal price behaviour (i.e. low risk area between +1 and -1, high risk area between +-2 to +-3). Volume on the other hand is typically distributed the other way around, being lowest at lots +1 to -1 and highest at +-2 to +-3. When time and volume are distributed like so, we can conclude that 1) price being outside fair value is a rare event and 2) the more price is outside fair value, the more anomaly behaviour in volume we tend to find.
Viewing metric calculations
Metric calculation highlights can be enabled from the input menu, resulting in a lot based coloring and visibility of each lot counter (time, cumulative relative volume and average relative volume) in data window:
— Alerts
Available alerts are the following:
Individual
- High crossing deviation band (bands +1 to +3 )
- Low crossing deviation band (bands -1 to -3 )
- Low at threshold band in an uptrend
- High at threshold band in a downtrend
- New uptrend
- New downtrend
Grouped
- New uptrend or downtrend
- Deviation band cross (+1 or -1)
- Deviation band cross (+2 or -2)
- Deviation band cross (+3 or -3)
— Practical guide
Example #1 : Risk on/risk off trend following
Ideal trend stays inside fair value and provides sufficient cool offs between the moves. When this is the case, fair value bands can be used for sensible entry/exit levels within the trend.
Example #2 : Mean reversions
When price shows exuberance into an extreme deviation, followed by a stall and signs of exhaustion (wicks), an opportunity for mean reversion emerges. The higher the deviation, the more volatility in the move, the more signalling of exhaustion, the better.
Example #3 : Tweaking bands for desired behaviour
The faster the length of fair value basis, the more momentum price needs to hit extreme deviation levels, as bands too are moving faster alongside price. Decreasing fair value basis length typically leads to more quick and aggressive deviations and less steady trends outside fair value.
GAVAD - Selling after a Strong MovimentThis strategy search for a moment whe the market make two candles are consistently strong, and open a Sell, searching the imediactly correction, on the new candle. It`s easy to see the bars on the histogram graph. Purple Bars represent the candle variation. when on candle cross ove the Signal line the graph plot an Yellow ci, if the second bar crossover the signal a green circle is ploted and the operation start on start of the next candle.
This strategy can be used in a lot of Stocks and other graphs. many times we need a small time of graph, maybe 1 or 5 minutes because the gain shoud be planned to a midle of the second candle. You need look the stocks you will use.
Stocks > 100 dolars isnt great, markets extremly volatly not too. but, Stocks that have a consistently development are very interisting. Look to markets searching maybe 0.5% or 1%.
For this moment, I make the development of a Brasilian Real x American Dollar. In 15 Minutes.
if you use in small timeframe the results can be better.
On this time we make more than 500 trades with a small lot of contracts, without a big percent profitable, but a small profit in each operation, maybe you search more than. To present a real trading system I insert a spreed to present a correct view of the results.
Each stock, Index, or crypto there is a specific configuration?
my suggestion for new stocks
You need choice a stock and using the setup search set over than 70% gain (percent profitable), using a 1% of gain and loss between 1-2%
as the exemple (WDO)
default I prepare a Brazilian Index
6-signal (6% is variation of a candle of the last candle)
10000- multiplicator (its important to configure diferences betwen a stock and an Indice)
gain 3 (this proportion will be set looking you target, how I say, 1% can be good)
loss 8 (this proportion will be set with you bankroll management, how I say, maybe 2%, you need evaluate)
for maximize operations I use in the 1 or 5 minute graph. Timeframes more large make slowlly results,
(but not unable that you use in a 1 hour or a 1 day.)
I make this script by zero. Maybe the code doesnt so organized, but is very easy to understand. If you have any doubts . leave a comment.
I hope help you.
Up Down VolatilityThis is just experimental. I wanted the flexibility in looking at volatility and this indicator gives you several ways to do so.
I haven't figured out the best way to use this yet but I suspect that as a form of entry confirmation indicator would be best.
If you find a way this works well for you please drop me a note. It would nice know someone found a way to use it successfully!
The options available are:
* Your source can be price or the ATR.
* It allows you to separate the volatility of the bearish and bullish candles and even allows you to produce differential.
* You can choose to run the result through any one of many smoothers.
With the above options you can look at:
* The normal volatility. That is not split into bearish and bullish components.
* The bearish and bullish volatility and the difference between them.
* The relative bearish and bullish volatility and the difference between them.
The "The relative bearish and bullish" is each one divided into the source before it was split into Up and Down or low/high divided by close which should make the max value roughly around 1.
The code is structured to easily drop into a bigger system so use it as a lone indicator or add the code to some bigger project you are creating. If you do integrate it into something else then send me a note as it would be nice to know it's being well used.
Enjoy and good luck!
ZenBot Signals - Trend StrengthI developed this indicator as a "regime detection" for my algo trading bot. It uses the ADX +/- values with a few twists.
- If ADX DI+ is over 30 and DI- is below 20 and falling (inverse for shorts)
- Price action rising/falling thru various VWAP standard deviations indicates a strong trend break
- Some other custom juju (open source so have fun).
I use this primarily to monitor the SPY index as a backdrop for my long and short trades. If the colored line below price bars is red or green, a strong trend is present and there is a decent trade environment.
VWAP Market Session AnchoredVWAP Market Session Anchored differs from the traditional VWAP or VWAP Auto Anchored indicator in that the Volume Weighted Average Price calculation is automatically anchored to four major market session starts: Sydney, London, Tokyo, New York.
Settings
Source: the source for the VWAP calculation.
Offset: changing this number will move the VWAP either Forwards or Backwards, relative to the current market. Zero is the default.
Band: enabling this will show Standard Deviation bands.
Band Multiplier: the value the Standard Deviation bands will be multiplied by before being plotted on the chart.
Sessions : enabling the sessions will plot the respective anchored VWAP on chart.
Custom: enabling this will show a custom user-defined session.
Custom UTC : the custom session is defined by a starting UTC hour followed by the ending UTC hour.
Usage
Similar to the traditional VWAP, VWAP Market Session Anchored is a technical analysis tool used to measure the average price weighted by volume. VWAP Market Session Anchored can be used to identify the trend during a specific market session.
Limitations
When setting a custom session, be mindful that calculations are based off of the Coordinated Universal Time (UTC) time, you must convert your local time zone to UTC in order to have an accurate representation of your custom session.
It is not recommended to use this indicator on timeframes above 1 hour as market sessions only last a few hours.
Asymmetric Dispersion High Lowdear fellows,
this indicator is an effort to determine the range where the prices are likely to fall within in the current candle.
how it is calculated
1. obtain
a. gain from the open to the high
b. loss from the open to the low
in the last 20 (by default) candles and
in the last 200 (10*20 by default) candles
2. perform
a. the geometric average (sma of the log returns) over these gains and losses
b. their respective standard deviation
3. plot from the open of each candle
a. the average + 2 standard deviations (2 by default) of the short window size
b. same for the long window size (which is overlapped)
what it shows
1. where the current candle is likely to move with 95% likelyhood
how it can be interpreted
1. a gauge for volatility in the short and long term
2. a visual inbalance between likelyhood to go up or down according to dispersion in relation to current prices or candle open.
3. a confirmation of crossings of, for instance, support and resistances once the cloud is completely above or below.
in regard to bollinger bands (which are and excellent well proven indicator)
1. it segregates upward moves from the downward ones.
2. it is hardly crossed by prices
3. it is centered on the current candle open, instead of the moving average.
we welcome feedback and critic.
best regards and success wishes.
GB Gilt Yield CurveWith thanks to @longfiat whose US Treasury Yield Curve served as the basis for this indicator
This is created very quickly to provide a sense of the GB Gilt Yield curve in light of government induced market dysfunction as a result of an ill-conceived mini-budget.
Note that I omitted GB04Y, GB06Y, GB08Y, GB09Y and GB12Y to avoid overcrowding the chart with excess information and thereby render the indicator more readily usable.
Probability Cloud BASIC [@AndorraInvestor]🔮☁️
This is the BASIC version of the PROBABILITY CLOUD indicator.
It is an evolution beyond traditional standard deviation probabilistic indicators only using bands or channels.
The new PROBABILITY CLOUD graphic representation with customizable transparent layers is based on -2 / +2 standard deviation calculated using 20 fixed predetermined time periods, and is available in several calculation MODES:
SMA , EMA , WMA , VWMA , VWMA & VAWMA
The indicator is designed to let the trader visually understand the probabilistic depth of past, present and future price action, and its evolution over time.
Looking forward to your comments and feedback to guide me on future updates!
🙏 Big THANKS @Electrified for letting me use his work on Deviation Bands/ as a starting point for my first script.
Strength of Divergence Across Multiple IndicatorsOverview:
One-stop shop for all your divergence needs, including:
(1) A single metric for divergence strength across multiple indicators.
(2) Labels that make it easy to spot where the truly strong divergence is by showing the overall divergence strength value along with the number of divergent indicators. Hovering over the label shows a breakdown of each divergent indicator and its individual divergence strength value.
(3) Fully customizable, including inputs for pivot lengths, divergence types, and weights for every component of the divergence strength calculation. This allows you to quickly and easily optimize the output for any chart. Don't worry, the default settings will have you covered if you're not interested in what's going on under the hood.
The Divergence Strength Calculation:
The total divergence strength value is the sum of the divergence strengths of all indicators for which divergence was detected at a given bar. Each indicator's individual divergence strength is comprised of two basic components: (1) |ΔPrice| - the magnitude of the change in price over the divergence period (pivot-to-pivot), and (2) |ΔIndicator| - the magnitude of the change in indicator value over the divergence period.
Because different indicators' scales and volatility can vary greatly, the Δ values are expressed in terms of standard deviation to ensure that the values are meaningful and equitable across all indicators and assets/instruments/currency pairs, etc:
|ΔIndicator| = |indicator_value_1 - indicator_value_2| / 2 * StDev(indicator_series,100)
Calculation Weights:
All components of the calculation are weighted and can be modified on the Inputs page in settings (weights are simply multipliers). For example, if you think hidden divergence should carry less weight than regular divergence, you can assign it a lesser weight. Or if you think RSI divergence is worth more than OBV divergence, you can adjust their weights accordingly. List of weights:
Regular divergence weight - default = 1
Hidden divergence weight - default = 1
ΔPrice weight - default = 0.5 (multiplied by the ΔPrice component)
ΔIndicator weight - default = 1.5 (multiplied by the ΔIndicator component)
RSI weight - default = 1.1
OBV weight - default = 0.8
MACD weight - default = 0.9
STOCH weight - default = 0.9
Development for additional indicators is ongoing, as is research into the optimal weight configuration(s).
Other Inputs:
Pivot lengths - specify the number of bars before and after each pivot high/low to consider it a valid candidate for divergence.
Lookback bars and Lookback pivots - specify the number of bars or the number of pivots to look back across.
Price sources - specify separate price sources for bullish and bearish divergence
Display settings - specify how lines and labels should display, including which divergence strength values should show the largest labels. Include/exclude specific divergence types and indicators.
Please report any bugs, or let me know if you have any enhancement suggestions or requests for additional indicators.
@reees
Variance (Welford) [Loxx]The standard deviation is a measure of how much a dataset differs from its mean; it tells us how dispersed the data are. A dataset that’s pretty much clumped around a single point would have a small standard deviation, while a dataset that’s all over the map would have a large standard deviation. You can. use this calculation for other indicators.
Given a sample the standard deviation is defined as the square root of the variance
Here you can find a Welford’s method for computing (single pass method) that avoids errors in some cases (if the variance is small compared to the square of the mean, and computing the difference leads catastrophic cancellation where significant leading digits are eliminated and the result has a large relative error)
Read more here: jonisalonen.com
Incliuded
Loxx's Expanded Source Types
STD-Adaptive T3 [Loxx]STD-Adaptive T3 is a standard deviation adaptive T3 moving average filter. This indicator acts more like a trend overlay indicator with gradient coloring.
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
Loxx's Expanded Source Types