Optimal Weighted Moving AverageThe Optimal Weighted Moving Average was created by Thomas Hutchinson and Peter G. Zhang, Ph.D. (Stocks & Commodities V. 11:12 (500-505)) and it is very similar to a classic weighted moving average but it uses the correlation between the input and the optimal weighted moving average output to use as the weights. Buy when the line turns green and sell when it turns red.
Let me know if you would like to see me publish any other scripts or if you want something custom done!
Weighted
TA Basics: Creating a Fibonacci Weighted Moving AverageIn the previous 2 posts in this series, we played around with simple math concepts to create a zero-lag moving average that can deliver fast response and less lag - that we can use to enable better trend following, or as filter / signal.
here we take a step further - instead of using equal weight for the moving average (as in the Simple moving average) or linear weights (as in the weighted moving average), we get to pick THE MAGIC SEQUENCE, Fibonacci.
we will use the Fibonacci Sequence as weights to produce our moving average - so practically, we create a "Fibonacci Weighted Moving Average" (let's call it FiMA) - and compare the result with other commonly-used moving averages of the same length
in a Fibonacci moving average, the data will be weighted based on the Fibonacci Series starting from 1 (for the furthest data point)
so for example, if we use a length of 10, the weights will be 1, 1, 2, 3, 5, 8, 13, 21, 34, 55 with the 55 being the weight applied to the most recent / current bar's selected value (close, hl2, hc3..etc) and moving backward
before i posted this script, i searched around to see if someone else has already wrote this - i found a couple, but the approach we use here in this code is different - i can't claim it to be more efficient - i honestly don't know - but the resulting code here, IMHO, is more compact and easier to integrate in other studies that you may like to put together to leverage this idea, to create your own indicators and strategies.
the reason the code here is more compact, is that it utilizes a shorter formula to calculate the FIb(n) - i included the source where i found that formula, and i tested it before using it in the code.
i also added an optional "extra smoothing" for the resulting MA, by simply calling the fima() function a second time (so like doing a 2-pass filter), with a smaller length on the result of the 1st pass. keep this smoothing small not to produce too much lag.
i like the outcome when compared to other moving averages - it has a fast response to data/trend change and less overshoot - but honesty i didn't see any real "Fibonacci Magic" :) .. but i'll leave the final judgement to those who use it - this is more of an experimental code in all cases - please feel free to use, change and share feedback.
Squared Weighted Moving AverageThe Squared Weighted Moving Average is similar to the classic Weighted Moving Average but the difference is that it squares the weights instead of the classic weight values. Buy if the indicator line is green and sell when it goes red.
Let me know if you would like to see any more scripts from me or if you want something custom done!
Weighted Bank MovementThe indicator comprises of a solid line that moves from -100 to +100 signifying the % of weighted movement among 12 banking stock constituting to the BANK NIFTY movement.
A positive value denotes the percentage of banks among the 12 banks that are trading above the previous HLC average ( High , Low , Close ) and vice versa a negative value denotes the percentage of banks trading below the previous HLC ( High , Low , Close ) average.
Comments and feedback are welcome.
Should you have any doubts or wish to access the script then please feel free to DM me.
Square Root Weighted Moving AverageThe Square Root Weighted Moving Average is similar to the classic Weighted Moving Average but the difference is that it uses the square root of the weights instead of the classic weight values. Buy if the indicator line is green and sell when it goes red.
Let me know if you would like to see any more scripts from me or if you want something custom done!
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 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.
RSI background by AvesTradingHello,
This is RSI indicator that shows background color, when proper levels reached, instead of line in another pane. Customizable options are available:
- source
- length
- overbought level
- oversold level
I have added as well RMA of RSI for extra confirmation if needed. I hope you enjoy and will leave me some feedback! Don't forget to follow me for new releases.
Cheers
Aves
Please remember that the indicators provided by me are for educational purposes only.
HLC3_VWAP_Fib_RibbonThis Script use Volume Weighted Average Price (VWAP) combined with Fibonacci Deviations of that value as Ribbons to show Support and Resistance levels, as well as estimate good Buy and Sell areas based on the extremity of distance from the central VWAP.
Features:
- Alerts exist for price crossover / crossunder the VWAP value, as well as any of the Fib Ribbon levels.
- Ribbons & Fills can be toggled on/off, leaving just the VWAP as a single line if desired.
- Using the Amplification setting, you can expand or contract the ribbons while maintaining the Fib Ratio, to fit different time-frames and volatility.
- Time-Frame and Length of VWAP can be changed while staying on the same Time-Frame chart view.
Volume Weighted RSI [ChuckBanger]This is volume weighted RSI (Relative Strength Index). In compressing to regular RSI it look like this:
The relative strength index detect an overbought/sold market when higher/lower than a certain level, often 80/20. An overbought market is more attractive to sell because prices are no longer attractive to buy, it has reached its value of interest for traders looking to go long, we can then expect the price to correct and start a trend of opposite direction, while an oversold market is more attractive to buy based on the same logic.
The idea of talking about overbought and oversold without taking into account the volume can be a bit strange, since volume is directly related to the market traded, an higher volume can show sign of a more active market, which can describe the terms : overbought/sold a bit better. The money flow index for example, use volume, but it is interesting to provide other alternatives like this indicator.
With OB and OS signals
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.
MMDVZ 1.0 - Moving Multi-Day VWAP ZonesVolatility adjusted moving multi-day VWAP zones
Directionality, trend and support/resistance levels at a glance
Useful for trading practically all kinds of stocks and futures.
Works well with many timeframes.
More updates to come, stay tuned
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.
Cuban's VWAP DivergencesAfter using many different divergence scripts, I struggled to find one that didn't indiscriminately signal a constant divergence while the price was trending.
This study attempts to solve this issue, along with filtering out false signals. I have found it to print less signals and to be more accurate.
It also gives you a confluence level between high probability reversals (labels) and lower probability reversals (crosses), and some clever trade logic in the candle colouring -- to signal when to take the trade.
I have added a night mode for aesthetic label colouring and an option to minimise labels all together.
I recommend using this study in conjunction with one of my other scripts; Cuban's LTF Trend Oscillator.
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