CBG MultiAverages ColorsThe latest version of my multiple moving averages. Now includes up to 14 moving averge lines plus a separate slow and fast moving average that can be assigned a different MA type.
In the screen shot is the fast/slow set to Hull with 15/50 periods. It is overlaid on top of my Key Numbers indicator.
7 moving averages in 1 indicator, including the Hull Moving Average .
SMA
EMA
Weighted
Hull
Symetrical
Volume Weighted
Wilder
Linear Regression
Lots of other features like background shading and paint bar colors.
Weighted
Weighted Average Calculator - evoTest version of a weighted average calculator, will make an update later with more functions and a better view.
For now it's mainly useful for getting an average value and see how you can ladder into your position,
if you use the weights as the amount you want to order, you can see the total value and expected loss in the label.
You can use the weights as percentage or any numbers you like, but expected loss won't apply to that for now (before update)
5 values and weights available
If you have ideas to add anything or find mistakes send me a message.
Calculator (weighted) - evoA tool to calculate the average price and position size.
The "Risk Amount" input means the amount of dollars you lose if the trade gets stopped out (it should be based on a small percentage of your account).
TIPS
- If you use the weights to calculate an average price, make sure it adds up to 100% in total or you will get a weird number.
- Keep an eye on the risk amount if you take a trade, if I ever update the script it might set back to default which will change your position size.
- I tested it all but you might trade in a different way than me, so do your own calculation for every new thing you try with it.
If you find any bug please tell me so that no one ends up with a weird calculation or position size.
Decaying Rate of Change Non Linear FilterThis is a potential solution to dealing with the inherent lag in most filters especially with instruments such as BTC and the effects of long periods of low volatility followed by massive volatility spikes as well as whipsaws/barts etc.
We can try and solve these issues in a number of ways, adaptive lengths, dynamic weighting etc. This filter uses a non linear weighting combined with an exponential decay rate.
With the non linear weighting the filter can become very responsive to sudden volatility spikes. We can use a short length absolute rate of change as a method to improve weighting of relative high volatility.
c1 = abs(close - close ) / close
Which gives us a fairly simple filter :
filter = sum(c1 * close,periods) / sum(c1,periods)
At this point if we want to control the relative magnitude of the ROC coefficients we can do so by raising it to a power.
c2 = pow(c1, x)
Where x approaches zero the coefficient approaches 1 or a linear filter. At x = 1 we have an unmodified coefficient and higher values increase the relative magnitude of the response. As an extreme example with x = 10 we effectively isolate the highest ROC candle within the window (which has some novel support resistance horizontals as those closes are often important). This controls the degree of responsiveness, so we can magnify the responsiveness, but with the trade off of overshoot/persistence.
So now we have the problem whereby that a highly weighted data point from a high volatility event persists within the filter window. And to a possibly extreme degree, if a reversal occurs we get a potentially large "overshoot" and in a way actually induced a large amount of lag for future price action.
This filter compensates for this effect by exponentially decaying the abs(ROC) coefficient over time, so as a high volatility event passes through the filter window it receives exponentially less weighting allowing more recent prices to receive a higher relative weighting than they would have.
c3 = c2 * pow(1 - percent_decay, periods_back)
This is somewhat similar to an EMA, however with an EMA being recursive that event will persist forever (to some degree) in the calculation. Here we are using a fixed window, so once the event is behind the window it's completely removed from the calculation
I've added Ehler's Super Smoother as an optional smoothing function as some highly non linear settings benefit from smoothing. I can't remember where I got the original SS code snippet, so if you recognize it as yours msg me and I'll link you here.
Farey Sequence Weighted Moving AverageA moving average that weighted with Farey fractions. It matches a standard linear weighted average almost one-to-one. Why? Because both averages have strictly monotonic weighting sequences and assign a higher weight to latests data. So, Farey weights are just scaled to linear ones. Instead of specifing period you specify an order of Farey sequence. To learn more about Farey sequence you can refer to Wiki
Published just for reference, it is not intended for trading purposes.
Volume Weighted DistanceThis script holds several useful functions from statistics and machine learning (ML) and takes measurement of a volume weighted distance in order to identify local trends. It attempts at applying ML techniques to time series processing, shows how different distance measures behave and gives you an arsenal of tools for your endeavors. Tested with BTCUSD.
REM: oddly enough, many people forget that the scripts in PS are generally just STUDIES, i.e. exercises, experiments, trials, and do not embody a final solution. Please treat them as intended ;))
Forecasting - Locally Weighted Regression (rescaled)UPDATE: the original version works only with BTC. Here's a general version with rescaling.
Forecasting - Vanilla Locally Weighted RegressionThere is not much to say - just vanilla locally weighted regression in PineScript 4.
see: medium.com
also: cs229.stanford.edu
Forecasting - Locally Weighted RegressionThis is a continuation of the series on forecasting techniques.
Locally weighted linear regression is a non-parametric algorithm, that is, the model does not learn a fixed set of parameters as is done in ordinary linear regression. Rather parameters Θ (theta) are computed individually for each query point x. While computing Θ, a higher “preference” is given to the points in the training set lying in the vicinity of x than the points lying far away from x.
For a detailed discussion see www.geeksforgeeks.org
and for the formula see fawda123.github.io
Here you can see a shortcut application of this technique to time series with results unexpectedly favorable for price data labelling.
Good at detecting pullbacks. Can be incorporated into a trading system as a signal generator. Alerting is included.
Volume Weighted EMAAn EMA using the Volume Oscillator to integrate volume fluctuations into the EMA calculations.
Especially useful for Crypto and Forex
Volume Weighted Bollinger (Final, cleaned up visuals)Volume-weighted bollinger (normal stats application of weighting mean) with cleaned up visualization. Shaded area represents1sd-2sd move size for trailing 20 period average on timeframe for individual candles.
Volume Weighted Ichimoku (Cleaned Up Visuals)Ichimoku with cleaned up appearance on chart and volume-weighted highs / lows. Publishing this final version with open script.
Multi-TF Avg BBandsMULTI-TF AVERAGE BBANDS - with signals (BETA)
Overall, it shows where the price has support and resistance, when it's breaking through, and when its relatively low/high based on the magic of standard deviation.
created by gamazama. send me a shout if u find this useful, or if you create something cool with it.
%BB: The price's position in the boilinger band is converted to a range from 0-1. The midpoint is at 0.5
Description of parameters
"BB:Window Length" is the standard BB size of 20 candles.
The indicator plots up to 7 different %BB's on different timescales
They are calculated independently of the timescale you are viewing eg 12h, 3d, 30m will be the same output
You can enter 7 timescales, eg. if you want to plot a range of bbands of the 12h up to 3d graphs, enter values between 0.5 and 3 (days) - you can also select 0 to disable and use less timescales, or select hours or minutes
Take note if you eg. double the main multiplier to 40, it is the same as doubling all your timescales
You can turn the transparency of the 7 x %BB's to 100 to hide them, their average is plotted as a thick cyan line
"Variance" is a measure of how much the 7 BB's agree, and changes colour based on the thresholds used for the strategy
---- TO START FROM SCRATCH ----
- set all except one to ZERO (0), set to 0, and everything after to 0.
Turn ON and right click -> move the indicator to a new pane - this will show you the internal workings of the indicator.
Then there is a few standard settings
"Source Smoothing Amount" applies a basic small sma on the price.
It should be turned down when viewing candles with less information, like 1D or more.
Standard BBands use an SMA, there one uses a blend between VWMA or SMA
Volume Weight settings, the same as SMA at 0, and the same as VWMA at 1
BB^2 is a bband drawn around the average %BB. Adjust the to change its window length
The BB^2 changes color when price moves up or down
Now its time to look at the parameters which affect the buy/sell signals
turn on "show signal range" - you see some red lines
buy and sell each have 4 settings
min/max variance will affect the brigtness of the signal range
range adjust will move the range up/down
mix BB^2 blends between a straight line (0) and BB^2's top or bottom (1)
a threshold of "variance" and "h/l points" is available to generate weaker signals.
these thresholds can be increased to show more weak signals
ONCE YOU ARE HAPPY WITH THE SIGNALS being generated, you can turn OFF , and move it back to the price pane
the indicator then draws a bband around the price to maps some info into the chart:
fills a colour between 0.5 & the mid BB^2 and converts relative to the price chart
draws a line in the middle of the midband.
controls how much these lines diverge from the price - adjust it to reduce noise
converts the signal range (red lines) to be relative to the price chart
if you like, you can adjust the sell & buy signals in the tab from and to and to match the picture. It messes with auto-scaling when moving back to though
enjoy, I hope that is easy enough to understand, still trying to make this more user-friendly.
If you want to send me some token of appreciation - btc: 33c2oiCW8Fnsy41Y8z2jAPzY8trnqr5cFu
I promise it will put a fat smile on my face
Self-Weighted Moving AverageThis type of moving average was originally developed by Alex Orekhov at his home. This WMA uses previous prices as weights for the new ones. At the moment, this is a highly experimental approach, so don't use it in real trading.
The weighting scheme is presented on the chart.
Double Weighted Moving AverageMr. Jurik uses this weighted moving average to create a crossover trading system with his JMA.
To learn more see www.jurikres.com .
Good luck!
Inverse Distance Weighted Moving AverageThe weights of this moving average are the sums of distances between points.
Good luck!
Distance Weighted Moving AverageAdopted to Pine from systemtradersuccess.com
They wrote that this average is designed to be a robust version of a moving average to reduce the impact of outliers, but I dont see a significant difference comparing it with SMA. So, I published it for the educational purposes.
To learn more about the robust filters and averages google Hampel Filter, Interquartile Range Filter and Recursive Median Filter (or any other filter that is based on quartiles).
Good luck!
Fibonacci Weighted Moving AverageHello traders and developers!
The weights of this WMA are Fibonacci numbers. That's all)
Good luck and happy trading!
VW-MACDHello traders!
I am reading "Investing with Volume Analysis: Identify, Follow, and Profit from Trends" by Buff Pelz Dormeier so I am going to implement all indicators that are considered there.
VW-MACD was developed by Buff Pelz Dormeier in 2000 and is based on the difference between a short-term volume-weighted moving average and a long-term volume-weighted moving average. The signal line is traditionally left as an exponential moving average.
Like and follow for more cool indicators!
Happy Trading!
Coppock CurveThis indicator was originally developed by Edwin "Sedge" Coppock (Barron's Magazine, October 1962).
Specially for @AlexMayorov :
1) Buy when indicator crosses the zero line upside
2) Sell when indicator crosses the zero line downside
Henderson Weighted Moving AverageHenderson Weighted Moving Average script.
This indicator was originally developed by Robert Henderson in 1916 (Transaction of Actuarial Society of America, 17, pp. 43-48: Note on Graduation by Adjusted Average).
Spencer 21-Point Moving AverageSpencer 21-Point Moving Average script.
This indicator was originally developed by John Spencer in 1904 (J.I.A. 38, 334: On the graduation of the rates of sickness and mortality presented by the experience of the Manchester Unity of Oddfellows during the period 1893 - 1897).