Weighted Least Squares Moving AverageLinearly Weighted Ordinary Least Squares Moving Regression
aka Weighted Least Squares Moving Average -> WLSMA
^^ called it this way just to for... damn, forgot the word
Totally pwns LSMA for some purposes here's why (just look up):
- 'realistically' the same smoothness;
- less lag;
- less overshoot;
- more or less same computationally intensive.
"Pretty cool, huh?", Bucky Roberts©, thenewboston
Now, would you please (just look down) and see the comparison of impulse & step responses:
Impulse responses
Step responses
Ain't it beautiful?
"Motivation behind the concept & rationale", by gorx1
Many been trippin' applying stats methods that require normally distributed data to time series, hence all these B*ll**** Bands and stuff don't really work as it should, while people blame themselves and buy snake oil seminars bout trading psychology, instead of using proper tools. Price... Neither population nor the samples are neither normally nor log-normally distributed. So we can't use all the stuff if we wanna get better results. I'm not talking bout passing each rolling window to a stat test in order to get the proper descriptor, that's the whole different story.
Instead we can leverage the fact that our data is time-series hence we can apply linear weighting, basically we extract another info component from the data and use it to get better results. Volume, range weighting don't make much sense (saying that based on both common sense and test results). Tick count per bar, that would be nice tho... this is the way to measure "intensity". But we don't have it on TV unfortunately.
Anyways, I'm both unhappy that no1 dropped it before me during all these years so I gotta do it myself, and happy that I can give smth cool to every1
Here is it, for you.
P.S.: the script contains standalone functions to calculate linearly weighted variance, linearly weighted standard deviation, linearly weighted covariance and linearly weighted correlation.
Good hunting
Đường Trung bình trượt có trọng số (WMA)
NSDT HAMA CandlesHAMA (Heiken-Ashi Moving Average) Candles are built using different moving average lengths for the open, high, low, and close. Those levels are then run through the Heiken-Ashi Candle formula to create a new hybrid candle on the chart. There is an additional Moving Average plotted as well for overall direction.
This may be used best for identifying trending markets. By referencing the HAMA Candle indicator, it may help guide you to stay in a trade a bit longer, or wait a bit longer before entering at the beginning of a potential trend.
We added a Gradient Color scheme option for a more colorful view of potential trend directional changes. The gradient code is taken from the Pinecoders Gradient Framework (Pro Advance/Decline Gradient example) at
There are three different Moving Average types to choose from. (EMA, SMA, WMA). All MA lengths can be modified. All colors can be modified. All options can be turned on or off.
This was previously an "invite-only" indicator, but we decided to publish it publicly and open source.
R950S- MehmetAltun
hello, it allows you to see both rsi and ma and ema values on the same screen. You can set the levels you want in the Aarlar section. You can make the coloring you want.
Configurable Multi MA Crossover Voting SystemThis strategy goes long when all fast moving averages that you have defined are above their counterpart slow moving averages.
Long position is closed when profit or loss target is hit and at least one of the fast moving averages is below its counterpart slow moving average.
The format of the config is simple. The format is : FASTxSLOW,FASTxSLOW,...
Example : If you want 2 moving averages fast=9,slow=14 and fast=20,slow=50 you define it like this : 9x14,20x50
Another example : 5x10,10x15,15x20 => means 3 moving average setups : first wih fast=5/slow=10, second with fast=10/slow=15, last with fast=15/slow=20
You can chose the type of moving average : SMA, WMA, VWMA (i got issues with EMA/RMA so i removed them)
You can chose the source of the moving average : high, close, hl2 etc.
You can chose the period on which ATR is calculated and ATR profit/loss factors.
Profit is calculated like : buy_price + atr_factor*atr
Loss is calculated like : buy_price - atr_factor*atr
Performance in backtest is variable depending on the timeframe, the options and the market.
Performance in backtest suggests it works better for higher timeframes like 1d, 4h etc.
Disclaimer
Please remember that past performance may not be indicative of future results.
Due to various factors, including changing market conditions, the strategy may no longer perform as well as in historical backtesting.
This post and the script don’t provide any financial advice.
Correlation StrategyThis is a basic strategy that shows how to trigger short/long/close signals on chart's symbol based on calculations made on another symbol which we consider correlated to it.
With default parameters, ETH/USDT as base symbol, the strategy shows good results in backtest for several symbols : DENT/USDT, BTT/USDT, FTT/USDT, DOT/USDT etc.
This is not surprising giving the importance of ETH in the crypto market so it makes sense many crypto currencies will follow ETH big movements.
Note : the strategy with default parameters is supposed to be applied on 4h timeframe. On other timeframes, try another support length.
How the strategy works :
A wma is calculated on the base symbol, with 200 length by default.
When wma is rising, we go long. When wma is falling we go short.
Take profit for Long/Short and Stop Loss for Long/Short are calculated percentages so 0.05 = 5% etc.
Also, Take profit / Stop loss are calculated on the base symbol not the chart's symbol.
The script uses the Monthly Returns table slightly modified to include buy & hold returns. Credits to @QuantNomad
JC blended MAs v3The best, simplest moving averages you'll find.
Well not really. But it does have SMA, WMA, and EMA in one place. Plus an additional one that averages those, that might give you a leg up because it's not really a standard thing and you won't create a massive worldwide machine-driven feedback loop that crashes the markets (instead profit from them). Or something like that.
Each moving average has their own definable averaging length.
The master time resolution is also definable, or you can use the chart's. (The latter which is not very useful for moving averages, yet so many of them on trading view don't let you specify otherwise.)
For example you can set the master resolution to 5 minutes, 1 hour, 1 day, etc. (Default is 1 hour.) The graphs don't change, only the resolution.
Note: There are a few rare, extreme edge cases where the graphs won't render, which are obvious. In which case all you need to do is choose a more sane resolution. This is more about the limits of Trading View than specific script bugs.
Cloud Ribbon ++ by [JohnnySnow]Inspired by my favorite EMA ribbon - "EMA Ribbon " by fskrypt.
This Ribbon ADD the option to choose the avarage algorithm of the ribbon .
Created also to be more friendly to read along with trendlines and Fibonacci retracements.
For those like me that NOT use this ribbon to find exact price action but instead, to have a grasp of possible Support/Resistance strenght ahead.
High transparency lines and a configurable color palette for filling the background give the ribbon a look of support/ Resistance cloud Strenght.
Each MA length, line, and background color can be easily configured.
Arch1tect's New Toy (Strategy Tester Version)Description:
The version of Arch1tect's New Toy indicator with Strategy Tester added.
This indicator tries to predict market trends by simply utilising 2 moving averages crossovers.
How it works:
Buy signals are triggered when the faster MA crosses over the slower MA from the downside to the upside.
Sell signals are triggered when the faster MA crosses under the slower MA from the upside to the downside.
How to use:
Take buys when buy signal is triggered AND close existing sell position
Take sells when sell signal is triggered AND close existing buy position
Note:
Settings are optimised for XAUUSD on the M1 chart.
Extra:
Alerts are included.
You can toggle between EMA, WMA and SMA to your liking.
Indicator version:
Inverse Fisher Transform on Williams %RInverse Fisher Transform On Williams %R
Since Williams R indicator produces negative values, I preferred to add 50 instead of subtracting 50.
It produces values between 0.5 and -0.5.
Generates clear buy and sell signals.
Williams %R determines overbought and oversold levels.
You can see more softly.
Dr.Om's SuperTrend IndicatorRiding along the Super Trend -
Super Trend Bullish candle (STBullCandle) is a candle where low is lower than supertrend and close is greater than super trend.
Conditions for going Long -
1. High of current candle should be higher than high of STBullCandle.
2. We can consider 1 or 2 candles after the STBullCandle for this condition.
3. If filterRsi is enabled, then we make an additional check of RSI being greater than the weighted moving average.
4. Should not be holding an existing long position
5. SuperTrend should be positive
Super Trend Bearish candle (STBearCandle) is a candle where high is higher than supertrend and close is lower than super trend.
Conditions for going Short -
1. Low of current candle should be lower than low of STBullCandle.
2. We can consider 1 or 2 candles after the STBearCandle for this condition.
3. If filterRsi is enabled, then we make an additional check of RSI being lower than the weighted moving average.
4. Should not be holding an existing short position
5. SuperTrend should be negative.
If holding long, EXIT LONG Position Criteria -
1. SL would be if close is lesser than the ST candle low
2. Direction of ST becomes Negative
3. If Reward to Risk ratio is given, then exit if target is achieved.
If holding short, EXIT SHORT Position Criteria -
1. SL would be if close is higher than the ST candle high
2. Direction of ST becomes +ve
3. If Reward to Risk ratio is given, then exit if target is achieved.
MA CloudMA Cloud - a highly configurable cloud for Moving Averages
Creates a cloud from max. 5 Moving Averages.
Users can freely decide, for each average wether it should be SMA,EMA or WMA and also for the time period.
They shades and colors can be freely chose for each combination of MA's, giving you a maximum freedom to configure your cloud.
Stochastic RSI + WMA + SMA strat// "...an entry signal it's a cross down or up on
// the stochastics. if you're in a downtrend
// on the hourly time frame you
// must also be in a downtrend on the five
// minute so the five period has to be below the 144
// as long as the five period is still trading below
// the 144 period on both the hourly and the five minutes
// we are looking for these short signals crosses down
// in the overbought region of the stochastic. Viceversa for longs"
// Works well with a wide stop with 20 bars lookback
// for the SL level and a 2:1 reward ratio Take Profit .
// These parameters can be modified in the Inputs section of the strategy panel.
Ultimate Moving Average [CC+RedK]The Ultimate Moving Average was created by myself and @RedKTrader and I can proudly say that this is the holy grail of moving averages. Not only does this moving average react to the current price trends like a normal moving average but we have also included the ability to react to volume, momentum, and volatility. The only thing this moving average can't do is wash your car.
The Ultimate Moving Average doesn't even use a set length so it is fully adaptable to any type of market whether it is choppy or trending. It tightens during volatile markets and loosens during choppy markets. I have included 3 of the main moving averages of a fixed length of 20 days to show you just how much better our moving average is.
The overall concept of this moving average was to fully adapt to any and all changes of the underlying stock. We used my Variable Power Weighted Moving Average as a base and changed the script to adapt to momentum instead. The idea behind this was when momentum reaches an extreme in either direction we tighten the moving average to be able to react accordingly. We then used the idea behind my Variable Length Moving Average to be able to react to volatility and make the length itself into a separate variable.
All of this work combined to create the most reactive moving average out there and I guarantee you will be using this in your daily trading! Let me know if there are any other scripts you would like to see me publish.
4 MA Strategy + Position Management// This is a simple crossover Moving Average strategy, good for long term crypto trades.
// It buys when the MA "X" crosses up the MA "Y", viceversa for shorts.
// Both MAs are selectable from the Inputs section in the front panel.
// There is also a Position Management option thats
// sizes positions to have the same USD risk (using leverage) on each trade,
// based on the percentage distance to the stop loss level.
// If you turn this option on you will see how the profit
// grows exponentially while the drawdown percentage almost remains the same.
Ehlers Distance Coefficient Filter [CC]The Distance Coefficient Filter was created by John Ehlers and this is one of his more unknown moving averages. It works well because in an uptrend or downtrend it behaves more like a trailing stop system but it also deals with issues like pullbacks pretty quickly. I think it works well with the default values but let me know if you find a more profitable system. Buy when the indicator turns green and sell when it turns red.
Let me know if there are any other indicators you would like to see me publish!
5MA_X_LThis is a 5 day moving average crossing long strategy in 10 min. chart, used in short term momentum trading strategy.
Momentum trading Strategy: When S&P 500 index is at up trend (or above 60 sma ), buy 10+ stocks in top 20% stock RS ranking at equal weight using this MA5X_L strategy. Change stocks when any stock exited by algorithm.
Back test start since 2020/7/1, each long entry for condition 1 is $30000, condition 2 is $20000, with max of 2 long positions.
Setup: 10 minutes chart
Buy condition 1) 3 wma cross up 195 wma (5day) 2) 3wma > 78wma > 195wma UP Trend Arrangement (UTA)
Exit condition 1) 3 wma cross under 195 wma 2) position profit > 20% and 3 wma cross under 6 ATRs line (green)
RedK Slow_Smooth Average (RSS_WMA)RedK Slow Smooth Average (RSS_WMA) is based on simple, multi-WMA passes to generate a moving average that sacrifices low-lag and fast responsiveness for the sake of smoothness.
This smoothness enables an increased trader ability to visualize and track longer-term trends and removes the noise of smaller, relatively insignificant price fluctuations.
Notes:
=========
* RSS_WMA is deliberately built to be a "lazy line" - and it works in a different way to other common moving averages that attempt to achieve less lag and quicker responsiveness - the idea and the use scenario is to act as a "smooth base" when used against a faster moving average like the v_Wave of the Co_Ra Wave
* Note that the settings of this line is "Smoothness' and not "length" - the initial length used for the first WMA pass calculation is 1/3 of that smoothness value selected in the settings
* Increments in the combined smoothness value will be allocated first to 1st WMA pass, then 2nd WMA pass, then 3rd pass consecutively then back to 1st pass.
* because we utilize 3 WMA passes, a settings below 3 will have no effect on the line and it will just track the "source" price.
Suggested Use:
===============
- Use RSS_WMA when you're looking for a smooth moving average that can help you analyze you chart at a broader / macro level, visualize the broader price action patterns and filter out the noise from short-term moves. you can also use this line to help set your position exits since only major and persistent moves will cause this line, as lay as it is, to swing from one direction to the other.
How does RSS_WMA compare?
============================
here's a quick view of how the RSS_WMA compared to other commonly used Moving Averages, including my recently published CoRa_Wave
Code is commented - please feel free to use and customize further - please share a comment if you found this useful in your chart analysis or trading.
Directional Matrix [LuxAlgo]Returns a dashboard showing the direction taken by 4 overlay indicators, SMA (simple moving average), TMA (triangular moving average), WMA (weighted moving average), and REG (linear regression), all using different length periods.
The user can select the minimum and maximum length of these indicators and introduce an increment.
1. Settings
Maximum Length: The end value of sequences of the indicator periods to analyze
Minimum Length: The starting value of sequences of the indicator periods to analyze
Step: Determines the spacing between each indicator periods values
Src: Data source for each of the 4 indicators
1.1 Style settings
Normalized Change Mode: Allows the user to access a different interpretation of the indicator by showing the normalized first differences of each indicator in the dashboard instead of their sign
Dashboard Location: Location of the dashboard on the chart
Dashboard Size: Size of the dashboard on the chart
Text/Frame Color: Determines the color of the frame grid as well as the text color
Bullish Cell Color: Determines the color of cell associated with a rising indicator direction
Bearish Cell Color: Determines the color of cell associated with a decreasing indicator direction
Cell Transparency: Transparency of each cell
2. Usage
Each of the indicators included in the dashboard aim to give an estimate of the underlying trend in the price. Knowing which direction they are taking can help us have a broader view regarding the direction of shorter/longer-term trends. We will later see that this is not the only kind of information that we can get from this indicator.
Rising indicators are represented by blue cells (or the color selected in the Bullish Cell Color setting) while decreasing indicators are represented by red cells (or the color selected in the Bearish Cell Color setting).
The percentage of bullish cells is given in the top-left cell of the dashboard.
2.1 Normalized change mode
Enabling the Normalized Change mode will display the normalized changes returned by the indicators over different length periods. This metric is within a range (0,1), with 1 indicating the highest change over the selected length periods, while 0 indicates the lowest one.
When enabling this mode the color of the cells makes use of a gradient with a color palette ranging from the color selected in the Bearish Cell setting to the color selected in the Bullish Cell setting.
2.1 Other Usage
The direction taken by certain indicators can give more information than one would think. Indeed, the sign of the change of one indicator can often be given by different indicators.
A positive change in a simple moving average indicates that the price is greater than the price p bars ago, where p is the period of the simple moving average.
A positive change in a triangular moving average indicates that a simple moving average of period p is above a simple moving average of period p × 2 , where p is the period of the triangular moving average (note that we assume here that the TMA is given by cascading two SMAs of period p ).
A positive change in a weighted moving average indicates that the price is above a simple moving average of period p+1 , where p is the period of the WMA.
Finally, a positive change in a linear regression indicates that a weighted moving average is above a simple moving average of period p , where p is the period of the linear regression.
Yusram Mount MaV - Day MaV CrossOver Strgty
This indicator shows the comparison between the 7-day fast simple average and the monthly slow average of 5 bars. The red line indicates the monthly green and blue lines the daily average. If the Green-Blue line crosses the red upwards, it is a buy signal and the opposite is a sell signal. As soon as it turns green blue without waiting for the sell signal, a sell signal is created. If you are trading fast, you can consider turning green to blue as an opportunity. In the long run, the red intersection can be interpreted as a Stop point.
I hope it will be useful to everyone.
You can also find the strategy indicator with the same name.
I got the name of this indicator from my daughter's name. The meaning of the name Yüsra means "convenience". I hope this indicator will help you.Yüsram Mount HO - Day HO
Yusram Mount MaV - Day MaVYüsram Mount HO - Day HO
This indicator shows the comparison between the 7-day fast simple average and the monthly slow average of 5 bars. The red line indicates the monthly green and blue lines the daily average. If the Green-Blue line crosses the red upwards, it is a buy signal and the opposite is a sell signal. As soon as it turns green blue without waiting for the sell signal, a sell signal is created. If you are trading fast, you can consider turning green to blue as an opportunity. In the long run, the red intersection can be interpreted as a Stop point.
I hope it will be useful to everyone.
You can also find the strategy indicator with the same name.
I got the name of this indicator from my daughter's name. The meaning of the name Yüsra means "convenience". I hope this indicator will help you.
{Gunzo} Trend Sniper (WMA with coefficient)Trend Sniper is a trend-following indicator that sticks closer to the trend than others moving averages as it is using an upgraded weighted moving average implementation.
OVERVIEW :
It is typical to use a moving average indicator (SMA, EMA, WMA or TMA) to identify the trend of an asset. Standard moving averages indicators smooth the price and doesn’t stick very closely to the actual price, showing potential lagging information.
CALCULATION :
In order to have a trendline that sticks to the price, we are going to use a weighted moving average as it puts more weight on recent candles and less on past candles. The weight is usually calculated using the distance from current candle to the other candles used in the calculation. We have the following formula for the standard calculation as implemented in TradingView :
WMA_standard = (Price1 * Weight1 + …… + PriceN * WeightN)) / (Weight1 + …… + WeightN)
This “Trend Sniper” indicator uses an additional coefficient to alter even more the weight of each candle.
WMA_with_coefficient = (Price1 * (Weight1 - Coefficient) + …… + PriceN * (WeightN - Coefficient)) / ((Weight1 - Coefficient) + …… + (WeightN - Coefficient))
SETTINGS :
MA source : Source used for moving average calculation (ex : “close”)
MA length : Length of the moving average. Higher values will give a smoother line, lower values will give a more reactive line.
Use extra smoothing : Enable/disable usage of a EMA to extra smooth the line curve. If activated the indicator may be lagging, but it will also avoid many false buy/sell signals.
MA extra smoothing length : Length of the moving average of the extra smoothing.
Change candle colors : Enable/disable painting the candles of the chart with the colors of the weighted moving average.
Display buy/sell signals : Display buy/sell signals (circles) when the moving average is changing direction
VISUALIZATIONS :
This indicator has 3 possible visualizations :
Moving Average line : the line represents the weighted moving average that is following the price of the asset, when the line goes up we are in a uptrend (green line) when the line goes down we are in a downtrend (red line).
Candle coloring : the color of the moving average line can be applied to the candles of the chart for better readability.
Signals : Buy/Sell signals can be displayed at the bottom of the chart
USAGE :
This indicator can help analyze the trend directional changes :
First of all, if the moving average line is under the price (or above the price), then we can assume that the uptrend is strong (or downtrend is strong).
If the current candle crosses the moving average line, it is the first sign that the trend is weakening and possibly starting to revert.
If the weighted moving average is changing direction, then the trend change is confirmed and the color of the line changes
(IK) Color Coded MAJust a simple Moving Average indicator. Choose between SMA, EMA, and WMA, set the length and the source. There are 3 color indicators that represent whether price is above or below the moving average:
- the moving average line itself
- the background of the chart (optional)
- the 'underglow' of price action (optional - set 'underglow strength' to 0 to turn off)
You can customize the colors
I wasn't planning on publishing this, because, again, it doesn't really do anything special, but I've been using it for a little bit now in place of regular MAs, and I really dig the visual effect of the underglow, so I thought I'd share.
Feel free to steal/modify this.
Erzurum Indicators (By DadashKadir)Erzurum Indicators (By DadashKadir)
An indicator in which you will keep track of the buying and selling movements by adding the movements of the three moving averages together. The parameters were determined as Moving Average (SMA), Exponential Moving Average (EMA), Weighted Moving Average (WMA) and Volume Weighted Moving Average (VWMA). Its constant value was taken as WMA. It is used to calculate the averages of 3 - 5 and 7. You can include the standard deviation (STDEV) in these moving averages.
The name of the indicator is taken from our city of Erzurum, the pearl of Eastern Anatolia.