Improved Multi-Timeframe (MTF) 50 SMA - plots same as live dataThis multi-timeframe 50-period simple moving average uses an improved calculation to accurately calculate the indicator's value with every new bar on the time frame your chart is set to. Previously the indicator only recalculated with every new update on the timeframe used in its security function. This means that this improved script plots the real, current value of your indicator across your chosen timeframes on your chart's resolution and no longer only plots only the indicator's monthly/weekly/daily/4 hour/ect closing value on the your chart.
Input values are fixed to their default (close,50) configuration to make this indicator's improved calculation possible.
When using "Plot Higher Timeframe?" the script will set the indicator to only plot its value in closest larger timeframe. This option overrides the two following options. For example, when using the daily resolution , only the weekly value will plot, or when using the one hour (60m) resolution, only the 4 hour (240m) value will plot.
The "Omit Higher Timeframes?" option will set the indicator to only plot starting from the 1/2/3/4/5/6/7th closest larger timeframe. For example, when using the daily resolution and this option set to 0, all values from the weekly resolution and up will plot, but if set to 1, all values from the monthly resolution and up will plot instead.
The "Plot Yearly/Quarterly/Monthly/Weekly/Daily/4 Hour/1 Hour/15 Minute/5 Minute?" options allow enabling/disabling a specific timeframe. All are enabled by default. For example, if you do not want the yearly value of the indicator to ever plot, you can disable the "Plot Yearly?" option.
Sma
Improved Multi-Timeframe (MTF) 21 SMA - plots same as live dataThis multi-timeframe 21-period simple moving average uses an improved calculation to accurately calculate the indicator's value with every new bar on the time frame your chart is set to. Previously the indicator only recalculated with every new update on the timeframe used in its security function. This means that this improved script plots the real, current value of your indicator across your chosen timeframes on your chart's resolution and no longer only plots only the indicator's monthly/weekly/daily/4 hour/ect closing value on the your chart.
Input values are fixed to their default (close,21) configuration to make this indicator's improved calculation possible.
When using "Plot Higher Timeframe?" the script will set the indicator to only plot its value in closest larger timeframe. This option overrides the two following options. For example, when using the daily resolution , only the weekly value will plot, or when using the one hour (60m) resolution, only the 4 hour (240m) value will plot.
The "Omit Higher Timeframes?" option will set the indicator to only plot starting from the 1/2/3/4/5/6/7th closest larger timeframe. For example, when using the daily resolution and this option set to 0, all values from the weekly resolution and up will plot, but if set to 1, all values from the monthly resolution and up will plot instead.
The "Plot Yearly/Quarterly/Monthly/Weekly/Daily/4 Hour/1 Hour/15 Minute/5 Minute?" options allow enabling/disabling a specific timeframe. All are enabled by default. For example, if you do not want the yearly value of the indicator to ever plot, you can disable the "Plot Yearly?" option.
Moving Average 300 by WM - Bitcoin reversal key ?Bonjour à tous, c'est un grand plaisir que nous ajoutons le MA 300 à votre boîte à outils ce qui à mon avis pourrait constituer un support essentiel pour la tendance BTC dans un proche avenir. Nous pensons qu'il serait possible que le Bitcoin puisse mettre un terme à la tendance baissière en l'effleurant :-) Historiquement le Bitcoin n'a jamais descendu sous la barre du MA 200. Je vous souhaite de connaître beaucoup de succès lors de vos prochaines transactions et n'oubliez pas la tendance est votre amis!! Crypto Mercy xx
WM
We are movement
Dual EMA/SMA + Cross [SH]
I was missing an indicator that could show both an EMA and an MA with selectable source (open, close etc.) at the same time.
- Individually selectable EMA or MA.
- Option to highlight the bar where the MA's cross.
- Individually selectable source.
Not being pro it makes sense to have several indicators in one.
I hope someone finds this indicator useful.
Shaslund
Intelligent Moving AverageFor 4 simple moving averages, the script tests every single combination for maximum profitability and finds the best pair.
Combinations:
sma1 and sma2,
sma1 and sma3,
sma1 and sma4,
sma2 and sma3,
sma2 and sma4,
sma3 and sma4
And then paint the pair which get best performance. sma lengths are optional, so you can change lengths as you wish.
You will see in some charts that for example sma1 and sma2 pair was best perfrmance and colored on the chart but then sma2 and sma3 pair got better performance, so script starts to paint sma2 and sma3. so it's dynamic based on best performance.
keep in mind => length1 < length2 < length3 < length4 will be better
I didn't have enough time to test the script, so please comment when you test it.
by LonesomeTheBlue
[DA]Cross Fast Slow MA StrategyThis script is for testing moving averages. Recommended settings are set by default and timeframe 12 hour.
TB! -=Old Fasion=- [STRATEGY]This is the Strategy version of;
A Good Old Fasion sma/rma trading done as it should be done!
Great for hedging
- Bitfinex
- Poloniex
- Bitmex
- Deribit
No repaint, no false alerts or any other kind of nonsense.
With this strategy version you can determine the most optimal settings.
Those optimal setting you copy into the alert edition and of you go, sending alerts to GunBot, Haasbot, Dragonbot, Trexen, Autoview or whatever makes you happy.
TB! -=Old Fasion=- [ALERT]Good Old Fasion sma/rma trading done as it should be done!
Great for hedging
- Bitfinex
- Poloniex
- Bitmex
- Deribit
No repaint, no false alerts or any other kind of nonsense.
This the Alert version.
You can use it to send alerts to GunBot, Haasbot, Dragonbot, Trexen, Autoview or whatever makes you happy.
Multi SMA EMA WMA HMA BB (4x5 MAs Bollinger Bands) Adv MTF - RRBMulti SMA EMA WMA HMA 4x5 Moving Averages with Bollinger Bands Advanced MTF by RagingRocketBull 2019
Version 1.0
This indicator shows multiple MAs of any type SMA EMA WMA HMA etc with BB and MTF support, can show MAs as dynamically moving levels.
There are 4 MA groups + 1 BB group, a total of 4 TFs * 5 MAs = 20 MAs. You can assign any type/timeframe combo to a group, for example:
- EMAs 12,26,50,100,200 x H1, H4, D1, W1 (4 TFs x 5 MAs x 1 type)
- EMAs 8,10,13,21,30,50,55,100,200,400 x M15, H1 (2 TFs x 10 MAs x 1 type)
- D1 EMAs and SMAs 8,10,12,26,30,50,55,100,200,400 (1 TF x 10 MAs x 2 types)
- H1 WMAs 7,77,89,167,231; H4 HMAs 12,26,50,100,200; D1 EMAs 89,144,169,233,377; W1 SMAs 12,26,50,100,200 (4 TFs x 5 MAs x 4 types)
- +1 extra MA type/timeframe for BB
There are several versions: Simple, MTF, Pro MTF, Advanced MTF and Ultimate MTF. This is the Advanced MTF version. The Differences are listed below. All versions have BB
- Simple: you have 2 groups of MAs that can be assigned any type (5+5)
- MTF: +2 custom Timeframes for each group (2x5 MTF) +1 TF for BB, TF XY smoothing
- Pro MTF: 4 custom Timeframes for each group (4x3 MTF), 1 TF for BB, MA levels and show max bars back options
- Advanced MTF: +2 extra MAs/group (4x5 MTF), custom Ticker/Symbols, Timeframe <>= filter, Remove Duplicates Option
- Ultimate MTF: +individual settings for each MA, custom Ticker/Symbols
Features:
- 4x5 = 20 MAs of any type
- 4x MTF groups with XY step line smoothing
- +1 extra TF/type for BB MAs
- 4x5 = 20 MA levels with adjustable group offsets, indents and shift
- supports any existing type of MA: SMA, EMA, WMA, Hull Moving Average (HMA)
- custom tickers/symbols for each group - you can compare MAs of the same symbol across exchanges
- show max bars back option
- show/hide both groups of MAs/levels/BB and individual MAs
- timeframe filter: show only MAs/Levels with TFs <>= Current TF
- hide MAs/Levels with duplicate TFs
- support for custom TFs that are not available in free accounts: 2D, 3D etc
- support for timeframes in H: H, 2H, 4H etc
Notes:
- Uses timeframe textbox instead of input resolution dropdown to allow for 240 120 and other custom TFs
- Uses symbol textbox instead of input symbol to avoid establishing multiple dummy security connections to the current ticker - otherwise empty symbols will prevent script from running
- Possible reasons for missing MAs on a chart:
- there may not be enough bars in history to start plotting it. For example, W1 EMA200 needs at least 200 bars on a weekly chart.
- price << default Y smoothing step 5. For charts with low/fractional prices (i.e. 0.00002 << 5) adjust X Y smoothing as needed (set Y = 0.0000001) or disable it completely (set X,Y to 0,0)
- TradingView Replay Mode UI and Pinescript security calls are limited to TFs >= D (D,2D,W,MN...) for free accounts
- attempting to plot any TF < D1 in Replay Mode will only result in straight lines, but all TFs will work properly in history and real-time modes. This is not a bug.
- Max Bars Back (num_bars) is limited to 5000 for free accounts (10000 for paid), will show error when exceeded. To plot on all available history set to 0 (default)
- Slow load/redraw times. This indicator becomes slower, its UI less responsive when:
- Pinescript Node.js graphics library is too slow and inefficient at plotting bars/objects in a browser window. Code optimization doesn't help much - the graphics engine is the main reason for general slowness.
- the chart has a long history (10000+ bars) in a browser's cache (you have scrolled back a couple of screens in a max zoom mode).
- Reload the page/Load a fresh chart and then apply the indicator or
- Switch to another Timeframe (old TF history will still remain in cache and that TF will be slow)
- in max possible zoom mode around 4500 bars can fit on 1 screen - this also slows down responsiveness. Reset Zoom level
- initial load and redraw times after a param change in UI also depend on TF. For example:
D1/W1 - 2 sec, H1/H4 - 5-6 sec, M30 - 10 sec, M15/M5 - 4 sec, M1 - 5 sec.
M30 usually has the longest history (up to 16000 bars) and W1 - the shortest (1000 bars).
- when indicator uses more MAs (plots) and timeframes it will redraw slower. Seems that up to 5 Timeframes is acceptable, but 6+ Timeframes can become very slow.
- show_last=last_bars plot limit doesn't affect load/redraw times, so it was removed from MA plot
- Max Bars Back (num_bars) default/custom set UI value doesn't seem to affect load/redraw times
- In max zoom mode all dynamic levels disappear (they behave like text)
1. based on 3EmaBB, uses plot*, barssince and security functions
2. you can't set certain constants from input due to Pinescript limitations - change the code as needed, recompile and use as a private version
3. Levels = trackprice implementation
4. Show Max Bars Back = show_last implementation
5. swma has a fixed length = 4, alma and linreg have additional offset and smoothing params
6. Smoothing is applied by default for visual aesthetics on MTF. To use exact ma mtf values (lines with stair stepping) - disable it
Good Luck! You can explore, modify/reuse the code to build your own indicators.
General Filter Estimator-An Experiment on Estimating EverythingIntroduction
The last indicators i posted where about estimating the least squares moving average, the task of estimating a filter is a funny one because its always a challenge and it require to be really creative. After the last publication of the 1LC-LSMA , who estimate the lsma with 1 line of code and only 3 functions i felt like i could maybe make something more flexible and less complex with the ability to approximate any filter output. Its possible, but the methods to do so are not something that pinescript can do, we have to use another base for our estimation using coefficients, so i inspired myself from the alpha-beta filter and i started writing the code.
Calculation and The Estimation Coefficients
Simplicity is the key word, its also my signature style, if i want something good it should be simple enough, so my code look like that :
p = length/beta
a = close - nz(b ,close)
b = nz(b ,close) + a/p*gamma
3 line, 2 function, its a good start, we could put everything in one line of code but its easier to see it this way. length control the smoothing amount of the filter, for any filter f(Period) Period should be equal to length and f(Period) = p , it would be inconvenient to have to use a different length period than the one used in the filter we want to estimate (imagine our estimation with length = 50 estimating an ema with period = 100) , this is where the first coefficients beta will be useful, it will allow us to leave length as it is. In general beta will be greater than 1, the greater it will be the less lag the filter will have, this coefficient will be useful to estimate low lagging filters, gamma however is the coefficient who will estimate lagging filters, in general it will range around .
We can get loose easily with those coefficients estimation but i will leave a coefficients table in the code for estimating popular filters, and some comparison below.
Estimating a Simple Moving Average
Of course, the boxcar filter, the running mean, the simple moving average, its an easy filter to use and calculate.
For an SMA use the following coefficients :
beta = 2
gamma = 0.5
Our filter is in red and the moving average in white with both length at 50 (This goes for every comparison we will do)
Its a bit imprecise but its a simple moving average, not the most interesting thing to estimate.
Estimating an Exponential Moving Average
The ema is a great filter because its length times more computing efficient than a simple moving average. For the EMA use the following coefficients :
beta = 3
gamma = 0.4
N.B : The EMA is rougher than the SMA, so it filter less, this is why its faster and closer to the price
Estimating The Hull Moving Average
Its a good filter for technical analysis with tons of use, lets try to estimate it ! For the HMA use the following coefficients :
beta = 4
gamma = 0.85
Looks ok, of course if you find better coefficients i will test them and actualize the coefficient table, i will also put a thank message.
Estimating a LSMA
Of course i was gonna estimate it, but this time this estimation does not have anything a lsma have, no moving average, no standard deviation, no correlation coefficient, lets do it.
For the LSMA use the following coefficients :
beta = 3.5
gamma = 0.9
Its far from being the best estimation, but its more efficient than any other i previously made.
Estimating the Quadratic Least Square Moving Average
I doubted about this one but it can be approximated as well. For the QLSMA use the following coefficients :
beta = 5.25
gamma = 1
Another ok estimate, the estimate filter a bit more than needed but its ok.
Jurik Moving Average
Its far from being a filter that i like and its a bit old. For the comparison i will use the JMA provided by @everget described in this article : c.mql5.com
For the JMA use the following coefficients :
for phase = 0
beta = pow*2 (pow is a parameter in the Jma)
gamma = 0.5
Here length = 50, phase = 0, pow = 5 so beta = 10
Looks pretty good considering the fact that the Jma use an adaptive architecture.
Discussion
I let you the task to judge if the estimation is good or not, my motivation was to estimate such filters using the less amount of calculations as possible, in itself i think that the code is quite elegant like all the codes of IIR filters (IIR Filters = Infinite Impulse Response : Filters using recursion) .
It could be possible to have a better estimate of the coefficients using optimization methods like the gradient descent. This is not feasible in pinescript but i could think about it using python or R.
Coefficients should be dependant of length but this would lead to a massive work, the variation of the estimation using fixed coefficients when using different length periods is just ok if we can allow some errors of precision.
I dont think it should be possible to estimate adaptive filter relying a lot on their adaptive parameter/smoothing constant except by making our coefficients adaptive (gamma could be)
So at the end ? What make a filter truly unique ? From my point of sight the architecture of a filter and the problem he is trying to solve is what make him unique rather than its output result. If you become a signal, hide yourself into noise, then look at the filters trying to find you, what a challenging game, this is why we need filters.
Conclusion
I wanted to give a simple filter estimator relying on two coefficients in order to estimate both lagging and low-lagging filters. I will try to give more precise estimate and update the indicator with new coefficients.
Thanks for reading !
Multi SMA TimeframeIn this indicator, it is possible to see SMA 8 and SMA 20 of 1m, 3m, 5m and 15m, in the same chart.
Moving Averages & Bollinger Bands with ForecastsMoving Averages & Bollinger Bands with Forecasts
11 Moving Averages
SMA, EMA, WMA
Highly Customizable
Linear Regression Forecast
Bollonger Bands
Personal Setup: Add indicator twice
1st indicator = SMA using #4, 7, 10, 11 (20, 50, 100, 200 SMAs) with bollonger bands on 20.
2nd indicator = EMA using #1, 2, 3, 5, 6, 8, 9 (5, 8, 13, 21 ,34, 55, 89 EMAs).
This allows easy toggling between SMAs/Bolls and Fib EMAs
Thank you to yatrader2 for the forecast code
Moving Averages & Bollinger Bands with ForecastsMoving Averages & Bollinger Bands with Forecasts
11 Moving Averages
SMA, EMA, WMA
Highly Customizable
Linear Regression Forecast
Bollonger Bands
Personal Setup: Add indicator twice
1st indicator = SMA using #4, 7, 10, 11 (20, 50, 100, 200 SMAs) with bollonger bands on 20.
2nd indicator = EMA using #1, 2, 3, 5, 6, 8, 9 (5, 8, 13, 21 ,34, 55, 89 EMAs).
This allows easy toggling between SMAs/Bolls and Fib EMAs
Thank you to yatrader2 for the forecast code
Moving Averages & Bollinger Bands with ForecastsMoving Averages & Bollinger Bands with Forecasts
11 Moving Averages
SMA, EMA, WMA
Highly Customizable
Linear Regression Forecast
Bollonger Bands
Personal Setup: Add indicator twice
1st indicator = SMA using #4, 7, 10, 11 (20, 50, 100, 200 SMAs) with bollonger bands on 20.
2nd indicator = EMA using #1, 2, 3, 5, 6, 8, 9 (5, 8, 13, 21 ,34, 55, 89 EMAs).
This allows easy toggling between SMAs/Bolls and Fib EMAs
Thank you to yatrader2 for the forecast code
Moving Averages & Bollinger Bands with ForecastsMoving Averages & Bollinger Bands with Forecasts
11 Moving Averages
SMA, EMA, WMA
Highly Customizable
Linear Regression Forecast
Bollonger Bands
Personal Setup: Add indicator twice
1st indicator = SMA using #4, 7, 10, 11 (20, 50, 100, 200 SMAs) with bollonger bands on 20.
2nd indicator = EMA using #1, 2, 3, 5, 6, 8, 9 (5, 8, 13, 21 ,34, 55, 89 EMAs).
This allows easy toggling between SMAs/Bolls and Fib EMAs
Thank you to yatrader2 for the forecast code
Fixed Moving AverageThis Indicator is a fixed moving average indicator.
By "fixed" I mean that you can choose for the MA to be based on the current resolution or fixed on a specific time-frame.
Default will be 128 D MA. It is fully customize able Moving Average.
It is a simple script. I created it because I wanted to be able to see the 128 D MA on any time-frame.
It can be used to determine your bias while trading:
- If the price is above the 128 day moving average, look for longs
- If the price is below the 128 day moving average, look for shorts
The 6 Line Death PunchIf you are looking to discover what trend you are in, you need to first what direction the price is going in...
I've been using and testing a mixture of EMA's and SMA's for a long time and I've found that these ones are by far the best.
EMA 3
EMA 8
MA 20
EMA 55
MA 100
MA 200
EMA 3 & 8 Crossover is a good method for confirming a coin going to the upside or to the downside.
EMA 8 is known as the Trigger Line (trademarked brand) as one of the fib numbers it shows good support or resistance of a trend.
MA 20 universal way of seeing trend direction in the stock market, works well with crypto too.
EMA 55, another trusty fib number. Works very well and could trade off that alone as support and resistance.
MA 100 and MA 200. Long ranged moving averages which govern the overall longer-term trend.
LONG ENTRY
Option 1 - 3/8 crossover
Option 2 - Candles above EMA 8
Option 3 - Candles above MA 20
Option 4 - Candles Above EMA 55.
SHORT ENTRY
Option 1 - 3/8 crossover
Option 2 - Candles below EMA 8
Option 3 - Candles below MA 20
Option 4 - Candles below EMA 55.
9 moyennes configurables3 moyennes mobiles simples, 3 moyennes exponentielles et 3 moyennes ponderées.
Longueurs configurables dans les paramètres d'entrée.
sma-pivotsThis model is based on this script
I change it to sma model . the model run on pivots high or low that are base on SMA
I make two SMA one for high pivots and one for low pivots ( I put for now at same distance but you need to change it according to needs)
because asset can be in bull period or bear period when we have two separate distance of SMA we can find the correct combination if to buy more or less by changing either the sma pivot of the low end or the sma pivots of the high end using the length . also global we can use the lookbar of bar numbers
one sma to both pivots is bad as it not consider the market situation but separation to two one for sell and one for buy can give you a better flexible model for enter or exit
so its your job to find what length is best suited for exit and what for enter .
example when we have two different length how it work on 4 hour