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
Sma
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
8/8/8 Moving Averages
Total of 24 individual moving averages. There are 3 groups, and each group has 8 moving averages. Each group can be set the different sources and different moving average types(SMA, EMA, RMA, WMA).
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. ***
MA - EMA - DMA - ICHIMOKU - BOLLINGER BANDS - SUPPORT RESISTANCE*** FREE ACCESS ***
JUST ADD THE SCRIPT
Multiple indicators in a single script
Moving Average, Exponential Moving Average, Displaced Moving Average, Ichimoku, Bollinger Bands and Support / Resistance
I hope that you will enjoy this script,
Take care
T3+SMA This source code is subject to the terms of the Mozilla Public License 2.0 at mozilla.org
© 03.freeman
This strategy is based only on T3 moving average, but uses sma 200 as filter for enter long or short.
The default settings considers a daily timeframe.
The strategy is very simple: long if T3 increase, short if T3 decrease.
Note that if you set volume factor to 0 you will have an exponential moving average, while if you set to 1 you'll get a DEMA.
EMA/SMA BandPlot the source high, low and close of any given ema or sma. Support and resistance is defined as an area where price is likely to bounce or get rejected and since MA's are usually just one line, this band is meant to act as an area surrounding the original MA and therefore avoiding fake outs.
RSI with Smoothing, MA Filter and Alerts - BUY/SELL ArrowsEnglish description:
Here you have kind of better RSI (with smoothing) that can improve your decision-making process when you would like to trade.
Script has the following characteristics:
- Candles colorization
- RSI length
- RSI smoothing
- Moving Average Filter
- Moving Average to choose between: SMA and EMA
- Few differents methods of BUY/SELL signals to choose from and combine together
- Possibility to set Upper/Lower bands for over-bought/sold areas
This BUY/SELL Arrows script is invite-only for the members of our trading group (info in signature).
If you would like to have the oscillator visible on chart above, here is the complementary script:
Polish description:
Niniejszy skrypt, dzięki nieco ulepszonym wskaźniku RSI (z opcją wygładzenia jego linii sygnałowej) ma za zadanie wspomóc proces decyzyjny przy zakładaniu pozycji na giełdzie.
Możliwości są następujące:
- Kolorowanie świec na wykresie zgodnie z kierunkiem danych ustaleń wskaźnika RSI
- Długość/okres RSI
- Wygładzenie RSI
- Filtrowanie sygnałów Średnią Kroczącą
- Wybór pomiędzy dwoma rodzajami średnich kroczących: SMA i EMA
- Kilka różnych metod generowania sygnałów KUPNA/SPRZEDAŻY, które można włączać/wyłączać lub łączyć razem
- Możliwość ręcznego ustawienia domyślnych wartości górnej i dolnej bandy wskaźnika RSI, czyli stref wykupienia/wyprzedania.
Skrypt jest publikowany na zasadzie invite-only(zasada przydzielania dostępu na TradingView), a zatem dostępny jest tylko dla aktywnych użytkowników naszej grupy traderskiej, do której link można znaleść w mojej sygnaturze poniżej.
Jeśli chciałbyś również mieć na wykresie oscylator widoczny w oknie powyżej, tutaj jest odnośnik do skryptu uzupełniającego:
Multi Moving Averages @Hendo 4C (14 Types)A script containing 14 different types of Moving Averages, a total of 4 can be added per chart (allowing multiple Moving Averages under a smaller TradingView plan).
It also comes with: Adaptive coloring, settings for the source of calculations, customizable colors and lengths. Most importantly, as mentioned: 14 different types found below.
Simple Moving Average (SMA)
Exponential Moving Average (EMA)
Double Exponential Moving Average (DEMA)
Triple Exponential Moving Average (TEMA)
Running Moving Average (RMA)
Kaufman's Adaptive Moving Average (KAMA)
Hull's Moving Average (HMA)
Least Square Moving Average (LSMA)
Weighted Moving Average (WMA)
A. Legoux Moving Average (ALMA)
Volume Weighted Moving Average (VWMA)
Symetrically Weighted Moving Average (SWMA)
Smoothed Moving Average (SMMA)
Elastic Volume Weighted Moving Average (eVWMA)
The goal of creating this script was to allow people with a small TradingView subscription to have access to multiple Moving Averages. Of course it’s not unique in that use case, the thing that makes this script is unique is the fact that it comes with 14 different Moving Averages that can be selected independently. You want a RMA paired with 2 EMA’s and one HMA? Go ahead!
I’m open to add any requests that you guys might have. Feel free to ask so in the comments.
Check out my “Volatility Stop Loss Helper” too! And happy trading.
Last: I think it’s pretty clear to say that this was not “my idea” to build. But I found most of the similar scripts available pretty lacking in terms of settings and additions.
{{Settings overview}}
“Adaptive Colouring”: If enabled the Moving Average colours will be determined by their relation to price. If price is above the Moving Average it’s green, and red if price is below.
“Plot First MA”: Disable or enable the first moving average
“Moving Average Type 1”: The type of Moving Average that the first MA should be. 14 choices.
“Moving Average Length 1”: The length of the first Moving Average.
“Source of Calculation MA1”: The source that is used to calculate the Moving Average. Default is “Close”.
“Plot Second MA”: Enable if you want to use 2 Moving Averages
Settings are the same as described above. But then for the second MA.
“Plot Third MA”: Enable if you want to use 3 Moving Averages
Settings are the same as described above. But then for the third MA.
“Plot Fourth MA”: Enable if you want to use 4 Moving Averages
Settings are the same as described above. But then for the fourth MA.
It is recommended to click the little left arrow to hide your indicators in the top corner while using this indicator. Due to the length of the settings menu.
Settings can be added due to requests. Please check the update notes below:
$0 Exponential & Simple MAs with HigherTFMultiple Moving Averages (Simple/SMA & Exponential/EMA) in one indicator
Support for a fixed time frame for the MAs
MAs default period length are key ones, provided by experienced traders in crypto, greetings to xpressive
Live update or Non-repainting modes support: with the non-repainting mode the previous candle's close is considered instead of latest/current bar's changing close
Features:
7 EMAs with editable length
4 SMAs with editable length
Choice of the price/data source from a predefined list
Activate or not the usage of an higher TF
Target Higher time frame resolution. Not using the predefined lists for more possibilities, e.g M1="M", H12="720", D3="3D", 5M="5"
Configurable lines' width in one setting. Hide or change the MAs color from the indicator's style settings
MACD Multi-MA StrategyThis script applies the average of each major MA (SMA, RMA, EMA, WVMA, WMA) to the MACD formula.
The logic is simple. When all 5 MA's are in agreement in direction, then then script will notify users of change.
I posted this as a strategy to help show how logic does in back test. If you use my simple yet effective solution to find take profit locations, you can blow this back testing out of the water!!!
To set alerts simply turn script into study
//@version=2
study(title="MACD Multi-MA Study", overlay=false)
src = close
len1 = input(8, "FAST LOOKBACK")
len2 = input(144, "SLOW LOOKBACK")
/////////////////////////////////////////////
length = len2-len1
ma = vwma(src, length)
plot(ma, title="VWMA", color=lime)
length1 = len2-len1
ma1 = rma(src, length1)
plot(ma1, title="RMA", color=purple)
length2 = len2-len1
ma2 = sma(src, length2)
plot(ma2, title="SMA", color=red)
length3 = len2-len1
ma3 = wma(src, length3)
plot(ma3, title="WMA", color=orange)
length4 = len2-len1
ma4 = ema(src, length4)
plot(ma4, title="EMA", color=yellow)
long = ma > ma and ma1 > ma1 and ma2 > ma2 and ma3 > ma3 and ma4 > ma4
short = ma < ma and ma1 < ma1 and ma2 < ma2 and ma3 < ma3 and ma4 < ma4
alertcondition(long == true, title='MACD LONG SIGNAL', message='MACD LONG!')
alertcondition(short == true, title='MACD SHORT SIGNAL', message='MACD SHORT!')
Trend ID with early entry signalsThis script is a combination of two. Firstly a trend is identified as up down or sideways. Higher highs and higher lows makes for an uptrend, lower highs and lower lows similarly allows for a downtrend to be registered. Users can adjust the number of bars to include for detection of the pivot points to increase the accuracy of trend changes but this significantly reduces signals. Sideways movement is determined if the average candle price is within a variance of a short SMA. The SMA follows the close of each candle going back 6 candles by default. The variance is 1% by default so if the price is within 1% of the SMA it's considered sideways and no entries can be issued in this condition.
The indicator is designed to identify the trend for longing or shorting, and then provides the entries based on stochastics converging or diverging (not crosses). The convergence and divergence of stochastics is amalgamated into a short EMA which also has length 6 and can be tuned by the user.
The default values of this script best work on 1h and 2h timeframes for specific pairs like BTCUSD. For other time frames and pairs the settings will need to be tweaked but is possible to identify specific parameters for many different pairs and time frames.
I've written several scripts for personal use however this is my first published script so please use at your own risk! It's not perfect!
MrCryptoBos - EMA/SMAThe MrCryptoBos - EMA/SMA indicator contains essential Exponential Moving Averages and Simple Moving Averages that matches with important levels on the timeframes.
Colored Moving Averages with Zero Lag and ATR BandsEnglish description:
- You can choose from 6 different Moving Averages: SMA , EMA , WMA , VWMA , RMA, SWMA
- Turn ON/OFF the Zero Lag alghorithm
- Make it 2 colors for better visibility of a trend
- Turn ON/OFF the ATR Bands up to 5 multiplicator
- Set the offset on the time axis
Polski opis:
- Możesz wybierać z 6 różnych średnich kroczących: SMA , EMA , WMA , VWMA , RMA, SWMA
- Włączyć/Wyłączyć algorytm Zero Lag
- Włączyć opcję 2 kolorowej średniej żeby lepiej widzieć trendy
- Włączyć/Wyłączyć wstęgi ATR z maksymalnym mnożnikiem x5
- Ustawić przesunięcie względem osi czasu
[BA] Multi Time Frame Moving Averages for BTCThis is a multi time frame moving average script. It includes 7 moving averages. Most of them are SMAs and WMAs but EMA were also used. Time frame was set to 1 day. It means that you can change the time frame of your chart freely without losing your lines. Levels will not change.
I wrote this script just to trade BTC. I prefer daily and weekly charts with this script but lower time frames are also preferable.
Since some of the lengths are too high; older exchanges are recommended due to their relatively deep historical data.
While MA1 is for taking actions like 'take profit' or 'stop loss' or just to follow 'price action' easily, other MAs are for seeing supports and resistances.
MA6 and MA7 are disabled by default in order to minimize the confusion but you can enable them from settings if you need to.
Since some newer exchanges have less historical data, you may not see MA4 and MA5 on the daily chart. In such circumstances MA6 and MA7 might be helpful to use as substitution. Some may like to use all of them.
I am using this script just for BTC but it can be useful for other coins as well.
Multi Timeframe Moving AveragesThis indicator allows you to view a moving average (EMA or SMA) of your choosing on other time frames than what you are currently on.
The reason I wanted to develop this was for use as a filter. Let's say you wanted to make sure the daily time frame was trading above a certain moving average so you could be sure you were playing with the trend. But you wanted to make your entries and exits on a smaller time frame. This Multi-Timeframe Moving Average indicator can then be used to keep an eye on that daily moving average while looking at the shorter term time frames on the same chart.
Hashem OBV+EMA/MAThe On Balance Volume indicator (OBV) is used to measure buying and selling pressure.
It is a cumulative indicator meaning that on days where price went up, that day's volume is added to the cumulative OBV total. If price went down, then that day's volume is subtracted from the OBV total.
The OBV value is then plotted as a line for easy interpretation. OBV is primarily used to confirm or identify overall price Trends or to anticipate price movements after Divergences .
In addition to OBV, EMA and SMA are included. the EMA is used for Support and Resistances for the OBV. and the SMA is used by its Slope (can be S/R as well).
Rhaps SMAEMA Combo v1.1There's many versions of this sort of thing around the Tradingview library, but i guess we all like things to our own specifications.
So this is my take on the SMA and EMA version combined.
Bunch of SMA's & EMA's, with labels, and G&D Cross Labels and Alerts.
These values can of course be changed to any you may prefer.
Rhapsodyy's Combo SMAEMA's v1.1
SMA's with Painted Labels : 10/30/50/80/200
EMA's with Painted Labels : 21/50/89/200/377
50SMA / 200SMA Golden & Death Crosses on Current Timeframe & Alerts
Daily 50SMA / 200SMA Golden & Death Crosses overlayed onto Current Timeframe & Alerts
50EMA / 200EMA Golden & Death Crosses on Current Timeframe & Alerts
Daily 50EMA / 200EMA Golden & Death Crosses overlayed onto Current Timeframe & Alerts
FibMAThis study visually demonstrates Fibonacci moving averages.
The darker the color, the stronger the signal is for either buying or selling.
Buys/Sells only take place when each moving average is above/below the its adjactent fibonacci sequence, i.e 5<8<13<21<34<55<89<144 for buying..
Alerts are provided as BUY ASSET and SELL ASSET.
Multiple moving averages are also provided.
Moving Average(MA) CollectionA simple collection of Simple Moving Averages and Exponential Moving Averages. 4 moving averages enabled by default from a total of 10.
Turn MAs on/off and edit the line style/colour via MA Collection settings.
Default Moving Averages and Default Line Styles
21 EMA (Thin, Purple)
50 SMA (Medium, Yellow)
100 EMA (Medium, Dove Gray)
200 SMA (Thick, Radical Red)
Other Optional Moving Averages and Default Line Styles
5 SMA (Thin, Gray)
8 EMA (Thin, Strkemaster)
13 EMA (Thin, Stiletto)
40 EMA (Medium, Rio Grande)
100 SMA (Medium, Silver)
314 EMA (Thick, Olive)
FMA - Fibonacci Moving Average [NXT2017]HI BIG PLAYERS,
I present you a new moving average indicator that relates the values to the lenght of Fibonacci sequence.
Kind regards
NXT2017