Double MACD With Crossover AlertDouble MACD With Crossover Alert
Double MACD with Crossover Alert is based on 2 MACD Histograms with different length settings on top of each other. The first MACD histogram is plotted as a line while the second MACD is plotted as columns. The default MA type for MACD1 is ZEMA or Zero Lag Moving Average.
What is MACD?
Moving average convergence/divergence (MACD) is a technical indicator to help investors identify price trends, measure trend momentum, and identify market entry points for buying or selling. Moving average convergence/divergence (MACD) is a trend-following momentum indicator that shows the relationship between two exponential moving averages (EMAs) of a security’s price. MACD was developed in the 1970s by Gerald Appel.
What is Zero Lag?
Zero lag is a technical analysis tool that aims to reduce or eliminate lag in trend-following indicators that average price over time. Zero lag indicators are designed to provide signals with little or no delay, allowing traders to enter and exit trades quickly and potentially profit from small price movements. Zero-Lag Exponential Moving Average (ZEMA), uses a double-smoothing process to provide a smoother and more responsive moving average. ZEMA can help traders identify trends more quickly, adapt to changing market conditions, and make more informed decisions.
How To Use?
When the MACD1 crosses above the zero line and the MACD2 histogram color is dark green (up trend), then a buy alert (blue triangle) is plotted.
When the MACD1 crosses below the zero line and the MACD2 histogram color is dark red (down trend), then a sell alert (yellow triangle) is plotted.
All the MACD1 and MACD2 lengths are configurable. This indicator can be combined with other technical indicators to verify the idea behind this theory.
-----------------
Disclaimer
The information contained in this indicator does not constitute any financial advice or a solicitation to buy or sell any securities of any type. My scripts/indicators/ideas are for everyone to use and verify with other technical indicators.
Zerolagema
MovingAveragesLibraryLibrary "MovingAveragesLibrary"
This is a library allowing one to select between many different Moving Average formulas to smooth out any float variable.
You can use this library to apply a Moving Average function to any series of data as long as your source is a float.
The default application would be for applying Moving Averages onto your chart. However, the scope of this library is beyond that. Any indicator or strategy you are building can benefit from this library.
You can apply different types of smoothing and moving average functions to your indicators, momentum oscillators, average true range calculations, support and resistance zones, envelope bands, channels, and anything you can think of to attempt to smooth out noise while finding a delicate balance against lag.
If you are developing an indicator, you can use the 'ave_func' to allow your users to select any Moving Average for any function or variable by creating an input string with the following structure:
var_name = input.string(, , )
Where the types of Moving Average you would like to be provided would be included in options.
Example:
i_ma_type = input.string(title = "Moving Average Type", defval = "Hull Moving Average", options = )
Where you would add after options the strings I have included for you at the top of the PineScript for your convenience.
Then for the output you desire, simply call 'ave_func' like so:
ma = ave_func(source, length, i_ma_type)
Now the plotted Moving Average will be the same as what you or your users select from the Input.
ema(src, len) Exponential Moving Average.
Parameters:
src : Series to use ('close' is used if no argument is supplied).
len : Lookback length to use.
Returns: Float value.
sma(src, len) Simple Moving Average.
Parameters:
src : Series to use ('close' is used if no argument is supplied).
len : Lookback length to use.
Returns: Float value.
rma(src, len) Relative Moving Average.
Parameters:
src : Series to use ('close' is used if no argument is supplied).
len : Lookback length to use.
Returns: Float value.
wma(src, len) Weighted Moving Average.
Parameters:
src : Series to use ('close' is used if no argument is supplied).
len : Lookback length to use.
Returns: Float value.
dv2(len) Donchian V2 function.
Parameters:
len : Lookback length to use.
Returns: Open + Close / 2 for the selected length.
ModFilt(src, len) Modular Filter smoothing function.
Parameters:
src : Series to use ('close' is used if no argument is supplied).
len : Lookback length to use.
Returns: Float value.
EDSMA(src, len) Ehlers Dynamic Smoothed Moving Average.
Parameters:
src : Series to use ('close' is used if no argument is supplied).
len : Lookback length to use.
Returns: EDSMA smoothing.
dema(x, t) Double Exponential Moving Average.
Parameters:
x : Series to use ('close' is used if no argument is supplied).
t : Lookback length to use.
Returns: DEMA smoothing.
tema(src, len) Triple Exponential Moving Average.
Parameters:
src : Series to use ('close' is used if no argument is supplied).
len : Lookback length to use.
Returns: TEMA smoothing.
smma(x, t) Smoothed Moving Average.
Parameters:
x : Series to use ('close' is used if no argument is supplied).
t : Lookback length to use.
Returns: SMMA smoothing.
vwma(x, t) Volume Weighted Moving Average.
Parameters:
x : Series to use ('close' is used if no argument is supplied).
t : Lookback length to use.
Returns: VWMA smoothing.
hullma(x, t) Hull Moving Average.
Parameters:
x : Series to use ('close' is used if no argument is supplied).
t : Lookback length to use.
Returns: Hull smoothing.
covwma(x, t) Coefficient of Variation Weighted Moving Average.
Parameters:
x : Series to use ('close' is used if no argument is supplied).
t : Lookback length to use.
Returns: COVWMA smoothing.
frama(x, t) Fractal Reactive Moving Average.
Parameters:
x : Series to use ('close' is used if no argument is supplied).
t : Lookback length to use.
Returns: FRAMA smoothing.
kama(x, t) Kaufman's Adaptive Moving Average.
Parameters:
x : Series to use ('close' is used if no argument is supplied).
t : Lookback length to use.
Returns: KAMA smoothing.
donchian(len) Donchian Calculation.
Parameters:
len : Lookback length to use.
Returns: Average of the highest price and the lowest price for the specified look-back period.
tma(src, len) Triangular Moving Average.
Parameters:
src : Series to use ('close' is used if no argument is supplied).
len : Lookback length to use.
Returns: TMA smoothing.
VAMA(src, len) Volatility Adjusted Moving Average.
Parameters:
src : Series to use ('close' is used if no argument is supplied).
len : Lookback length to use.
Returns: VAMA smoothing.
Jurik(src, len) Jurik Moving Average.
Parameters:
src : Series to use ('close' is used if no argument is supplied).
len : Lookback length to use.
Returns: JMA smoothing.
MCG(src, len) McGinley smoothing.
Parameters:
src : Series to use ('close' is used if no argument is supplied).
len : Lookback length to use.
Returns: McGinley smoothing.
zlema(series, length) Zero Lag Exponential Moving Average.
Parameters:
series : Series to use ('close' is used if no argument is supplied).
length : Lookback length to use.
Returns: ZLEMA smoothing.
xema(src, len) Optimized Exponential Moving Average.
Parameters:
src : Series to use ('close' is used if no argument is supplied).
len : Lookback length to use.
Returns: XEMA smoothing.
EhlersSuperSmoother(src, lower) Ehlers Super Smoother.
Parameters:
src : Series to use ('close' is used if no argument is supplied).
lower : Smoothing value to use.
Returns: Ehlers Super smoothing.
EhlersEmaSmoother(sig, smoothK, smoothP) Ehlers EMA Smoother.
Parameters:
sig : Series to use ('close' is used if no argument is supplied).
smoothK : Lookback length to use.
smoothP : Smothing value to use.
Returns: Ehlers EMA smoothing.
ave_func(in_src, in_len, in_type) Returns the source after running it through a Moving Average function.
Parameters:
in_src : Series to use ('close' is used if no argument is supplied).
in_len : Lookback period to be used for the Moving Average function.
in_type : Type of Moving Average function to use. Must have a string input to select the options from that MUST match the type-casing in the function below.
Returns: The source as a float after running it through the Moving Average function.
[blackcat] L2 Zero-lag EMA Swing TradeLevel: 2
Background
This script is a comprehensive work of mine, incorporating Ehlers zero-lag EMA and my first script published: MA fingerprint for long entries.
Function
Ehlers zero-lag EMA algorithm in this scripts is mainly used for short signal production, while my MA fingerprint algorithm is used for long entries.
Key Signal
a ---> Ehlers Zero-lag EMA fast line for subjective long jugement
b ---> Ehlers Zero-lag EMA slow line for subjective short jugement
long --> Swing long entry with partial postion
short --> Swing short entry with partial postion
Remarks
Feedbacks are appreciated. This script is optimized for 1D time frame.
Readme
In real life, I am a prolific inventor. I have successfully applied for more than 60 international and regional patents in the past 12 years. But in the past two years or so, I have tried to transfer my creativity to the development of trading strategies. Tradingview is the ideal platform for me. I am selecting and contributing some of the hundreds of scripts to publish in Tradingview community. Welcome everyone to interact with me to discuss these interesting pine scripts.
The scripts posted are categorized into 5 levels according to my efforts or manhours put into these works.
Level 1 : interesting script snippets or distinctive improvement from classic indicators or strategy. Level 1 scripts can usually appear in more complex indicators as a function module or element.
Level 2 : composite indicator/strategy. By selecting or combining several independent or dependent functions or sub indicators in proper way, the composite script exhibits a resonance phenomenon which can filter out noise or fake trading signal to enhance trading confidence level.
Level 3 : comprehensive indicator/strategy. They are simple trading systems based on my strategies. They are commonly containing several or all of entry signal, close signal, stop loss, take profit, re-entry, risk management, and position sizing techniques. Even some interesting fundamental and mass psychological aspects are incorporated.
Level 4 : script snippets or functions that do not disclose source code. Interesting element that can reveal market laws and work as raw material for indicators and strategies. If you find Level 1~2 scripts are helpful, Level 4 is a private version that took me far more efforts to develop.
Level 5 : indicator/strategy that do not disclose source code. private version of Level 3 script with my accumulated script processing skills or a large number of custom functions. I had a private function library built in past two years. Level 5 scripts use many of them to achieve private trading strategy.
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
Beep Boop(Improved) Beep Boop Indicator for Trending Markets originally written by Trading Rush.
It is originally based on the MACD 12-26 and the 50 bar EMA.
The macd hist is color coded with green as buy and sell as red.
I added an option to use a couple of lower lag ema's (See line 13 - ema_signal).
TradeChartist Spotter ™TradeChartist Spotter is a extremely well designed Trader's toolkit that packs a range of trading indicators like MACD, RSI, MA/MA-Crosses and Price-Volume Trend Oscillator, along with visual trade spotting tools like Symbol Tracker, MACD Trend Shadow plot and Coloured Bars, including a handy information Dashboard.
===================================================================================================================
™TradeChartist Spotter Features:
1. MACD
MACD is an essential indicator for any trader to track trend strength and momentum of asset prices. Spotter offers 3 MACD options - SMA, EMA and Zero-Lag EMA . Since MACD is based on moving averages, it is inherently a lagging indicator and may not work well when there is no trend strength or when the market is choppy. It is for this reason Spotter offers the option of Overall Trend Shadow and also the option to display Zero-Lag Trend Shadow on normal MACD based on SMA or EMA. This is based on the average of MACD and Signal plots.
Spotter's default MACD settings are 13/34/13, but this can be changed to the classic settings of 12/26/9 and the user can enable or disable the various elements of the MACD based on their preference.
The Dashboard on the MACD Spotter offers information on the symbol tracked, settings used and also the close price of the asset. This is really useful especially when tracking a different symbol than the current price chart symbol. Note that the actual MACD plot also will be of the symbol tracked if it is not the same as price chart symbol.
Using Zero-Lag Trend Shadow on normal SMA/EMA MACD histogram helps spot trend changes early. It is recommended to test different MACD settings on asset traded to suit trading style and frequency.
If MACD Histogram is disabled to see the Overall Trend better, make sure to switch back on as it should not be confused with the main MACD histogram which tracks the distance between the MACD and Signal plots.
2. RSI
RSI is the classic technical indicator that helps track the price magnitude and velocity of the asset's price movement. It helps spot Oversold and Overbought areas easily as it oscillates between 0 and 100, even though values below 10 and values above 90 are almost never seen. By using a upper band and a lower band plot, it is possible to track the strength of the up or down move.
Spotter's default RSI settings are ohlc4/14/5. EMA smoothing of 5 is used to eliminate the noise, but these can be changed to suit user's preference. The default Upper Band is 60 and Lower Band is 40 in the settings, as price moves above 60 RSI tend to be bullish and price moves below 40 tend to be bearish. This can be changed to 70/30 or 80/20 etc. based on how RSI is being used by the user.
RSI strength can also be visualised on the price bars using Spotter's Coloured Bars. The bar colours can be inverted to help traders see the price action differently.
RSI Dashboard also helps track another symbol, it's RSI value and close price to help the user track another symbol on the same chart. Note that the actual RSI plot also will be of the symbol tracked if it is not the same as price chart symbol.
3. MA/MA-Crosses
Two Moving averages (SMA, EMA or Zero-Lag EMA) can be plotted with MA Crosses using the MA/MA-Crosses Spotter.
The MACD input of Fast MA Length and Slow MA Length is used to plot the MA's. To plot just one MA, same value can be entered in both MA length boxes in the settings.
The plots can be merged with the main price chart by using Move Pane Above and by merging the scales into one.
The Dashboard also helps track another symbol, it's MA plots and close price to help the user track another symbol on the same chart. Note that the actual MA plots also will be of the symbol tracked if it is not the same as price chart symbol.
4. Price-Volume Trend Oscillator
Spotter converts the Price Volume Trend (PVT) into an Oscillator, as it helps spot divergences and makes it easy to plot PVT strength as coloured bars on main price chart.
No user input required for this Oscillator plot. Note: Some Symbols don't have volume information and hence PVT Oscillator will not work on them.
PVT Oscillator Dashboard displays current bar volume (if available) along with the close price. Similar to other plots in the Spotter, the Oscillator is of the symbol tracked if its not the same as price chart symbol.
5. Useful Extras
Coloured Bars - Paints price bars with strength and intensity based on indicator used. Bar Colours can be inverted by enabling Invert Bar Colors option from Spotter settings.
Five Colour Themes - Classic, Acute Classic, Effulgence, Firefly and Hallucination
Background colour - Same as bar colour strength, but painted subtly in the indicator background.
===================================================================================================================
Note:
Alerts can be created using the name of the plot under Alert Condition for Spotter - ™TradeChartist crossing above/below etc based on the type of alert the user wants to get.
The indicator does not repaint. Alerts may display potential repaint warning, but this is because the code uses bar index for the Dashboard. For confidence in the indicator, it can be tested using bar replay to make sure the real-time and bar replay trade entries and plots stay on the same bar/timestamp.
™TradeChartist Spotter can be connected to ™TradeChartist Plug and Trade (Premium Script - not free) to generate Trade Entries, Targets, Sop Loss plots etc and to create all types of alerts. Example chart below using LINK-USDT.
===================================================================================================================
Example Charts
1. BTC-USDT 1 hr chart showing MACD with classic settings 12/26/9 on top pane with normal Overall Trend Shadow and the bottom pane with exact same settings with Zero-Lag Overall Trend Shadow.
2. XAU-USD 4 hr chart showing MACD (13/55/34) using Zero-Lag EMA.
3.ADA-USDT 1 hr chart with Price-Volume Trend Oscillator - Useful for confirming divergences and trade decisions based on volume.
4. SPX 15m chart with RSI (ohlc4,14,5) in bottom pane and 5/34 MA cross Spotter on Price Chart with Dashboard.
5. GBP-USD 1 hr chart with Spotter tracking MACD (13/89/34) of DXY (Different Symbol from GBP-USD on chart)
===================================================================================================================
Best Practice: Test with different settings first using Paper Trades before trading with real money
This is a free to use indicator.
===================================================================================================================
TA Basics: Creating a Zero Lag Moving Average using "Mirroring"we all know how moving averages suffer from lag - they have a delayed response to change in the underlying values - regardless if the underlying values are price movement or some kind of indicator formula that we are trying to smooth using a moving average.
here's a simple technique that can help minimize the lag built into the moving average - you can use this technique while building your own indicator (say modifying RSI) or simply apply it to a price chart to generate some sort of signal.
the concept here is simple and it actually depends on the fact that there's lag in moving averages - however, it was also observed that this lag is less when we use a weighted moving average (WMA) vs a simple moving average (SMA). (for a quick intro / refresher on Moving Averages, there's an awesome write-up here on TradingView that you can easily find with a quick search)
so the idea is to take the delta between these 2 lines (which is mathematically equal to SMA - WMA) , and "mirror it" on the other side of the WMA to produce the new Zero-lag line (let's call it ZLMA. sounds easy, right?
now, expanding on this concept just one step further, while we're at it, why don't we take, say, 1.5 times that delta, or 2 times and mirror it - wouldn't that produce an even less lagging line that moves in lockstep with the price (or whatever data series)? -- yes it would, we added that in the sample code here, but be careful with that, if you increase that factor too much, the ZLMA starts behaving "wildly" and loses relevance to the underlying data. so keep it from 1 to 2.5 -- an ideal value would be around the 1.5 (and of course, for the mathematically gifted, as you expect, you make that factor -1.0, and you end up with a ZLMA that is exactly same as the SMA :) ..
if you don't use a ZLMA factor "f" -- then the simple equation is ZLMA = 2W - S, which you can simply add to any indicator to smoother it without introducing a lot of lag -- however, i still suggest you keep that smoothing to a small value between 3 and 6 -- to stay relevant to underlying data
hope you like this and find it useful. let me know -- i'd like to know if there's interest in these types of concepts and there's more to come.
pls stay safe,
ZeroLag MAsZeroLag MAs using DEMA and TEMA inside it.
Added Bollinger Bands to spot bottom and top easier too.
Koby's 3 average MACD indicatorThis MACD is averaging 3 different MACD; KAMA MACD, ZLEMA MACD, and normal MACD.
Can find easier MACD's divergence and convergence than normal MACD.
And more smoothly drawing than ZLEMA MACD (KZ_MACD) which is I've made before.
Koby's ZLEMA MACD and KAMA signalUsing zero lag ema for MACD line, and using KAMA for MACD's signal line.
Test version.
This has MACD and signal cross alert, and 0 line alert.