The easiest way to use divergences in your own Pine strategiesDetecting divergences in a Pine indicator / strategy is easy.
You simply have to compare the pivot lows and the pivot highs on the price and the oscillator, and if you can identify a difference between the last & previous pivots made on the price and the oscillator, you have likely found a divergence.
Using this theory, here is an example how you would detect a Regular Bearish divergence:
While the theory of divergence detection is simple, more often than not, things go wrong (the divergence indicator used in the example below is TradingView's built-in Divergence Indicator ):
Would you identify this as a divergence? If not, why not? Is it because the divergence line is slicing through the candles? Or because the line is slicing through the oscillator? Or something else?
Wouldn't it be great if somehow you could filter out invalid divergences from code, such as this one?
We at Whitebox Software were wondering about the same thing, and decided to find a solution to this problem. This is when we realised that while detecting divergences is easy, detecting valid divergences is hard...
After several months in development, we are proud to present to you our divergence indicator called The Divergent .
The Divergent is an advanced divergence indicator with over 2500 lines of Pine Script, exposing over 30 different configuration options, including 9 built-in oscillators, to allow you to tweak every aspect of divergence detection to perfection.
For example, the Line of Sight™ filter in The Divergent would have easily filtered out this invalid divergence above. The Line of Sight™ filter will notice any interruption to the divergence line connecting the price or the oscillator, and will treat the divergence as invalid.
This filter is one of many, which has been created to reduce the false positive detections to a minimum. (In later publications, we will discuss each and every filter in detail).
Alright, so The Divergent knows how to detect accurate divergences, but how is it going to help you detect divergences in your own Pine strategy?
The Divergent is not simply a divergence indicator - it can also emit divergence signals * which you can catch and process in your own strategy. You can think of The Divergent being a DaaS ( D ivergences a s a S ervice)!
* Please note, that divergence signals is a Pro only feature.
To use the signals, simply place The Divergent onto the same chart you have your strategy on, import "The Divergent Library" into your code, link your strategy to The Divergent using a "source" input, and act on the signals produced by The Divergent !
Here is a simple strategy which incorporates divergence signals produced by The Divergent in its entry condition. The strategy will only open a position, if the moving average cross is preceded by a regular bullish or bearish divergence (depending on the direction of the cross):
//@version=5
strategy("My Strategy with divergences", overlay=true, margin_long=100, margin_short=100)
import WhiteboxSoftware/TheDivergentLibrary/1 as tdl
float divSignal = input.source(title = "The Divergent Link", defval = close)
var bool tdlContext = tdl.init(divSignal, displayLinkStatus = true, debug = false)
// `divergence` can be one of the following values:
// na → No divergence was detected
// 1 → Regular Bull
// 2 → Regular Bull early
// 3 → Hidden Bull
// 4 → Hidden Bull early
// 5 → Regular Bear
// 6 → Regular Bear early
// 7 → Hidden Bear
// 8 → Hidden Bear early
//
// priceStart is the bar_index of the starting point of the divergence line drawn on price
// priceEnd is the bar_index of the ending point of the divergence line drawn on price
//
// oscStart is the bar_index of the starting point of the divergence line drawn on oscillator
// oscEnd is the bar_index of the ending point of the divergence line drawn on oscillator
= tdl.processSignal(divSignal)
bool regularBullSignalledRecently = ta.barssince(divergence == 1) < 10
bool regularBearSignalledRecently = ta.barssince(divergence == 5) < 10
float slowSma = ta_sma(close, 28)
float fastSma = ta_sma(close, 14)
longCondition = ta.crossover(fastSma, slowSma) and regularBullSignalledRecently
if (barstate.isconfirmed and longCondition and strategy.position_size == 0)
strategy.entry("Enter Long", strategy.long)
strategy.exit("Exit Long", "Enter Long", limit = close * 1.04, stop = close * 0.98)
shortCondition = ta.crossunder(fastSma, slowSma) and regularBearSignalledRecently
if (barstate.isconfirmed and shortCondition and strategy.position_size == 0)
strategy.entry("Enter Short", strategy.short)
strategy.exit("Exit Short", "Enter Short", limit = close * 0.96, stop = close * 1.02)
plot(slowSma, color = color.white)
plot(fastSma, color = color.orange)
One important thing to note, is that TradingView limits the number of "source" inputs you can use in an indicator / strategy to 1, so the source input linking your strategy and The Divergent is the only source input you can have in your strategy. There is a work around this limitation though. Simply convert the other source inputs to have a string type, and use a dropdown to provide the various sources:
string mySource = input.string("My source", defval = "close", options = )
float sourceValue = switch mySource
"close" => close
"open" => open
"high" => high
"low" => low
=> na
---
This is where we are going to wrap up this article.
We hope you will find the signals produced by The Divergent a useful addition in your own strategies!
For more info on the The Divergent (Free) and The Divergent (Pro) indicators please see the linked pages.
If you have any questions, don't hesitate to reach out to us either via our website or via the comment section below.
If you found value in this article please give it a thumbs up!
Thank you!
Hiddendivergence
GALA=1$ Here is why...Hello every one
GALA/USDT
GALA has Done a Massive Pump Due To It's Great Gaming Project But It seems It can Increase Pretty Easily once again! As you can See The Price of GALA has Been Decreasing after It has created a New ATH a few Days ago! But This Correction has Formed a Bullish Pattern which is a Bullish Pennant pattern! The Break out has not Happened yet So we can not Be sure weather our Predictions Will come True Or Not! But If The Break out happens Upwardly, We can See GALA to Reach 1$ Pretty Easily and Afterward Probably 1.10$! There is also a Hidden Bullish Divergence (+HD) On MACD as well Which Helps The Bulls To Make a Decision .
Summery:
-GALA's Bullish Movement is Not Over!
-Bullish Pennant is visible on The Chart.
-No Break out!
-Easy Target=1$
-Resistance at 1.10$
-(+HD) on MACD
💎Traders, if you liked this idea or have your opinion on it, write in the comments, We will be glad.
Things can change...
The markets are always changing and even with all these signals, the market changes tend to be strong and fast!!
Thank you for seeing idea .
Have a nice day and Good luck
🔵(Update) ETH can reach 5k easilyHi every one
Ethereum / U.S. Dollar
🔵Last time we talked about Ethereum,we Explained to you the Situation of it and how ot needs time before ascending further.now the correction has been completed and the price has started a bullish Trend from the support zone which we talked about.now we Expect The price to reach 5k soon because not only it is the Top of Pitchfork Indicator,but There are 2 Hidden Bullish Divergence (+HD) on both MACD and RSI Indicators.
The pitchfork and Cup and Handle are still reliable and we can see ETH at 5k easily.
Previous Analysis:
🔴This is only an idea and not a financial advise ( NFA )🔴
💎Traders, if you liked this idea or have your opinion on it, write in the comments, We will be glad.
Thank you for seeing idea .
Have a nice day and Good luck
Doge Shall ascend To 0.40$Hi every one
DOGECOIN / TETHERUS
Doge Coin has been Decreasing Recently, The Price is in a Descending Triangle .But There are Divergences which makes us Think This is a Sign of a Great Bullish Break out. As you can see There is a Big Regular Bullish Divergence (+RD) on MACD which is Promising Enough , To Start a Bullish Trend! when The Break out Happens. The Price shall Reach the Resistances which Sits at 0.34 & 0.40$. If Doge Coin Manages To Break the Resistances , we can Be Sure of more Bullish Waves To Form.
Summery:
-Doge Coin is in an Ascending Triangle
-(+RD) on MACD
-Resistance & Targets :0.34 &0.40$.
💎Traders, if you liked this idea or have your opinion on it, write in the comments, We will be glad.
Things can change...
The markets are always changing and even with all these signals, the market changes tend to be strong and fast!!
Thank you for seeing idea .
Have a nice day and Good luck
Potential Hidden Bearish Divergence USDCHF?Potential Hidden Bearish Divergence? Maybe, but for shortly time period i assume market will prior go to upside movement. I predict market will
reach at point 0.92267. Because there's is cluster area between Exponential Moving Average 21, and Fibonacci 61.8 golden ratio. After the price touch the area, let me see if stochastic make a divergence momentum or not.
(Update) Are you ready to see BTC at 77k?Hi every one
Bitcoin / U.S. Dollar
As we mentioned before, BTC needs to do a Correction to start a Good Bullish Trend afterward! as you can see BTC has moved exactly toward our Expectation and reached 54k and now we Expect a Bullish Wave (5th wave of Elliot Impulse waves!) to Reach 77k! we have to wait & see if that BTC can Break It's ATH once again and Complete the Expected movement! There is also a Hidden Bullish Divergence on MACD which Helps Us on The way to 77k! after The Completion of the 5th wave we Expect a Big Correction Phase to happen.
🟡Summery:
-BTC has Completed It's Correction wave
-The 5th Impulse wave has Been Started!
-The Target is around 77K
-(+HD) on MACD
-A big correction is gonna happen after ward!
Previous Analysis:
🔴This is only an idea and not a financial advise (NFA)🔴
💎Traders, if you liked this idea or have your opinion on it, write in the comments, We will be glad.
Thank you for seeing idea .
Have a nice day and Good luck
A hidden divergenceOn a 4 hour timeframe, LINK was able to perfectly bounce on this re trend line that I plot from ATH and previous local high on the daily timeframe. Altogether with the hidden divergence on the MACD and RSI it could be an another accumulation point for investors and a good opportunity for a long position for the traders. All it have to do is remain above the trend line, close green, close above the open of the last red candle then probably that might be it
LUNA has been in a Falling Wedge! now what is gonna Happen?
LUNA has Formed a Rising wedge Pattern and Recently the Bearish Break out has happened. Normally we Expect the Price to Decrease to the Bottom of Falling wedge pattern. But There is a Hidden Bullish Divergence (+HD) on MACD which makes Us Think that the Price would Start a Bullish Wave From the middle of the Pattern! The chance of Hitting the EMA100 and Is Pretty high So the Price might Start the Bullish Trend From There!
🟡Summery:
-LUNA was in a Rising Wedge
-Break out has happened
-Because of the (+HD) The Price might Start a Bullish Trend From the Middle of the Pattern
-Chance of Hitting The 100EMA and Starting the Bullish Movement is High!
💎Traders, if you liked this idea or have your opinion on it, write in the comments, We will be glad.
Things can change...
The markets are always changing and even with all these signals, the market changes tend to be strong and fast!!
Thank you for seeing idea .
Have a nice day and Good luck
Wed 24th November 2021 EUR/JPY Daily Forex Chart Buy SetupGood morning. Just looking at my Daily Forex charts and 2x new trade setups identified this morning. This one being a buy on the EUR/JPY. You can read my notes on the chart to see my thoughts about this one. I like it and can see potential, but as we all know, price is king and can go wherever it pleases :) Cheers.
$BTC -- Next 30-45 Day Bitcoin StrategyHello Traders,
Take a look at my chart and let me know what you think?
What's your strategy over the next month or so?
We should see some further downside potential over the next few days. A couple of support lines are showing as potential bounce ranges.
I'll take profits if we break and close below the $57,500 range. And if we break above recent ATH, I'll be taking some profits around $75k.
Hope you all have a great weekend.
Take care.
🔵OMG's Potential To reach 21$ & Targets.Hi every one
OMG/USDT
OMG has formed a Bullish Flag Recently and now The Price has Done the Break out Required to Move Further! We've Provided Targets For you, you can Use it If you Like it. In Bullish flags, Price can Increase as much as the Measured Price movement (Flag Pole). The resistance sits at 21$. If you Pay attention you can see that Parabolic SAR has just Set a Dot Under the Price (a Bullish Sign) & There is also a Hidden Bullish Divergence on Both MACD & RSI as Well!
⚪Summery:
-OMG has broken a Bullish Flag!
-Targets are Provided For you,Use them if you like it.
-Price can Increase as much as the Flag Pole
-Resistance at 21$.
-Multiple bullish Signs (Parabolic SAR,Bullish Pattern, +HD on MACD & RSI)
💎Traders, if you liked this idea or have your opinion on it, write in the comments, We will be glad.
Things can change...
The markets are always changing and even with all these signals, the market changes tend to be strong and fast!!
Thank you for seeing idea .
Have a nice day and Good luck
#XTZ Tezos 1D Chart - Trendline TouchXTZ - follow the trend. It seems that we are at the bottom trend line of the Rising Broadening Wedge. Though these are generally bearish patterns, XTZ may have the opportunity to reach the top part of the wedge next. To increase this chance, I noticed hidden bullish divergence on the 1D chart along with consistent market structure with higher lows.
What are your thoughts? Comment below and hit the like please. Thank you!
Disclosure: This is just my opinion and not any type of financial advice. I enjoy charting and discussing technical analysis . Don't trade based on my advice. Do your own research! #cryptopickk #bitcoin #altcoins
ETH/BTC daily: Hidden Divergence / Trend ReversalLooking at the 50-day linear regression channel on the ETH/BTC dailies, there is a clear downtrend.
Although price had a break-out of this channel to the upside, we still see lower highs.
While we're seeing lower highs on the price chart, we also see higher highs on the commodity channel index.
These are clear signs of a hidden divergence. A hidden divergence is always an indicator for a possible trend reversal.
And since RSI is still not overbought (52.77), there's potential for the price to reverse and move up to the monthly pivot point at 0.071586
GBPCHF 4h Chart: bullish move expectedThere are multiple divergences on the GBPCHF 4h chart - and looking back at some divergences we've seen in the past couple of days, those divergences almost always indicated trend reversals.
We even can spot a hidden divergence, since there are oscillators (RSI, CCI) with higher lows while price is showing lower lows.
RSI has been in the oversold area, a couple hours ago and is moving up now - I do expect that price will start to move up until RSI is in the overbought area.
Price crossed the lower band of the bollinger band indicator - it might move up to the 20 SMA of the BB, maybe even to the upper band.
A conservative profit target would be the weekly pivot at 1.26517 - and this is around the 20 SMA.
MATIC's Massive Bullish potentials and Expected pullback!Hi every one
MATIC/USDT
MATIC/USDT has been ranging in a Descending Channel and now It has managed to break out of this channel! this is a Great bullish sign. so now we have other bullish signs and a bearish sign ! as you can see there is a Hidden bearish divergence (-HD) and a Regular Bullish Divergence (+RD) on MACD Indicator and also a Bullish Cross As well.(MACD line is above the Signal line) .this can only mean One thing, since there are more bullish signals and that the signals are stronger, the price must do a bullish Movement but because of the bearish Divergence (-HD) we must expect a Pullback to the channel and after that the continuation of the Bullish Movement! there are also some Resistance levels shown on The chart as well. (1.60$ and 2.20$)
summery:
-MATIC has broken out of a Bearish channel
-Divergences suggest a bullish movement after a pullback
-there is a Bullish cross on MACD (MACD line above signal line)
-resistances are 1.60$ and 2.20$
💎Traders, if you liked this idea or have your opinion on it, write in the comments, We will be glad.
Thank you for seeing idea .
Have a nice day and Good luck
COTI can reach 0.88$!Hi every one
COTI / TETHERUS
COTI is in a Bullish Pennant ! this Pattern can Increase the Price as much as the Pennant Pole! The break out is about to happen soon! so we Don't have to wait that much! There is also a Hidden Bullish Divergence On MACD as well! (+HD) so we can Say that it is safe to deal COTI after the break out happens! COTI can Reach 0.88$ .
Summery:
-COTI is in a Bullish Pennant.
-Break out is gonna happen soon!
-(+HD) on MACD
Previous ANALYSIS:
💎Traders, if you liked this idea or have your opinion on it, write in the comments, We will be glad.
Things can change...
The markets are always changing and even with all these signals, the market changes tend to be strong and fast!!
Thank you for seeing idea .
Have a nice day and Good luck
Confirmation low at harmonic pattern completion zone + divsBINANCE:ICPUSDT looking really strong for an entry. You have a new higher low confirming the previous low at the pattern. completion zone of the bullish cypher. Some nice hidden bullish divergence coming in from the oscillators too! Good luck traders!
TRXUSDT "H1" HD+Hello,
As you can see in the price: the price could not reach a new low, but the RSI oscillator has formed a new LL and HD+ divergence can be seen in it. We also have cross in 20 and 50 moving averages as you can see. With HD+, the price will probably increase slightly and eventually start another wave of correction.
Follow the blue lines to check for divergences.
* The analysis is completely personal and should not be the basis of your trades.*
Link is ready to reach 36$Hi every one
LINK/USDT
LINK has managed to break an ascending Triangle In small Time Frames Recently and The Pullback to the Upper Line of the Triangle has been Done so now The price is ready more Than ever to Start a Great Bullish Movement! there is also a Hidden Bullish Divergence (+HD) On MACD which Increase the Chance of this predicted Bullish Run! The price can Increase To 36$.
Summery:
-Link has managed to break a bullish pattern( ascending Triangle)
-(+HD) on MACD
-The Pullback has been Completed and The Price is ready to ascend!
-Link can Increase Up to 36$.
Traders, if you liked this idea or have your opinion on it, write in the comments, We will be glad.
Things can change...
The markets are always changing and even with all these signals, the market changes tend to be strong and fast!!
Thank you for seeing idea .
Have a nice day and Good luck
SNX/USDT can reach 22$!Hi every one
SNX / TETHERUS
SNX/USDT is ranging in a Big Ascending Triangle! this means The Price can Increase as much as the Measured Price Movement!(AB=CD) but the break out has not happened yet so there are no confirmations! and if you take a Closer look you can see a Hidden Bullish Divergence (+HD) on MACD indicator! since Indicators show the Future of the Market we can expect a Bullish Movement to happen soon! If SNX manages to break the resistance (Top Line of the Triangle) we can expect the Price to reach 22$!
summery:
-SNX is In an ascending Triangle
-If the break out happens it's Gonna Reach 22$!
-(+HD) on MACD
-No break out,No confirmation!
Traders, if you liked this idea or have your opinion on it, write in the comments, We will be glad.
Things can change...
The markets are always changing and even with all these signals, the market changes tend to be strong and fast!!
Thank you for seeing idea .
Have a nice day and Good luck