SMU STDEV Candles This script creates a STDEV in a candle format so you can see the Change in a candle format and compare it with the actual price candle.
Is very similar to SMU RSI and SMU ROC. The interesting part is to see the full effect of traditional indicators in a candle format rather than a simple plot format. Very interesting view in SPX. There is a very big clue in the chart as STDEV changed since 2008. Can you figure it out?
Also, try this in lower time frame and you will be amazed how Algo kills volatility after each upside or downside. Fascinating
Sisihan Piawai
r2 correlation coefficientmade a quick script to compare r2 correlation coefficient, can change source and correlation component in inputs menu
example, here we can see that btc currently has a 0.85 correlation with eth vs usd when using simple moving avg on the daily (above 0.8 is positive correlation. below -0.8 is negitive correlation, and anything in between means there is no correlation)
note: if you wanted to compare with a different source like rsi, then you would need to reduce the length in the inputs menu
not an expert, i encourage doing your own research
biffy
sma dipsparity and sdvFXBTCJPY 1min contrarian script (2020/1/30)
1分足の逆張りです.
If you want to use other timescale, need to change disparity rate and sdv.
To display disparity(sma) and standard deviation, and to draw a hline(pine function) a certain valu. And lets think. I thought disparity rate 1~1.3 or -1~-1.3 are able to use constrarian trade (and sdv>600).
In bottom, disparity index is auxiliary. It is different from the multiple in the script to make the value easier to understand.
Sorry if the expiration date of the script has expired.
Pair Trade cryptoPair trade for crypto with inputs:
* length of correlation and moving average
* trade pair
* spread threshold to enter long / short
* spread threshold to exit long / short
Pair TradePair trade with inputs:
* length of correlation and moving average
* trade pair
* spread threshold to enter long / short
* spread threshold to exit long / short
Bollinger Band BreakoutIt is a long only strategy.
1. Buy when price breaks out of the upper band.
2. Exit has two options. Option 1 allows you to exit using lower band. Option 2 allows you to exit using moving average.
3. Option 1 preferred over option 2 if the instrument is highly volatile.
4. Slippage and commissions are not considered in the return calculation.
Exponential Deviation Bands [ChuckBanger]This is Exponential Deviation Bands. It is a price band indicator based on exponential deviation rather than the more traditional standard deviation, as you find in the well-known Bollinger Bands calculation. As compared to standard deviation bands, exponential deviation bands apply more weight to recent data and generate fewer breakouts. There fore it is a much better tool to identifying trends.
One strategy on the daily can be
Buy next bar if closing price crosses below the lower bands
Sell if price is equal to the current value of the upper bands
ACTION Locator v2.0The indicator is based on making the standard deviation (where the mean is a moving average) a two-lines cross indicator, by applying an MA over it. When the standard deviation is above the MA, there is considered to be enough volatility in the market for trends to form.
Blue background = There is ACTION in the market -- signals it should be safe to trade
Gray background = No ACTION - DO NOT TRADE!
Variable Index Dynamic Average (VIDYA) BandsThis adds volatility bands to the Variable Index Dynamic Average (VIDYA). The bands are calculated using the exponential moving average of the standard deviation of the VIDYA.
Thanks to everget for programming the VIDYA for tradingview.
Bollinger Bands Width 10標準偏差Standard Deviation(bolliger bands width)を10本重ねたものになります。お好みのスパン、色、σでお使いください。
Anchored VWAP & Standard DeviationsCalculates VWAP from a fixed point in time as well as standard deviations.
--------------------------------------
If you find it useful please consider a tip/donation :
BTC - 3BMEXEDyWJ58eXUEALYPadbn1wwWKmf6sA
--------------------------------------
All Time VWAP & Standard DeviationsAll time VWAP and standard deviations.
Either enable "scale price chart only" or disable deviations that go negative in the style options.
--------------------------------------
If you find it useful please consider a tip/donation :
BTC - 3BMEXEDyWJ58eXUEALYPadbn1wwWKmf6sA
--------------------------------------
Custom Timeframe FibsThis is a testing project for fib levels to try out fivs on multi timeframes
Thank you ShoujiSuzuki
Linear Regression Trend ChannelThis is my first public release of indicator code and my PSv4.0 version of "Linear Regression Channel", as it is more commonly known. It replicates TV's built-in "Linear Regression" without the distraction of heavy red/blue fill bleeding into other indicators. We can't fill() line.new() at this time in Pine Script anyways. I entitled it Linear Regression Trend Channel, simply because it seems more accurate as a proper description. I nicely packaged this to the size of an ordinary napkin within 20 lines of compact code, simplifying the math to the most efficient script I could devise that fits in your pocket. This is commonly what my dense intricate code looks like behind the veil, and if you are wondering why there is no notes, that's because the notation is in the variable naming. I excluded Pearson correlation because it doesn't seem very useful to me, and it would comprise of additional lines of code I would rather avoid in this public release. Pearson correlation is included in my invite-only advanced version of "Enhanced Linear Regression Trend Channel", where I have taken Linear Regression Channeling to another level of fully featured novel attainability using this original source code.
Features List Includes:
"Period" adjustment
"Deviation(s)" adjustment
"Extend Method" option to extend or not extend the upper, medial, and lower channeling
Showcased in the chart below is my free to use "Enhanced Schaff Trend Cycle Indicator", having a common appeal to TV users frequently. If you do have any questions or comments regarding this indicator, I will consider your inquiries, thoughts, and ideas presented below in the comments section, when time provides it. As always, "Like" it if you simply just like it with a proper thumbs up, and also return to my scripts list occasionally for additional postings. Have a profitable future everyone!
Breakout Reversal Entry on WMA - NG1! Overnight ver 1This script is for learning purposes only
This strategy will plot arrows when price breaks so far above/below WMA. The strategy will enter when the price breaks away from WMA. All entries are reversals. Users can set WMA length and source; also the distance of the price away from WMA to enter. Adjustable bracket orders are placed for exit, with trailing stop or market stop choice. Last, users can set the time of day they want to enter a trade.
My Preference: I am testing this strategy on NG1! over night on 1 minute candle. with .003 on price drop/climb, I get entries almost every night. Also 10 tick stop and 5 tick profit seems backward to most, but with a high win/loss ratio, it performs quite well. Trailing stops generally help out as well.
INPUTS:
Length - The is the WMA length
Source - WMA source (High, Low, Open, Close...)
When Price Drops - This is the distance in ticks when the price drops away from WMA, an arrow is plotted, and reversal entry order is placed
When Price Climbs - Same as price drop, just in the opposite direction
Trailing Stop check box - Check if you want to place a trailing stop so many tick away from entry. Unchecked is Market (hard) stop so many ticks from entry.
Stop - Number of ticks away from entry a the stop or trailing stop is set (for NG 1 tick = $0.001)
Limit Out - Number of ticks away from entry a limit order is placed to take profits
Limit Time of day check box - check to use the time of day to limit what time of day order entry will occur.
Start/Stop Trades (Est Time) - First box is when the strategy will be allowed to start buying and stop is when the strategy will stop being allowed to buy. Sell orders continue until a stop or limit triggers an exit. These times are Eastern time zone
PROPERTIES:
Pyramiding - This feature will allow multiple entries to occur. If set to 1, the strategy should only trade 1 contract at a time. If set to 2, the strategy will enter a second order if entry requirements are met. This allows you to be holding 2 contracts. Basically on a good day, it will multiply your earnings, on a bad day, you'll just lose more. For testing, I keep this on 1.
TIPS:
- If you want to go long only, set "When Price Climbs" to an impossible number, like 10,000. It's not possible for NG to move $10 is a matter of minutes so it will not enter the market with a short order. Also keep in mind you can set different requirements for going long vs going short. If you think there is more pull on the market in a particular direction.
Standard Deviation - Sum Of The Squares Minus Square Of The SumsIntroduction
The standard deviation measure the dispersion of a data set, in short this metric will tell you if your data is on average closer or farther away from the mean. Its one of the most important tools in statistics and living without it is pretty much impossible, without it you can forget about Bollinger-bands, CCI, and even the LSMA (ouch this hurt) .
Now i don't want to extend myself about the standard deviation since that would require a huge post but i want to show you how to calculate the standard deviation from the stdev pinescript function.
Sum Of The Squares Minus Square Of The Sums
Any metric calculated from a moving average can be classified as "running", this mean that the metric constantly update itself and is not constant, this is why it is better to say "running standard deviation" but its okay. If we use the standard calculation for the standard deviation which would be sqrt(sma(pow(close - sma,2))) we might get something totally different from the stdev function :
In white the pine stdev function and in red the standard calculation of both period 4, its clear that both are not the same, one might try to use the Bessel's correction but that won't do either, this is because most technical analysis tools will calculate the square root of the "Sum Of The Squares Minus Square Of The Sums" method to estimate the standard deviation
Another way is to use :
a = sqrt(sma(pow(close,2),length) - pow(sma(close,length),2))
By returning the difference we might still see some errors :
Nothing relevant of course.
Conclusion
Some of you might already be aware of this but a reminder is always good since it can be confusing to make what can be considered the good standard deviation formula and then have something totally different from the pine function, i hope this post will be useful and that you learned something from it.
Thanks for reading :)
Realized VolatilityRealized / Historical Volatility
Calculates historical, i.e. realized volatility of any underlying. If frequency is not the daily, but for example 6h, 30min, weeks or months, it scales the initial setting to be suitable for the different time frame.
Examples with default settings (30 day volatility, 365 days per year):
A) Frequency = Daily:
Returns 30 day historical volatility, under the assumption that there are 365 trading days in a year.
B) Frequency = 6h:
Still returns 30 day historical volatility, under the assumption that there are 365 trading days in a year. However, since 6h granularity fits 4 times in 24 hours, it rescales the look back period to rather 30*4 = 120 units to still reflect 30 day historical volatility.
RSI & MACDJust combined the template RSI and MACD scripts from the pine library and it seems to work better in pine version 4 :) ty tradingview!
Self-Adjusting RSI +Here is an open source (no request needed!) version of the Self-Adjusting RSI by David Sepiashvili.
Published in Stocks & Commodities V. 24:2 (February, 2006): The Self-Adjusting RSI
David Sepiashvili's article, "The Self-Adjusting RSI," presents a technique to adjust the traditional RSI overbought and oversold thresholds so as to ensure that 70-80% of RSI values lie between the two thresholds. Sepiashvili presents two algorithms for adjusting the thresholds. One is based on standard deviation, the other on a simple moving average of the RSI.
This script allows you to choose between plotting the Self-Adjusting bands or the traditional bands. You can also plot a smoothed RSI (SMA or EMA) and change the theme color for dark or light charts.
If you find this code useful, please pass it forward by sharing open source!
Thank you to all of the open source heroes out there!
"If I have seen a little further it is by standing on the shoulders of Giants."
Deviation Magnet - JDThis indicator shows price in relation to the standard deviations in a normalised way.
It can be seen as a kind of Bollinger Bands, where the bands stay the same size apart and price amplitude is modified between them,
or as a 'normalised' version of my BBC indicator.
Contrary to the popular use where price is seen as BOUNCING AGAINST the different deviations (or upper and lower BBands),
I tend to find that price likes to STICK to those deviations once it hits them (with a high or a low wick) and "rides them" for a while.
I call this "THE MAGNET EFFECT" of the standard deviations.
The indicator highlights those "MAGNET MOVES".
For most assets I like to use 50 period deviations better than the standard 20 period because it shows the bigger trends better
but of course this can be modified to your liking!
JD.
#NotTradingAdvice
#DYOR
I build these indicators for myself and provide them open source, to use for free to use and improve upon,
as I believe the best way to learn is toghether.
ATR Z ScoreThis script normalizes ATR to a Z Score, or a number of standard deviations it is from its long term average, positive or negative.
Gann Square Of 9 LevelsThis script uses the last hlc3 value of 1H, 4H, D and/or W and rotates it 360º up/down with four increments of 90º to find out potential support and resistance areas. Can be used as a dynamic support & resistance tool or just to gauge how overbought/oversold the market is. Special thanks to @Nv56 for his assistance in writing this script.
Bollinger Bands MTF [LonesomeTheBlue]With this script you can follow Bollinger Bands for current and higher time frame together. Higher time frame is calculated by script.
if current period
1m => higher period=5m
3m => higher period=5m
5m => higher period=15m
15m => higher period=1h
30m => higher period=1h
45m => higher period=1h
1h => higher period=4h
2h => higher period=4h
3h => higher period=4h
4h => higher period=1day
1day => higher period=1week