Easy to Use 50/100/200 Day Moving Average StrategyWhenever you see someone publish a chart or idea, what's the one thing you almost always see? Moving Averages!
Many investors focus on these indictors solely as entry and exit points, so here's an easy to manipulate strategy to backtest and see if this is feasible on your security.
CODE VARIABLES
LINE 2 - Here you can change your currency and amount you want to invest on each entry.
LINE 8/9/10 - Here we establish the 50 (Fast), 100 (Medium) and 200 (Slow) day variables. These can be adjusted to your choosing.
LINE 13/14/15 - Here we establish what date we want to start backtesting from. Simple change the defval on each line to change the date (In the code below we start on Jan 1st, 2010).
LINE 20/23 - Here, within the crossover and crossunder functions, we set which MA's must cross to enter and exit a trade. Below we have the 50 day moving above and under the 200 day. Simple change the variables to FastMA, MediumMA and SlowMA to your choosing.
NOTE: As a beginner you may not want to short stock, therefore LINE 5 was added to only allow long positions.
Hope this helps, from one beginner to another.
Cheers!
Media Móvil Simple (SMA)
8 EMA & 5 SMA ComboA combination of 8 EMA & 5 SMA to use with more advanced MA strategies and de-cluttering of indicator list.
To identify lines, Color combination should be somewhat warmer/lighter to cooler/darker colors.
EMA have a thicker line than the SMA. Color pairs have lighter/darker in cases where there are slight variations (when using one over another).
3 EMA & SMA (Market Cycle)Simple Indicator based on 3 Simple and 3 Exponential Moving Averages. Used to indicate Market Cycles.
Definition of Bull Market: 10 SMA is above 21 EMA . 30 SMA slope is up. 55 EMA is trending above 200 EMA .
Definition of Bear Market: 10 SMA is below 21 EMA . 30 SMA slope is down. 55 EMA is trending below 200 EMA .
SSL Channel BFSSL Channel Close is a great all-rounder based on 2 Simple Moving Averages, one of recent Highs, one of recent Lows.
The calculation prints a channel on the chart consisting of 2 lines.
This strategy gives a Long signal when price closes above the top of these 2 lines and a Short signal when it closes below the bottom.
Trading in choppy sideways markets can compound losses so we avoid that here by using recent ATR to determine relative volatility and refrain from trading when the background is White.
We use a basic 3% stop loss.
Charted on XBT/USD Bitmex Daily chart.
INSTRUCTIONS
Green = long
Red = short
White Background= No trade
The way I have set this strategy up is that if we get stopped out but we are still in a green or red background, we re-enter. Closing the trade only occurs on an opposing signal or if we get stopped out.
Scripting Tutorial 7 - Triple Many Moving Averages ResolutionsThis script is for a triple moving average indicator where the user can select from different types of moving averages, price sources, lookback periods and resolutions.
Features:
- 3 Moving Averages with variable MA types, periods, price sources, resolutions and the ability to disable each individually
- Crossovers are plotted on the chart with detailed information regarding the crossover (Ex: 50 SMA crossed over 200 SMA )
- Forecasting available for all three MAs. MA values are forecasted 5 values out and plotted as if a continuation to the MA.
- Forecast bias also applies to all forecasting. Bias means we can forecast based on an anticipated bullish, bearish or neutral direction in the market.
- To understand bias, please read the source code, or if you can't read the code just send me a message on here or Twitter. Twitter should be linked to my profile.
This script is meant as an educational script with well-formatted styling, and references for specific functions.
Multiple SMAs + X-Bar High/LowWhen starting my daily analysis, I typically open a daily chart and check where the price is compared to several SMAs, as well as check the high/low of today and the 10-day high/low. This indicator was designed to save chart space as well as make finding the highs and lows more efficient. Everything is adjustable, so you don't have to stick with my 10-bar rule.
MA X 200 BFGo long when the price closes above the 200 SMA.
Go short when the price crosses under the 200 SMA.
Keep it simple.
MavCrossover v2Simple moving average crossover strategy with
SMA and EMA,
a time window and
the possibility to set the 2nd MA as a factor of the 1st one (to quick cycle through them)
DT21 Moving Averages
I know a lot of people use the free version of TradingView, So I made a script to combine 5 Moving averages as 1 indicator for my followers
Scripting Tutorial 6 - Triple Many Moving Averages ForecastingThis script is for a triple moving average indicator where the user can select from different types of moving averages, price sources and lookback periods.
Features:
- 3 Moving Averages with variable MA types, periods, price sources and ability to disable each individually
- Crossovers are plotted on the chart with detailed information regarding the crossover (Ex: 50 SMA crossed over 200 SMA )
- Forecasting available for all three MAs. MA values are forecasted 5 values out and plotted as if a continuation to the MA.
- Forecast bias also applies to all forecasting. Bias means we can forecast based on an anticipated bullish, bearish or neutral direction in the market.
- To understand bias, please read the source code, or if you can't read the code just send me a message on here or Twitter. Twitter should be linked on my profile.
This script is meant as an educational script with well-formatted styling, and references for specific functions.
Volume-supported Fractal SRModified version of SynapticEX's Volume-supported Fractal S/R with EMA instead of SMA, pinescript 4 port, and EMA20/EMA50 defaults for support and resistance.
EMA20 = red/green
EMA50 = orange/yellow
MTF Bollinger Bands - ModifiedModified version of tansancrypto's MTF Bollinger to Pinescript 4 and removed limiters on BB1/BB2 max Sigma values.
Original Script:
Scripting Tutorial 5 - Triple Many Moving Averages CrossoversThis script is for a triple moving average indicator where the user can select from different types of moving averages and periods. This script improves upon tutorial 3 by adding source selection for MAs and another option for an MA that is not built-in, the HMA . It is meant as an educational script with well formatted styling, and references for specific functions.
Scripting Tutorial 3 - Triple Many Moving AveragesThis script is for a triple moving average indicator where the user can select from different types of moving averages. It is meant as an educational script with well formatted styling, and references for specific functions.
Scripting Tutorial 1 - Simple Moving AverageThis script is for a simple moving average indicator. It is meant as an educational script with well formatted styling, and references for specific functions.
DT-21 Moving AveragesI know a lot of people use the free version of TradingView, So I made a script to combine 5 Moving averages as 1 indicator.
X Period High/Low/MidToday we have a simple, but endlessly versatile, indicator that plots the X Period High/Low/Mid of your chosen market.
Traditionally the 52 week High/Low is used as a breakout signal. However, by changing to an X period, and adding a midway line, we create a more versatile indicator that can be tailored to various markets.
By default it's set at 250 periods (because I like the 250 period moving average), and I generally trade H4 and Daily time frames. But tweak it to your liking, you just have to modify the length periods by your desired time frame and lookback length. E.g. to create a 52 week indicator on the daily time frame, enter a length of 260 in the indicator (5 days per week * 52 weeks = 260).
For the above reason, I haven't made this indicator MTF, as there's no real need. However, if users find it easier I can look at adding it later.
Also, the mid point between an X period high/low is often a good trend-follower, as well as acting as support/resistance . I encourage you to experiment with different ways of using this indicator. Entire systems (if your risk management is correct) can be built and traded from this one indicator.
Good luck.
DD
VWAP/MVWAP/SMA CROSSOVERTo use this indicator is simple.
When the VWAP (Thick Yellow) AND the two SMA (Orange and thin Yellow) cross above the MVWAP (Purple) then you will be in a uptrend that could possibly continue upwards. The opposite is true if you are looking a short opportunity, wait for the three other lines to cross under the MVWAP and you should be in a downtrend that could possibly continue downwards
Of course as with all indicators not every signal will be 100% accurate there is no way to predict human emotions when it comes to trading but based on the VWAP strategy used in other markets this is the closest I could get.
Note: Don't relay completely on this indicator to think for you. Use other forms of TA to confirm all positions before entering. And if the candles start trending the opposite direction after a lets say a mini pump/dump then the signal was false.
Finally this was made according to the 15 minute chart. I did not plan on remaking it for any other timeframes as I have left the code open for you to tweak and the setting are free to adjust aswell.
Q/A
Q: Does it repaint?
A: No, this is based on moving averages as far as I know they don't repaint.
Q: How did you come up with this indicator?
A: Went on youtube looking for trading strategies other and the usual EMA crosses and found a VWAP & EMA strat. I added the MVWAP and played with the numbers until I found something that I liked.
Q: How long have you been trading/learning pinescript?
A: Been trading less than a two months and pinescript about a month and a half.
Forecast 7 SMA's 6 periodsForecast 7 SMA's 6 periods
This script is an upgrade of the existing Triple MA Forecast from Yatrader2
To allow the user to display 7 different SMAs and look 6 candles ahead
Default Value
8 SMA
13 SMA
20 SMA
50 SMA
100 SMA
128 SMA
200 SMA
Note:
Best to use on high timeframe, if on low timeframe change the forecast maximum to lower
This was made to forecast the 20 SMA on weekly timeframe on the upcomming Bitcoin price
MA Divergence 2060Show the divergence between two moving averages.
If there is a cross between 20 and 60, it is a significant short-term trend change.
Look at the color of the area.
I can see the main trend at the moment.
The center of the change is the intersection of the two MA