ScalpyScalpy is made up of a 2 main parts.
- The cloud comprising of a 10 period SMA and a 30 period SMA.
- When the cloud is green you should be looking for long entries.
- When the cloud is red you should be looking for short entries.
- Price is most bullish above a green cloud and most bearish below a red cloud.
- Being within the cloud indicates indecision.
The blue and white lines on the indicator show the relationship between price and momentum.
They can be used to spot reversals in two ways:
- The first is a divergence between price (blue line) and RSI (white line)
- If the price makes a lower low but the RSI makes a higher low this shows the trend is weakening and may be reversing soon (as can be seen by the two yellow lines on the chart).
The second is a simple crossover:
- When the white line crosses the blue line to the upside this signals a long entry.
- When the white line crosses the blue line to the downside this signals a short entry.
Sma
ZLMA - Low-Lag Moving Average Based On An Alternative SMA DesignThere can be many ways to make a simple moving average, you can either sum the current and the n-1 previous data points and divide the result by n , or you can do it more efficiently by first taking the cumulative sum of your data points, and subtracting the current cumulative sum result with the cumulative sum results n bars ago, then divide the result by n . This can be described by the following formulas:
a(t) = a(t-1) + price(t)
b(t) = (a(t) - a(t-n))/n
This method is the one used in order to allow the user to use a series as SMA period, more info here:
Today we use this design in order to provide a pretty efficient low-lag moving average where the amount of lag of the moving average can be increased/decreased by the user.
THE INDICATOR
length control the period of the moving average, with larger value of length returning larger filtering amount. The lag setting in the other hand control the amount of lag of the moving average, with larger value of lag returning a moving average with less lag. The lag setting can't be lower than 1 or greater than 2, but values lower than 1 and greater than 0 would just return a moving average with larger filtering amount while values greater than 2 would create crazy wild overshoots.
In blue lag = 1.8, in red lag = 1.4, when lag = 1 the moving average is equal to a simple moving average of period length. Remember that larger values of lag will return greater over/undershoots.
Approximate amplitude response of the moving average, like all low-lag moving averages you can see frequencies amplified (the ones on the left greater than 1) .
SUMMARY
We proposed a low-lag moving average based on the cumulative/change SMA design where the lag of the moving average can be controlled by the user. There are tons of low-lag moving averages already, and they don't necessarily provide different results from each others, however this one is still relatively interesting as you can switch from a simple MA from a low-lagging one, other indicators are ready using this design and will be posted soon.
Moving Averages Linear CombinatorLinearly combining moving averages can provide relatively interesting results such as a low-lagging moving averages or moving averages able to produce more pertinent crosses with the price.
As a remainder, a linear combination is a mathematical expression that is based on the multiplication of two variables (or terms) with two coefficients (also called scalars when working with vectors) and adding the results, that is:
ax + by
This expression is a linear combination , with x/y as variables and a/b as coefficients. Lot of indicators are made from linear combinations of moving averages, some examples include the double/triple exponential moving average, least squares moving average and the hull moving average.
Today proposed indicator allow the user to combine many types of moving averages together in order to get different results, we will introduce each settings of the indicator as well as how they affect the final output.
Explaining The Effects Of Linear Combinations
There are various ways to explain why linear combination can produce low-lagging moving averages, lets take for example the linear combination of a fast SMA of period p/2 and slow simple moving average of period p , the linear combination of these two moving averages is described as follows:
MA = 2SMA(p/2) + -1SMA(p)
Which is equivalent to:
MA = 2SMA(p/2) - SMA(p) = SMA(p/2) + SMA(p/2) - SMA(p)
We can see the above linear combinations consist in adding a bandpass filter to the fast moving average, which of course allow to reduce the lag. It is important to note that lag is reduced when the first moving average term is more reactive than the second moving average term. In case we instead use:
MA = -2SMA(p/2) + 1SMA(p)
we would have a combination between a low-pass and band-reject filter.
The Indicator
The indicator is based on the following linear combination:
Coeff × LeadingMA(length) - (Coeff-1) × LaggingMA(length)
The length setting control both moving averages period, leading control the type of moving average used as leading MA, while lagging control the type of MA used as lagging moving average, in order to get low lag results the leading MA should be more reactive than the lagging MA. Coeff control the coefficients of the linear combination, with higher values of coeff amplifying the effects of the linear combination, negative values of coeff would make a low-lag moving average become a lagging moving average, coeff = 1 return the leading MA, coeff = -1 return the lagging MA. The leading period divisor allow to divide the period of the leading MA by the selected number.
The types of moving average available are: simple, exponentially weighted, triangular, least squares, hull and volume weighted. The lagging MA allow you to select another MA on the chart as input.
length = 100, leading period divisor = 2, coeff = 2, with both MA type = SMA. Using coeff = -2 instead would give:
You can select "Plot leading and lagging" in order to show the leading and lagging MA.
Conclusion
The proposed tool allow the user to create a custom moving averages by making use of linear combination. The script is not that useful when you think about it, and might maybe be one of my worst, as it is relatively impractical, not proud of it, but it still took time to make so i decided to post it anyway.
Multi moving average (by S. G. Lee)- Multi moving average with one indicator
- You can choose SMA/EMA
- You can change length
- You can change color, thickness
GMS: Moving Average IndicatorThis is a moving average indicator built the way I would want it. There are 3 moving averages with On/Off toggles. It makes it easier than having to add each one separately over and over. Now it's nice and easy all in one spot!
- The moving averages are SMA, EMA, WMA, VWMA and can select anyone for each of the 3 moving averages.
- You can also select the data used for the moving averages (OHLC etc.)
Source code should be open, so feel free to take a look and use it for you own project or ideas.
I hope this helps!
Andre
GMS: Moving Average Crossover StrategyThis is a moving average crossover system built the way I would want it to be.
- The moving averages included are SMA, EMA, WMA, VWMA.
- You can select either for the first moving average or the second moving average.
- You can also select to see the Long trades, Short trades, or both at the same time.
- There is also a simple moving average trend filter. When this is selected, it only applies to the entries of a trade and not the exit. There are situations where the entry is above the trend filter and the exit is below.
The source code should be open so feel free to adapt it, make it more efficient, or take some part for your own project!
I hope it helps,
Andre
Multiple Timeframe Five Moving AveragesThis allows you to plot up to 5 moving averages on your chart at once. You can either use the chart's current timeframe or select a custom timeframe for your 5 moving averages (for example, you can see the 200DMA on your 4h chart without having to adjust the moving average length). You can also choose amongst SMA , EMA , and HULLMA for each MA.
[fikira] Volume + MTF MAVolume normally has 1 Moving Average (standard orange coloured)
This script gives 1 extra Moving Average (default blue coloured)
BOTH MA can be shown with Multi Time Frames,
based on the most excellent work of "PineCoders"
(MTF Selection Framework functions)!
This can provide more insights, also the crossovers can be interesting!
So, default there are 2 MA's of the present Time Frame + extra 2 TF's of these MA's
(default 2 and 4 times of the present TF)
All can be enabled/disabled,
Only 1 MA:
With labels and values:
Here 2 MA but + only 1 extra TF:
[fikira] Fibma/Fibema StrategyMy strategy regarding the Fibma/Fibema lines (also see my Fibma/Fibema study)
You can enable/disable each strategy to see what
works best in what timeframe
Thanks!
[fikira] Fibonacci MA / EMA's (Fibma / Fibema)I've made SMA/EMA's NOT based on the principle of the 2(1+1), 3(2+1),
5(3+2), 8(5+3), 13(8+5), 21(13+8), 34(21+13), 55(34+21), ... numbers,
but based on these following Fibonacci numbers:
0,236
0,382
0,500
0,618
0,764
1
Ending up with 2 series of Fibma / Fibema:
"Tiny Fibma / Fibema":
24, 38, 50, 62, 76, 100
"Big Fibma / Fibema":
236, 382, 500, 618, 764, 1000
IMHO it is striking how these lines often act as Resistance/Support,
although (except the 50, 100 & 500) they are not typical MA/EMA's.
They perform very well on every Timeframe as well!
Week:
3 Days:
1 Day:
4h:
1h:
Even on the 15 minutes:
Or 5':
Things to watch for:
Price compared to the Tiny or Big Fibma / Fibema (below or above)
Price compared to important Fibma / Fibema (for example below or
above MA 236, MA 764, MA 1000, ...)
Crossing of Fibma / Fibema 24/76, 236/764 and 38/62, 382/618
(bullish crossover = Lime coloured "cloud", bearish crossunder = Red coloured "cloud"),
...
I've made a change in barcolor if the close crosses the "Big Fibma / Fibema 500"
If price closes above MA/EMA 500, the first bar is yellow coloured,
if price stays above this level, candles are coloured lime/orange (= very bullish)
If price closes under MA/EMA 500, the first bar is purple,
if price stays under this level, candles are standard coloured (= very bearish)
Strategy will follow,
Thanks!
5 MAThis indicator can help you out to check for entry points, taking in concideracion ema cross, providing you an alert before the entry and as doble check once you get the confirmation you will be able to put you order
Simple Moving Average - ATR Trailing StopThe old adage goes "Cut losers fast and let the winners run"
With this in mind, this will plot a dynamic trailing stop by subtracting any multiplier of the Average True Range (ATR) from the SMA of your choice.
FALSE BREAKOUT NO PROBLEM !! CHK TWIN MOV AVG SEGREGATED RIBBON PROBLEM DEFINITION 1 : To Avoid False Breakouts
PROBLEM DEFINITION 2 : To Ascertain if the trend has changed when a Stock opens with a Gap up or Gap Down
## PROBABLE SOLUTION : Use a Moving Average with lot of latency
## PROBLEM WITH ABOVE SOLUTION : Misses on lot of trades, Late exits leads to drain on winning trades
S O L U T I O N
An Indicator which plots two different types of Moving Averages at the same time
For the MA length 5-100 a fast plot of choice
For the MA Length 110-200 a plot with a lag to ascertain the trend
And then ONE LAST MAN STANDING with even bigger MA length for a lagging indicator to save the day
This indicator gives one 9X9 = 81 Permutation Combinations to look at the markets
One can devise strategies basis if one particular MA Type has crossed another MA Type
Feel free to post the strategies you have come out with!
//// CREDITS AND ACKNOWLEDGEMENTS //////////////////////////////////////////////////////////////////
Following contributors helped the author ::
Credits to Neobutane for his Multiple Type Mov. Avg. Guppy at ......
hxxps://www.tradingview.c0m/script/UQAv1U0c-MA-Study-Different-Types-and-More-NeoButane/
Credits to Jose5770 for sharing Jurik MA code at .....
hxxps://www.tradingview.c0m/script/uqYvkHna-Trend-Direction-Force-Index/
Appreciate and Thank You for sharing your work.
//////////////////////////////////////////////////////////////////////////////////////////////////////
P.S You might notice in the code that the few plots are skipped. It is done to fasten the indicator without compromising
on the functionality
unRekt - KISS CrossKISS Cross is a moving average crossover and is part of the ''keeping it simple' series that have a similar color scheme. With this indicator you can select the moving average you'd like to use either SMA, EMA, WMA, or VWMA. Each moving average can be turned on or off and input changed. The first two MA's will change color on the cross from green to red depending on cross up or a cross down.
Functions Allowing Series As Length - PineCoders FAQ█ WARNING
Improvements to the following Pine built-ins have deprecated the vast majority of this publication's functions, as the built-ins now accept "series int" `length` arguments:
ta.wma()
ta.linreg()
ta.variance()
ta.stdev()
ta.correlation()
NOTE
For an EMA function that allows a "series int" argument for `length`, please see `ema2()` in the ta library by TradingView .
█ ORIGINAL DESCRIPTION
Pinescript requires many of its built-in functions to use a simple int as their period length, which entails the period length cannot vary during the script's execution. These functions allow using a series int or series float for their period length, which means it can vary on each bar.
The functions shared in this script include:
Rolling sum: Sum(src,p)
Simple moving average: Sma(src,p)
Rolling variance: Variance(src,p)
Rolling standard deviation: Stdev(src,p)
Rolling covariance: Covariance(x,y,p)
Rolling correlation: Correlation(x,y,p)
If p is a float then it is rounded to the nearest int .
How to Use the Script
Most of the functions in the script are dependent on the Sma function. The Correlation function uses the Covariance and Stdev functions. Be sure you include all the required functions in your script.
Make sure the series you use as the length argument is greater than 0, else the functions will return na . When using a series as length argument, the following error might appear:
Pine cannot determine the referencing length of a series. Try using max_bars_back in the study or strategy function.
This can be frequent if you use barssince(condition) where condition is a relatively rare event. You can fix it by including max_bars_back=5000 in your study declaration statement as follows:
study("Title",overlay=true,max_bars_back=5000)
Example
The chart shows the Sma , Stdev , Covariance and Correlation functions. The Sma uses the closing price as input and bars as period length where:
bars = barssince(change(security(syminfo.tickerid,"D",close ,lookahead=true)))
The Stdev uses the closing price as input and bars + 9 as period length. The Covariance and Correlation use the closing price as x and bar_index as y , with bars + 9 as period length.
Look first. Then leap.
CryptoBandsGuru MultiColor Bollinger BandsHere are my Bollinger Bands that come with 2 std dev bands and a variety of moving averages. The bands can have shading between the bands and the middle section can be shaded.
Moving Averages include:
SMA
EMA
Weighted
Hull
Symmetrical
Volume Weighted
Wilder
Right now my 2 favorites are the Hull with a std dev of .5 and the Wilder with a std dev of 1.7 and 2.0.
You can get some really good signals buy putting both on the same chart. The faster Hull will move above and below the slower Wilder and show good price action.
CHK TimeSeriesLagReductionFilter[MULTI MA]This script is an improvement on the idea published on " Time Series Lag Reduction Filter "
This script allows users to select the Moving Average of his choice. Helps precise entries and precise exits.
Since every Moving Average is different, play with the settings to get the best fit. If the "Lag Reduce" overshoots bring down the number.
CREDITS ::
TO theheirophant for this idea
TO NEOBUTANE for his MULTI TYPE MOV AVG GUPPY
Thank You NEOBUTANE and Theheirophant.
This is my first publication :)
Sharing few examples what this script can do
SMA Cross Entry & Exit StrategyThis is a TradingView Strategy Script meaning you can't execute real trades using your exchange API connected to your TradingView account, it is designed for backtesting only
This is a basic backtesting script for charting the bullish and bearish cross of two user defined simple moving averages, select the cog next to the name of the script ON the price chart in the left hand corner. The script will print to the screen either "Long Entry" or "Short Entry" depending on the direction of the cross. The script using TradingView strategies will subsequently close the opposite of the position that is executed when the bullish or bearish cross occurs. Simply put, if you are short and a bullish cross occurs, your short trade will close and be logged in strategies and the long will fire. You can pyramid the long and short positions to continue entering as long as the trend doesn't flip. You will find this in the script settings. Since this script is for backtesting you can manually set the "backtesting range" for TradingView Strategies and firing the "Long Entry" and "Short Entry". This as well, is in the settings.
Notice: When the SMA cross occurs, you have to wait till the next candle before TradingView Strategy will print the "Long Entry" or "Short Entry" to the screen
TradingView - How To Use Strategies: www.tradingview.com
LSMA - A Fast And Simple Alternative CalculationIntroduction
At the start of 2019 i published my first post "Approximating A Least Square Moving Average In Pine", who aimed to provide alternatives calculation of the least squares moving average (LSMA), a moving average who aim to estimate the underlying trend in the price without excessive lag.
The LSMA has the form of a linear regression ax + b where x is a linear sequence 1.2.3..N and with time varying a and b , the exact formula of the LSMA is as follows :
a = stdev(close,length)/stdev(bar_index,length) * correlation(close,bar_index,length)
b = sma(close,length) - a*sma(bar_index,length)
lsma = a*bar_index + b
Such calculation allow to forecast future values however such forecast is rarely accurate and the LSMA is mostly used as a smoother. In this post an alternative calculation is proposed, such calculation is incredibly simple and allow for an extremely efficient computation of the LSMA.
Rationale
The LSMA is a FIR low-pass filter with the following impulse response :
The impulse response of a FIR filter gives us the weight of the filter, as we can see the weights of the LSMA are a linearly decreasing sequence of values, however unlike the linearly weighted moving average (WMA) the weights of the LSMA take on negative values, this is necessary in order to provide a better fit to the data. Based on such impulse response we know that the WMA can help calculate the LSMA, since both have weights representing a linearly decreasing sequence of values, however the WMA doesn't have negative weights, so the process here is to fit the WMA impulse response to the impulse response of the LSMA.
Based on such negative values we know that we must subtract the impulse response of the WMA by a constant value and multiply the result, such constant value can be given by the impulse response of a simple moving average, we must now make sure that the impulse response of the WMA and SMA cross at a precise point, the point where the impulse response of the LSMA is equal to 0.
We can see that 3WMA and 2SMA are equal at a certain point, and that the impulse response of the LSMA is equal to 0 at that point, if we proceed to subtraction we obtain :
Therefore :
LSMA = 3WMA - 2SMA = WMA + 2(WMA - SMA)
Comparison
On a graph the difference isn't visible, subtracting the proposed calculation with a regular LSMA of the same period gives :
the error is 0.0000000...and certainly go on even further, therefore we can assume that the error is due to rounding errors.
Conclusion
This post provided a different calculation of the LSMA, it is shown that the LSMA can be made from the linear combination of a WMA and a SMA : 3WMA + -2SMA. I encourage peoples to use impulse responses in order to estimate other moving averages, since some are extremely heavy to compute.
Thanks for reading !
Hashem Correlation CoefficientCorrelation Coefficient
Core Code from: www.tradingview.com
This indicator Show Correlation between the Current Ticker & timeframe and a Customizable Ticker. After adding the indicator you can change the second ticker in the settings.
The Correlation Coeff is between -1 to 1 which 1 means 100% correlation and -1 means -100% correlation ( Inverse Correlation ).
The color of the area changes when:
Blue : CC > 0.5
Aqua : CC > 0.75
Purple : CC < -0.5
Red : CC < -0.75
SMA %The percentage difference from the close to the mean of SMA. Positive when above negative when below.
Fancy Moving Average [BigBitsIO]This script is for a single moving average with as many features as I can possibly fit into a single moving average. If you can think of more, or have questions regarding this script, please message me or contact me via social media.
Features:
- A single moving average (MA).
- Standard MA inputs.
- MA type.
- MA period.
- MA price.
- MA resolution (time frame).
- Visibility toggle.
- Fancy MA inputs.
- Toggle to show only candles included in the MA calculation ("Highlight inclusion") or display entire MA history.
- Toggle to show a ghost trail when Highlight inclusion is toggled on. Displays a shaded version of past MA history before the inclusion period (as seen on snapshot).
- Toggle to show forecast values for the MA.
- Other inputs related to forecasting:
- Forecast bias. (Neutral forecasts MA if the current price remains the same.)
- Forecast period.
- Forecast magnitude.
*** DISCLAIMER: For educational and entertainment purposes only. Nothing in this content should be interpreted as financial advice or a recommendation to buy or sell any sort of security or investment including all types of crypto. DYOR, TYOB. ***