EMA Cross StrategyThis double EMA crossover strategy aims to illustrate a good strategy design.
It is currently the only published script that:
supports a proper date picker for the backtest period
is able to test in short and long mode only
Crossover
Previous Period Levels - X Alerts====== ABOUT THIS INDICATOR
- A simple but highly customisable display of previous higher time-frame
OHLC values, drawn using line.new and label.new. Nothing fancy but...
- Customised resolution input which excludes time frames lower than 1 hour
while extending the common higher reference inputs to include:
• 6, and 12 Hour
• 5 Day
• 3, and 6 Month
• 1 Year
- Alert conditions using an adjustable SMA to help reduce false positive
spam.
- Full visual customisation options for (almost) every aspect, so it can be
tuned to suit most individual preferences.
- In line with the miriad visual customisation options is the ability to
change the display format of the Labels, to show more or less information,
or disable them altogether.
====== REASON FOR STUDY
- To practice advanced user input option handling to allow for a full visual
customisation experience without stepping outside of, or interfering with,
the intended function of the indicator.
- Provide reasonably clear code commenting and structure in order to be
useful as a potential learning aid for others, and future reference for
myself.
====== DISCLAIMER
Any trade decisions you make are entirely your own responsibility.
I've made an effort to squash all the bugs, but you never know!
Combined Momentum MA (Equal-Length EMA/SMA Crossover)Overview:
This momentum and trend-following strategy captures the majority of any trending move, and works well on high timeframes.
It uses an equal-period EMA and SMA crossover to detect trend acceleration/deceleration, since an EMA places a greater weight and significance on the most recent data.
To reduce noise and optimize entries, we combined this with an overall trend bias for further confluence.
How it works:
Signals are determined by the crossover of an EMA and SMA of the same length, e.g. EMA-50 and SMA-50.
The overall trend bias is determined using a slower SMA golden/death cross, e.g. SMA-50 and SMA-100.
The signal is stronger when it occurs in confluence with the overall trend bias, e.g. when EMA-50 crosses over SMA-50, while above the SMA-100. This is analogous to only opening long positions in a bull market.
Indicator description:
GREEN: Up Trend (EMA is above SMA, while EMA is above BIAS_MA. This shows a bullish confluence.)
YELLOW: No Trend (EMA/SMA crossover and BIAS_MA are not in confluence.)
RED = Down Trend (EMA is below SMA, while EMA is below BIAS_MA. This shows a bearish confluence.)
Equal-Length EMA/SMA Crossover Momentum StrategyOverview:
This momentum and trend-following strategy captures the majority of any trending move, and works well on high timeframes.
It uses an equal-period EMA and SMA crossover to detect trend acceleration/deceleration, since an EMA places a greater weight and significance on the most recent data.
This version is optimized for longs, and designed to cut your losses quickly and let your winners run.
To reduce noise and optimize entries, we combined this with an overall trend bias for further confluence.
How it works:
Signals are determined by the crossover of an EMA and SMA of the same length, e.g. EMA-50 and SMA-50.
The overall trend bias is determined using a slower SMA golden/death cross, e.g. SMA-50 and SMA-100.
The signal is stronger when it occurs in confluence with the overall trend bias, e.g. when EMA-50 crosses over SMA-50, while above the SMA-100. This is analogous to only opening long positions in a bull market.
Signal description:
Trend Buy: EMA crosses above SMA, and overall trend bias is bullish. Buying is in confluence with the overall trend bias.
Risky Buy: EMA crosses above SMA, and overall trend bias is bearish. Buying is early, more risky, and not in confluence with the overall trend bias.
Late Buy: SMA crosses above BIAS_SLOW. This gives further confirmation of bullish trend, but signal comes later.
Sell: EMA crosses under SMA.
Strategy entry and exit conditions:
This version enters a Long when "TREND BUY" is signalled.
This version has Sell/Shorts disabled because UP ONLY.
Long entry: Strategy enters Long when EMA is above SMA, while overall trend bias is bullish.
Long exit: Close long when EMA crosses under SMA.
Combo Backtest 123 Reversal & MACD Crossover This is combo strategies for get a cumulative signal.
First strategy
This System was created from the Book "How I Tripled My Money In The
Futures Market" by Ulf Jensen, Page 183. This is reverse type of strategies.
The strategy buys at market, if close price is higher than the previous close
during 2 days and the meaning of 9-days Stochastic Slow Oscillator is lower than 50.
The strategy sells at market, if close price is lower than the previous close price
during 2 days and the meaning of 9-days Stochastic Fast Oscillator is higher than 50.
Second strategy
MACD – Moving Average Convergence Divergence. The MACD is calculated
by subtracting a 26-day moving average of a security's price from a
12-day moving average of its price. The result is an indicator that
oscillates above and below zero. When the MACD is above zero, it means
the 12-day moving average is higher than the 26-day moving average.
This is bullish as it shows that current expectations (i.e., the 12-day
moving average) are more bullish than previous expectations (i.e., the
26-day average). This implies a bullish, or upward, shift in the supply/demand
lines. When the MACD falls below zero, it means that the 12-day moving average
is less than the 26-day moving average, implying a bearish shift in the
supply/demand lines.
A 9-day moving average of the MACD (not of the security's price) is usually
plotted on top of the MACD indicator. This line is referred to as the "signal"
line. The signal line anticipates the convergence of the two moving averages
(i.e., the movement of the MACD toward the zero line).
Let's consider the rational behind this technique. The MACD is the difference
between two moving averages of price. When the shorter-term moving average rises
above the longer-term moving average (i.e., the MACD rises above zero), it means
that investor expectations are becoming more bullish (i.e., there has been an
upward shift in the supply/demand lines). By plotting a 9-day moving average of
the MACD, we can see the changing of expectations (i.e., the shifting of the
supply/demand lines) as they occur.
WARNING:
- For purpose educate only
- This script to change bars colors.
EMA Cross Levels + Standard DeviationPlots the price level that the most recent EMA crossover occurred at(Green if bullish and red if bearish).
Also calculates standard deviation over a shorter window-length/lookback period (of 'n_std_fast' length) and another over a much longer span of periods(n='n_std_slow', > 'n_std_fast').
These are the two dotted lines appearing as bands around the cross-level line.
Double EMA CROSS
Double EMA CROSS (DEC)
Useful for identifying and receiving alerts about uptrends and downtrends.
This script uses two Exponential Moving Averages (EMAs) to find price uptrends and downtrends.
An Exponential Moving Average ( EMA ) is a type of moving average that places a greater weight and significance on the most recent data points.
The script produces uptrend and downtrend signals based on crossovers and divergences between the two EMAs,
the user will be able to spot a trend change (when the EMAs crossover) and to determine the strength of the current trend (when the EMAs diverge).
It is also posible to get alerts for uptrends and downtrends on the web and mobile app with sound and pop-ups as well as via email.
The optimal time to enter and exit the market can be concluded from this trend changes.
The user can set their own EMAs, by default they are set to 25 and 75 periods for medium and long term respectively.
When the medium term EMA crosses below the long term EMA the asset is in a downtrend and the price will decline, and when the
medium term EMA crosses above the long term EMA the asset is in an uptrend and price will increase.
This scripts plots the following indicators and signals on the chart to help the user to identify trends:
1.- Medium and long term EMAs as lines overlaid on the price chart.
2.- Up green triangles above bars when the price is on an uptrend and down red triangles below bars when the price is on a downtrend.
3.- Arrows with text to indicate the start of an uptrend or downtrend.
The user can enable and disable the indicators and signals as well as set colors and shapes to their liking.
This script also lets the user create alerts for uptrends and downtrends. To create a new alert using this script follow this instructions:
1.- Once you added this script to your chart, go to the alerts panel (right on web or bottom tool bar on the mobile app) and add a new alert (alarm clock icon with a plus sign).
2.- A modal window will open. On the “Condition” dropdown menu select “DEC”.
3.- On the next dropdown menu (right below the “Condition” one) you can select.
4.- Lastly you can set all the normal alert options and create the alert.
EMA CrossoversUseful for identifying and receiving alerts about uptrends and downtrends.
This script uses two Exponential Moving Averages (EMAs) to find price uptrends and downtrends. An Exponential Moving Average (EMA) is a type of moving average that places a greater weight and significance on the most recent data points. The script produces uptrend and downtrend signals based on crossovers and divergences between the two EMAs, the user will be able to spot a trend change (when the EMAs crossover) and to determine the strength of the current trend (when the EMAs diverge). It is also posible to get alerts for uptrends and downtrends on the web and mobile app with sound and pop-ups as well as via email. The optimal time to enter and exit the market can be concluded from this trend changes.
The user can set their own EMAs, by default they are set to 21 and 55 periods for medium and long term respectively. When the medium term EMA crosses below the long term EMA the asset is in a downtrend and the price will decline, and when the medium term EMA crosses above the long term EMA the asset is in an uptrend and price will increase.
This scripts plots the following indicators and signals on the chart to help the user to identify trends:
1.- Medium and long term EMAs as lines overlaid on the price chart.
2.- Up green triangles above bars when the price is on an uptrend and down red triangles below bars when the price is on a downtrend.
3.- Arrows with text to indicate the start of an uptrend or downtrend.
The user can enable and disable the indicators and signals as well as set colors and shapes to their liking.
This script also lets the user create alerts for uptrends and downtrends. To create a new alert using this script follow this instructions:
1.- Once you added this script to your chart, go to the alerts panel (right on web or bottom tool bar on the mobile app) and add a new alert (alarm clock icon with a plus sign).
2.- A modal window will open. On the “Condition” dropdown menu select “EMA Crossovers”.
3.- On the next dropdown menu (right below the “Condition” one) you can select from two types of alerts “Uptrend started” and “Downtrend started”.
4.- Lastly you can set all the normal alert options and create the alert.
Krown Moving Averages & Crossover LevelsIntroducing Krown Moving Averages with Crossover levels.
This indicator
Plots 5 Ema's and 3 SMA's ( Default Krown Periods )
It calculates the price levels at which each pair of moving averages would be equal .
That means that if price closes the other side of that level the pair of moving will cross also.
These levels can therefore be considered as " crossover levels....( the price level where each pair of moving averages will cross)
It can give crossover levels for
SMA crossing SMA
EMA crossing EMA
EMA crossing SMA
Plots optional Labels for all crossover levels....(off by default needs to be turned on in the settings)
Plots optional crossover levels as lines and dots colored as the 2 colors of the pair of moving averages.....(off by default needs to be turned on in the settings)
This indicator is aimed at traders who use simple and exponential moving average crossovers as part of their trading plan or edge.
It takes the guesswork out of knowing at what price level a pair of moving averages will cross which helps to improve entries and risk management.
There is an optional "Cutoff" function and user adjustable "limit factor" which cuts the plots off once they are too far below or above the current price to prevent chart auto focus issues.
There is a decimal place truncation option to set the decimal places depending on the asset type and price accuracy required.
Inspired by a request from a community member after one of my recent reverse engineered indicator publications.
I am publishing this open source in the hopes that some newer coders will find the functions interesting and useful.
Equal-Length EMA/SMA Crossover Momentum Signal V1Overview:
This momentum and trend-following strategy captures the majority of any trending move, and works well on high timeframes.
It uses an equal-period EMA and SMA crossover to detect trend acceleration/deceleration, since an EMA places a greater weight and significance on the most recent data.
This version is optimized for longs, and designed to cut your losses quickly and let your winners run.
To reduce noise and optimize entries, we combined this with an overall trend bias for further confluence.
How it works:
Signals are determined by the crossover of an EMA and SMA of the same length, e.g. EMA-50 and SMA-50.
The overall trend bias is determined using a slower SMA golden/death cross, e.g. SMA-50 and SMA-100.
The signal is stronger when it occurs in confluence with the overall trend bias, e.g. when EMA-50 crosses over SMA-50, while above the SMA-100. This is analogous to only opening long positions in a bull market.
Signal description:
Trend Buy: EMA crosses above SMA, and overall trend bias is bullish. Buying is in confluence with the overall trend bias.
Risky Buy: EMA crosses above SMA, and overall trend bias is bearish. Buying is early, more risky, and not in confluence with the overall trend bias.
Late Buy: SMA crosses above BIAS_SLOW. This gives further confirmation of bullish trend, but signal comes later.
Sell: EMA crosses under SMA.
AM_ZLWMA Crossover_xDear All,
Please find updated version of Zero lag WMA crossover. In addition to this added 20/50 EMA to get better results.
Settings:
ZLWMA = 8 identified by Blue line
Fast WMA = 21 identified by Red line
EMA Period 20/50
How to Trade:
Buy: Wait for positive crossover (Blue cross above Red) to happen trade can be taken there but to get better results post crossover once price move above EMA 20 then buy can be initiated.
Sell: Wait for negative crossover (Blue cross below Red) to happen trade can be taken there but to get better results post crossover once price move below EMA 20 then sell can be initiated.
Reason to wait for confirmation of price action above / Below moving average is most of the time it happens that even after crossover happens sometimes it was just a pull back and from there it could be a possibility for reversal. Once price action confirms moving above / below EMA20 then trade will be initiated.
Please comment and ask for any doubt
On Chart Anticipated Moving Average Crossover IndicatorIntroducing the on chart moving average crossover indicator.
This is my On Chart Pinescript implementation of the Anticipated Simple Moving Average Crossover idea.
This indicator plots 6 user defined moving averages.
It also plots the 5 price levels required on the next close to cross a user selected moving average with the 5 other user defined moving averages
It also gives signals of anticipated moving average crosses as arrows on chart and also as tradingview alerts with a very high degree of accuracy
Much respect to the creator of the original idea Mr. Dimitris Tsokakis
Moving Averages
A moving average simplifies price data by smoothing it out by averaging closing prices and creating one flowing line which makes seeing the trend easier.
Moving averages can work well in strong trending conditions, but poorly in choppy or ranging conditions.
Adjusting the time frame can remedy this problem temporarily, although at some point, these issues are likely to occur regardless of the time frame chosen for the moving average(s).
While Exponential moving averages react quicker to price changes than simple moving averages. In some cases, this may be good, and in others, it may cause false signals.
Moving averages with a shorter look back period (20 days, for example) will also respond quicker to price changes than an average with a longer look back period (200 days).
Trading Strategies — Moving Average Crossovers
Moving average crossovers are a popular strategy for both entries and exits. MAs can also highlight areas of potential support or resistance.
The first type is a price crossover, which is when the price crosses above or below a moving average to signal a potential change in trend.
Another strategy is to apply two moving averages to a chart: one longer and one shorter.
When the shorter-term MA crosses above the longer-term MA, it's a buy signal, as it indicates that the trend is shifting up. This is known as a "golden cross."
Meanwhile, when the shorter-term MA crosses below the longer-term MA, it's a sell signal, as it indicates that the trend is shifting down. This is known as a "dead/death cross."
MA and MA Cross Strategy Disadvantages
Moving averages are calculated based on historical data, and while this may appear predictive nothing about the calculation is predictive in nature.
Moving averages are always based on historical data and simply show the average price over a certain time period.
Therefore, results using moving averages can be quite random.
At times, the market seems to respect MA support/resistance and trade signals, and at other times, it shows these indicators no respect.
One major problem is that, if the price action becomes choppy, the price may swing back and forth, generating multiple trend reversal or trade signals.
When this occurs, it's best to step aside or utilize another indicator to help clarify the trend.
The same thing can occur with MA crossovers when the MAs get "tangled up" for a period of time during periods of consolidation, triggering multiple losing trades.
Ensure you use a robust risk management system to avoid getting "Chopped Up" or "Whip Sawed" during these periods.
MACD Hybrid BSHMACD = Moving Average Convergence and Divergence
Hybrid = Combining the two main MACD signals into one indicator
BSH = Buy Sell Hold
This indicator looks for a crossover of the MACD moving averages (12ema and 26ema) in order to generate a buy/sell signal and a crossover of the MACD line (12ema minus 26ema) and MACD signal line (9ema of MACD line) in order to generate a completely seperate buy/sell signal. The two buy/sell signals are combined into a hybrid buy/sell/hold indicator which looks for one, neither, or both signals to be "buys." If both signals are buys (fast crossed above slow), a "buy" signal is given (green bar color). If only one signal is a buy, a "hold" signal is given (yellow bar color). If neither signal is a buy, a "sell" signal is given (red bar color). Note: MACD moving averages crossing over is the same thing as the MACD line crossing the zero level in the MACD indicator.
It makes sense to have the MACD indicator loaded as a reference when using this but it isn't required. The lines plotted on the chart are the 12ema and a signal line which is the MACD signal line shown relative to the 12ema rather than the MACD line. The 26ema is not plotted on the chart because the chart becomes cluttered, plus the moving averages crossing over is indicated with the MACD indicator.
This indicator should be used with other indicators such as ATR (1), RSI (14), Bollinger bands (20, 2), etc. in order to determine the best course of action when a signal is given. One way to use this as a strict system is to take a neutral cash position when a yellow "hold" signal is given, to go long when a
green "buy" signal is given, and to go short when a red "sell" signal is given. It can be observed that for many tickers and timeframes that green-yellow-green and red-yellow-red sequences are stronger signals than green-yellow-red and red-yellow-green signals.
Note: Chart type must be "bars" in order for the bar colorization to work properly
Moving Average 4 & 8 daily, on all timeframesThis script takes 2 of the most popular moving averages ( 4 & 8 SMA ) in one indicator and will allow you the set the resolution to any time frame you want. If you are day trading, but want to keep an eye on the daily 4 SMA and 8 SMA on your 5 min chart; this script will do the trick. You can also change the period for both MA's.
TeoTrading 38 - Moving Average Crossover - Long-ShortWith this indicator you can obtain the percent of gain / loss of each trade based on Moving Average Crossover.
Prints different types of moving Average: SMA , EMA , WMA and VWMA.
It is usefull to view in only few minutes differents crossovers.
The crossver´s in LONG Trades are indicated with:
"P": Positive Crossover. Open a Long Trade.
Green: Negative Crossover with gain. Close the Long Trade.
Red: Negative Crossover with Loss. Close the Long Trade.
The crossver´s in SHORT Trades are indicated with:
"N": Negative Crossover. Open a Short Trade.
Green: Positive Crossover with gain. Close the Short Trade.
Red: Positive Crossover with Loss. Close the Short Trade.
The Percents of gain and loss are indicated in the Labels.
Input Parameters:
Type of Trade: Long/Short.
Type_: Type of Moving Average.
PrintPrice: Enable open value print.
Fast: Fast Moving Average.
Slow: Slow Moving Average.
This indicator does not generate recommendations to buy or to sell. It was designed ONLY for educational purposes.
Bollinger Band Crossover SignalI'm a little surprised I couldn't find a BB crossover script on here since I've always used it on other charting software. So of course I had to write one in for TradingView.
Essentially what this script signifies are price breakouts when price crosses over the upper BB band. So what it shows is that market conditions are entering overbought territory.
Length is set to 20 and Standard Deviation is set to 2. These are the default settings.
The way I use the script is to identify breakouts in price, as well as a signal to start scaling out of a position if I am already in one.
Moving Average Cross Strategy early Closing This is my example for the Moving Average Cross Strategy with early Closing. You can modify the strategy for your individual setup and market.
I tested the strategy in DAX30 and SP55
% Sensitivity MA Cross [racer8]This is my third published indicator on % Sensitivity MA, if you're not familiar with it, go check out my first one.
This time its a cross between 2 % Sensitivity MAs.
Cross impro test by Canundo Crossover Crossunder Tick valuesThis is a script where I tried to check the following things:
Even thought the tick of an asset is, for example 0.5, there are calculated prices, like SMA's that have even more decimals. Leading to crosses happening that for example happen at the same price. Consequently triggering totally useless in side markets. What happens if SMA values are restricted to the tick resolution? (Option works on it's own or with a combination of the others.)
What happens if I set my own tick value, like 0.8 instead of 0.5, what will be the effect for calculated values that are used for crossings? Will tick sizes improve the success rate? (This option will work only when the first option is active.)
Can success rate, especially for sideway markets be improved when adding a spread between MA's, so that it triggers less in sideway markets? (Option works on it's own or with a combination of the others.)
First of all, I had a hard time to round prices properly when it needs to be dynamic and working for different assets with different amounts of decimal values in the tick. The solution is that abs(floor(syminfo.mintick)) will give you the amount of decimals a tick has. It works for all ticks that are at least lower than 10. I'm not sure how huge ticks are out there. I did not implement this solution at the end since I found another way to test it.
Findings:
The first option, when activated, takes out half the trades and raises the percent profitability by 8% so there is some effect. However, all of the tested options have less advantage than I hoped for but are nevertheless something worthy for sideway markets. The first option just forces the MA's from the example to use the tick resolution.
See these two images. One when the first option is off, the second when it's active.
The lines are the MA's with adjusted values, the crosses are the places of the MA's when left as is.
Here a screenshot of the third option set to the value 2 on the 1 minute XBTUSD chart.
The advantage is that less trades trigger that have a low change in price and so less trading fees will happen.
The disadvantage is that all options can implement some delay for a crossing since the crossing will trigger once a slightly bigger move into the direction was taken.
This test environment was not meant to be profitable but to test the effects.
Maybe someone finds it interesting or wanted to test the same, so here you can save some work.
Every single moving average (ALMA, EMA, HMA, KAMA, RMA, SMA...)So you may be looking at the graph and thinking "this is a mess", and I agree.
The purpose of this script is to plot in the same graph every single type of moving average that I could think of, so you can find the ones that are better for your timeframe and for your asset. Once you add it, disable those types that doesn't seem to serve your purpose, until you can select one you like.
The average types are: ALMA, EMA, HMA, KAMA, RMA, SMA, SWMA, VIDYA, VWAP, VWMA, and WMA. Each one is ploted two times (except SWMA and VWAP), one with a short period, and another with a long, both of which you can configure.
Finnie's RSI + 3EMA crossover + MFI + Vix Fix-added a medium and long term rsiEMA, in addition to the previous short term, except this time there's a visual crossover :)
-added CM Williams vix fix
-and finally just a general visual overhaul!
Riley's Movement IndexBrief Description:
Riley's Movement Index is a new indicator developed and named after me.
RMI is quite interesting in that uses two lines to cross each other.
One line represents the bullish side of the market, and the other line represents the bearish side of the market.
A signal occurs when the two lines cross each other.
-------------------------------------------
Calculation:
Up
1. high > prev high?
2. If yes, then Up = (high - prev high)
3. If no, then Up = 0
Dn
1. low < prev low?
2. If yes, then Dn = (prev low - low)
3. If no, then Dn = 0
SumUp (n) = Sum of Up over n periods
SumDn (n) = Sum of Dn over n periods
Plot SumUp & SumDn lines.
-------------------------------------------
How to interpret a signal:
When SumUp > SumDn, market is bullish.
When SumUp < SumDn, market is bearish.
-------------------------------------------
Recommended setting:
I would suggest a setting of 10, the default setting.
-------------------------------------------
Enjoy, and smash that follow button!