DMI & ST DEV zone intersection [LM]Hello Traders,
This indicator uses two indicators st dev extremes and DMI extremes and visualize intersection of both indicators extreme zones using crosses. It means where cross is rendered intersection of extremes has occurred.
The standard deviation uses the same calculation as my Standard deviation zones Support & Resistance indicator, DMI indicator measures both the strength and direction of a price movement. I am using both indicators to find the intersection of extreme zones between them.
ST DEV settings:
source
tops setting
bottom setting
DMI settings:
length settings
extreme zone setting
Enjoy,
Lukas
표준 편차
STDev BandsReally simple script for dynamic support and resistance. Takes means over last 1440 bars (1440 minutes in a day) and calculates seven stdevs up and down.
Exponential Regression Channel with novel volatilityThis code is a modified version of the built-in "linear regression" script of Tradingviews which can be plotted correctly on logarithmic charts
The log reg code of Forza was adjusted by altustro to generate an exponential regression (or a correct linear regression on the log scale, this is equivalent).
The standard deviation in the log scale is a better volatility measure which we call novola, and which defines the trend channel displayed in addition to the main indicator.
The exponential regression slope and channel also defines the typical holding time of the stock and the SL/TP boundaries, which are calculated and displayed at the last bar.
The display works both in log and regular scale. But only in the log scale it can be compared to the linear extension, which can also be plotted when activated in the properties.
The underlying exponential fit can not be displayed in regular scale as only lines can be plotted by TV. But with the related script Exponental Regression also the exponential regression can be exactly displayed using a workaround.
SMADIF4 IndicatorIt shows a percentage difference between close and 4-SMA, 20, 50, 100 and 200. As it turns greener, the stock is more expensive, and vice versa, it turns redder when it becomes cheaper relative to the SMA. It will print the green backgraound as long as the bar closes above the 200 SMA and red as long as the bar closes below the 200 SMA. It uses by default 1.3 sigma to discriminate non-representative values and 100 bars in the past.
Bar StatisticsThis script calculates and displays some bar statistics.
For the bar length statistics, it takes every length of upper or lower movements and calculates their average (with SD), median, and max. That way, you can see whether there is a bias in the market or not.
Eg.: If for 10 bars, the market moved 2 up, then 1 down, then 3 up, then 2 down, and 2 up, the average up bars length would be at 2.33, while the average for the down length would be at 1.5, showing that upper movements last longer than down movements.
For the range statistics, it takes the true range of each bar and calculates where the close of the bar is in relation to the true low of it. So if the closing of the bar is at 10.0, the low is at 9.0, and the high is at 10.2, the candle closed in the upper third of the bar. This process is calculated for every bar and for both closing prices and open prices. It is very useful to locate biasses, and they can you a better view of the market, since for most of the time a bar will open on an extreme and close on another extreme.
Eg.: Here on the DJI, we can see that for most of the time, a month opens at the lower third (near the low) and closes at the upper third (near the high). We can also see that it is very difficult for a month to open or close on the middle of the candle, showing how important the first and the last day are for determining the trend of the rest of the month.
Exponential RegressionIn Tradingview it is not possible to actually display arbitrary non-linear functions retrospectively.
Series objects can only depend on the current or past bars
Thus, while regression is possible, display of a non-linear curve into the past is not possible
This script is a workaround to be able to still display an exponential fit of the last n bars.
It is based on a linear regression of the log(close). The parameters of this regression are printed in the label.
To create the correct plot, these parameters have to be written into the properties of the indicator.
The functions displayed follow the expression exp(A)* exp(pot*t+d)
where d =0 for the center line, and d = +-std * upperMult for the upper and lower line respectiveley.
The parameters of the function are:
amplitude in log scale A
exponent of the exponential function pot
standard deviation of the linear regression std
number of bars of the current chart bindex
multiplicator of the std of the upper and lower exponential line upperMult and lowerMult +
This code is a version of the built-in "linear regression" script of Tradingview alztered by Forza so it can be plotted correctly on logarithmic charts
The code of Forza was further adjusted by altustro to be able to plot the full exponential curve also in regular scale
myRangestatCalculates the average daily range as well as the standard deviation of the daily range over a given period.
Adding both values gives you a statistical range (bottom to top or top to bottom) in which price can be expected to move.
[KL] Double Bollinger Bands Strategy (for Crypto/FOREX)This strategy uses a setup consisting of two Bollinger Bands based on the 20 period 20-SMA +/-
(a) upper/lower bands of two standard deviations apart, and
(b) upper/lower bands of one standard deviation apart.
We consider price at +/- one standard deviation apart from 20-SMA as the "Neutral Zone".
If price closes above Neutral Zone after a period of consolidation, then it's an opportunity for entry. Strategy will long, anticipating for breakout.
The illustration below shows price closing above the Neutral Zone after a period of consolidation.
a.c-dn.net
Position is exited when prices closes at Neutral Zone (being lower than prior bars)
Ultimate Moving Average Bands [CC+RedK]The Ultimate Moving Average Bands were created by me and @RedKTrader and this converts our Ultimate Moving Average into volatility bands that use the same adaptive logic to create the bands. I have enabled everything to be fully adjustable so please let me know if you find a more useful setting than what I have here by default. I'm sure everyone is familiar with volatility bands but generally speaking if a price goes above the volatility bands then this is either a sign of an extremely strong uptrend or a potential reversal point and vice versa. I have included strong buy and sell signals in addition to normal ones so darker colors are strong signals and lighter colors are normal ones. Buy when the lines turn green and sell when they turn red.
Let me know if there are any other scripts you would like to see me publish!
Zigzag CloudThis is Bollinger Band built on top of Zigzags instead of regular price + something more.
Indicator presents 7 lines and cloud around it. This can be used to visualize how low or high price is with respect to its past movement.
Middle line is moving average of last N zigzag pivots
Lines adjacent to moving average are also moving averages. But, they are made of only pivot highs and pivot lows. Means, line above moving average is pivot high moving average and line below moving average is pivot low moving average.
Lines after pivot high/low moving averages are upper and lower bolllinger bands based on Moving Average Line with 2 standard deviation difference.
Outermost lines are bollinger band top of Moving average pivot high and bollinger band bottom of moving average pivot low.
pricing_tableThis script helps you evaluate the fair value of an option. It poses the question "if I bought or sold an option under these circumstances in the past, would it have expired in the money, or worthless? What would be its expected value, at expiration, if I opened a position at N standard deviations, given the volatility forecast, with M days to expiration at the close of every previous trading day?"
The default (and only) "hv" volatility forecast is based on the assumption that today's volatility will hold for the next M days.
To use this script, only one step is mandatory. You must first select days to expiration. The script will not do anything until this value is changed from the default (-1). These should be CALENDAR days. The script will convert to these to business days for forecasting and valuation, as trading in most contracts occurs over ~250 business days per year.
Adjust any other variables as desired:
model: the volatility forecasting model
window: the number of periods for a lagged model (e.g. hv)
filter: a filter to remove forecasts from the sample
filter type: "none" (do not use the filter), "less than" (keep forecasts when filter < volatility), "greater than" (keep forecasts when filter > volatility)
filter value: a whole number percentage. see example below
discount rate: to discount the expected value to present value
precision: number of decimals in output
trim outliers: omit upper N % of (generally itm) contracts
The theoretical values are based on history. For example, suppose days to expiration is 30. On every bar, the 30 days ago N deviation forecast value is compared to the present price. If the price is above the forecast value, the contract has expired in the money; otherwise, it has expired worthless. The theoretical value is the average of every such sample. The itm probabilities are calculated the same way.
The default (and only) volatility model is a 20 period EWMA derived historical (realized) volatility. Feel free to extend the script by adding your own.
The filter parameters can be used to remove some forecasts from the sample.
Example A:
filter:
filter type: none
filter value:
Default: the filter is not used; all forecasts are included in the the sample.
Example B:
filter: model
filter type: less than
filter value: 50
If the model is "hv", this will remove all forecasts when the historical volatility is greater than fifty.
Example C:
filter: rank
filter type: greater than
filter value: 75
If the model volatility is in the top 25% of the previous year's range, the forecast will be included in the sample apart from "model" there are some common volatility indexes to choose from, such as Nasdaq (VXN), crude oil (OVX), emerging markets (VXFXI), S&P; (VIX) etc.
Refer to the middle-right table to see the current forecast value, its rank among the last 252 days, and the number of business days until
expiration.
NOTE: This script is meant for the daily chart only.
STDev % by Alejandro PThis is a simple indicator that expands the usability of Standard deviation into a universally usable indicator.
This indicator displays the volatility as standard deviation as a % of asset value, this allows using more standardized and comparable values across multiple instruments and asset classes.
Standard Deviation PercentageThis indicator plots Standard Deviation in Percentage. Standard deviation depicts how far is price from its mean.
By default it shows Standard Deviation Percentage for 10 periods.
While price will be moving away from mean, it will be printed in green, while price will retrace towards mean, it will be printed in red.
Currently, we have indicators available to print Standard Deviation but value of standard deviation depends upon value of underlying. This indicator will show deviation from mean in terms of percentage.
Probability Distribution HistogramProbability Distribution Histogram
During data exploration it is often useful to plot the distribution of the data one is exploring. This indicator plots the distribution of data between different bins.
Essentially, what we do is we look at the min and max of the entire data set to determine its range. When we have the range of the data, we decide how many bins we want to divide this range into, so that the more bins we get, the smaller the range (a.k.a. width) for each bin becomes. We then place each data point in its corresponding bin, to see how many of the data points end up in each bin. For instance, if we have a data set where the smallest number is 5 and the biggest number is 105, we get a range of 100. If we then decide on 20 bins, each bin will have a width of 5. So the left-most bin would therefore correspond to values between 5 and 10, and the bin to the right would correspond to values between 10 and 15, and so on.
Once we have distributed all the data points into their corresponding bins, we compare the count in each bin to the total number of data points, to get a percentage of the total for each bin. So if we have 100 data points, and the left-most bin has 2 data points in it, that would equal 2%. This is also known as probability mass (or well, an approximation of it at least, since we're dealing with a bin, and not an exact number).
Usage
This is not an indicator that will give you any trading signals. This indicator is made to help you examine data. It can take any input you give it and plot how that data is distributed.
The indicator can transform the data in a few ways to help you get the most out of your data exploration. For instance, it is usually more accurate to use logarithmic data than raw data, so there is an option to transform the data using the natural logarithmic function. There is also an option to transform the data into %-Change form or by using data differencing.
Another option that the indicator has is the ability to trim data from the data set before plotting the distribution. This can help if you know there are outliers that are made up of corrupted data or data that is not relevant to your research.
I also included the option to plot the normal distribution as well, for comparison. This can be useful when the data is made up of residuals from a prediction model, to see if the residuals seem to be normally distributed or not.
Sigma Spikes [CC]Sigma Spikes were created by Adam Grimes and this is one of the best volatility indicators out there. This indicator not only gives you positive or negative volatility but with my version I can identify any sudden changes from the underlying trend. Buy when the line turns green and sell when it turns red.
Let me know if there were any other indicators you wanted to see me publish!
Linear Regression + Moving Average1. Linear Regression including 2 x Standard Deviation + High / Low. Middle line colour depends on colour change of Symmetrically Weighted Moving Average . Green zones indicate good long positions. Red zones indicate good short positions. (Custom)
2. Symmetrically Weighted Moving Average. Colour change depending on cross of offset -1. (Fixed)
3. Exponentially Weighted Moving Average. Colour change depending on cross with Symmetrically Weighted Moving Average. (Custom)
Intrangle - Straddle / StrangleIntrangle is an indicator to assist Nifty / Bank Nifty Option Writers / Sellers to identify the PE / CE legs to Sell for Straddle and Strangle positions for Intraday.
Basic Idea : (My Conclusion for making this Indicator)
1) Last 10 Years data says Nifty / Bank Nifty More than 66% of times Index are sideways or rangebound (within 1% day) .
2) Mostly, First one hour high and low working as good support and resistance.
Once First one hour complete, this indicator will show Strangle High (CE), Strangle Low (PE) and Straddle (CE/PE).
Straddle:
If you want to do straddle strategy, sell at the money strike (CE/PE) when price comes near to the straddle line (black line),
Strangle:
If you want to do Strangle strategy, sell Strangle High (CE) and Strangle Low (PE) when price comes near to the straddle line (black line). Both Strangle High and Low will be out of the money when price near to the straddle line (black line).
Adjustment: option adjustment to be done based on the price movement. Adjustment purely up to the user / trader.
Note1: If price not comes to near straddle line after first hour, better to stay light…
Note2: If first hour not giving wide High / Low, don’t use strangle strike based on this indicator. Straddle can be done any day with require adjustment / hedge. This Indicator is purely for education purpose, user / trader has to be back-tested before their start using it.
This indicator will work in Nifty / Bank Nifty only. Best Time frames are 3/5/15 Mins. This is purely made for Intraday
Happy Trading 😊
Coefficient of variation (standard deviation over mean)Shows the coefficient of variation defined as standard deviation over mean (for the specified window).
Risk Position Sizing tool using Coefficient of VariationA way to manage portfolio risk using relative standard deviation, also known as coefficient of variation. This tool tells you how much of each stock in shares and in value to buy adjusted for their volatility risk for a given starting account capital. A problem many people have is how to diversify an account and adjusting it for the risk involved in each equity. Many would put in an equal amount of capital value into each share but is it really equal if some equities have more risk than others? A solution is to adjust the portfolio by giving less weight to those that are more volatile or risky. It's done by using a starting percent of the account, preferably a small percent of it, and buying up shares with that same amount for each equity. Each equity will also be divided by the COV to risk adjust the portfolio by giving less weight to the more volatile stocks. This is done until as much of the initial capital in the account as possible is spent.
COV is how far away the price is from the mean or average. The further the price is from the mean the more risk or volatility there is. It uses standard deviation in its calculation. The problem with SD and ATR is that they are not relative to the past or to other equities to compare to. An application where COV can be used is risk portfolio management formulas. This does not take into account correlation or other equation parts in some portfolio management formulas but only the risk or volatility, the default volatility length is mostly arbitrary, and the lower risk stocks may end up being the slowest in performance.
The text label will show how many shares will be bought and how much value each equity will have. At the end it will show the initial capital that was started off with, the total shares bought, the total value of all the shares, and the amount of capital left over. If the sources are not blank then they will be used, to blank them you will need to reset the settings to default otherwise they might still be read. If you want to add more than the given 10 equity spaces to the portfolio then you will need to add in the code manually and add it to the chart. The denominator is perhaps the important part in these types of risk position sizing tools, you can change to other things such as risk-reward ratio instead of volatility or change the volatility type, etc.
[kai]mATRThis indicator is for calculating the volatility of any interval
mTR (green line): TR is extended to calculate multiple bars at once with magnification setting.
mATR (red line): ATR is extended to calculate multiple bars at once with magnification setting.
dev (blue line): standard deviation
If you turn on "divide source" in the settings, it will be the price volatility.
dev will be the same as BBW
このインジケーターは任意の区間のボラリティを計算するための物です
mTR(緑線) : TRを倍率設定で複数のバーをまとめて計算する用に拡張したものです
mATR(赤線) : ATRを倍率設定で複数のバーをまとめて計算する用に拡張したものです
dev(青線) : 標準偏差
設定で「divide source 価格変動率」をONにすると価格変動率になります
devはBBWと同じになります
Projected Bollinger Bands - Quadratic RegressionBased on the work of Alex Groove : https://www tradingview com/script/YnoXd2AY-forecasting-quadratic-regression/
and also based on https://www tradingview com/script/YnoXd2AY-forecasting-quadratic-regression/ by capissimo
Notes:
1. This Bollinger Bands uses the QREG as its middle line (not MA as the original Bollinger Bands) so this should be acknowledged.
2. This indicator forecasts 3 candles (periods) ahead.
3. The label's position is quite messy, so you need to adjust the chart zoom in order to make the indicator doesn't overlap anything.
4. You need to manually set the time frame in the indicator settings because i'm not able to make the indicator recognizes it automatically
I'm trying to make the Bollinger Bands Forecasting from Quadratic Regression, and i'm really sure that there are a lot of mistakes here and there, so i 'm hoping corrections coming from you guys...
CHEERS!!!
[KL] Bollinger Bands Consolidation StrategyThis strategy will enter into long position based on the volatility of prices implied by indicators of (a) Bollinger bands, and (b) ATR.
Application of Bollinger bands ("BOLL")
Using plain vanilla settings for BOLL (i.e. 20 period moving average, and 2 standard deviations of closing prices), we are interested to know about the shape of the area that is bounded by the upper and lower bands.
In theory, consolidation happens when volatility of price decreases. Visually speaking, this is represented by the narrowing of the upper/lower bands. This strategy considers the narrowing of BOLL bands as the primary indicator for long-entry.
Application of ATRs (as confirmations)
Firstly, to confirm that BOLL bands are narrowing (as mentioned above), the ATR at a potential point of entry is compared against the standard deviation of prices over BOLL's lookback periods. Once again, visualizing the shape of BOLL bands during consolidation, we assume the lines begin to squeeze when the distance between the center line and upper/lower band is less than two current ATRs.
Secondly, this strategy looks into the moving average of ATRs to assure that prices are not too choppy when entering into market. If the moving average of ATR decreases at a point in time such that all the above conditions are met, then we can assert that the volatility of price is decreasing.
Thirdly, ATR is used for determining the size of our trailing stop loss. We will keep the multiplier fixed at two.
Kolmogorov-Smirnov TestThe Kolmogorov–Smirnov test aims to tell you if the distribution of prices (or log returns) tends to follow a normal distribution or not. You can read about this test on Wikipedia . It seems to be a basic but trusted measure in the quantitative trading world.
When KS-t columns are blue, then it's safe to assume normal distribution. When they are red, the normal distribution assumption is proven wrong by the magnitude of the KS-t value.
In the plotting tab of the script, you can activate another option that displays the probability of the distribution being actually normal. It's values are bounded between 0 and 1, like all probabilities.
This test can be useful when using statistical concepts for trading markets, like standard deviations, z-scores, etc because they all depend on the assumption of prices (or log returns) being normaly distributed.
If you see something wrong, don't hesitate to message me.
Happy trading to all.