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!
Divergences
Double your money 🟢 Bullish Wedge on Ethereum (ETH)Vitalik Buterin doesn't want you to read this analysis.
KEY POINTS:
AI scanned Giant Bullish Wedge on Ethereum (ETH).
Whales don't want you to know about its breakout.
Technical indicators show exceptional bullish divergence.
1st Target Price is $4800.
ETH can well hit $10k by February 2022.
If you invest now, that means doubling your money.
Thank us later!
RSI: A simple method to trade trends and rangesI write this tiny article to share the basics or my use of ths RSI indicator, coupled to supports and resistances levels, as well as trend lines (or any indicator you want to use as SUP/RES (moving averages, vwap ...))
This use implies a bit of practice in spotting divergences, but let's be honest, many of them appear on previous supports or resistances, just look at these levels and you can be sure you'll find them if a reversal is about to occur.)
The second specificity is the use of a moving average applied to the RSI (in my exmaple, a 50 periods EMA)
I developped my own RSI+MovingAverage script, but I'm sure you can find similar scripts that have already been shared within the community, thats why I don't publish it for now.
Anyway, feel free to ask if you're interested in my script, it's obviously free.
Lets consider two different contexts:
Trends (Bullish/Bearish)
Ranges
In trends , there are two things to take into consideration.
Let's explain what we need to work on a bullish trend:
- If the price is on an interesting level (moving average, trend line, support), you can try to long upon the RSI crosses its moving average,
indicating the potential end of the current retracement (even better if a bullish divergence appears close to this price)
- If the price gets close to a resistance, and moreover if a bearish divergence appears on the RSI, you can consider it as a good exit price,
or wait for the next retracement in order to pyramide your trade (depending on your approach).
In a bearish trend, you obviously need to do the exact opposite, wait for retracements (flags or other), and find bearish divergences OR sell when the RSI is clearly crossing down its moving average.
Of course you can wait for the RSI crossing above/under its moving average to get another confirmation that the movement is starting.
You can see a few examples on the following screen
In ranges , it's even simpler. Once you found your support and resistance levels (it can be old levels that have already generated good reactions)
all you need is to spot bearish divergences on the resistance, and bullish divergence on the support.
I personally like to cut at least a part of my position when we reach 50% of the range, which can be often considered as a support/resistance.
It's totally up to you to exit on this point or not, depending on your preferences (simple scalping, anticipations of a range breakout to make a new trend, lower timeframe trend following, etc...)
Range example:
Additional notes
When you trade a divergence, try to always open your position when the RSI rebounds on the divergence line, and not after, remember that opportunities are everywhere, don't mind if you missed the last one, don't enter too late in a movement.
Even if a range is a global horizontal movement, it's still composed of alternations of bullish and bearish movements between the same supports and resistances, therefore, you're of course able to trade it as trends on lower timeframes
Don't forget to look at candles, which can also give you strong signals on important levels, on current or lower/higher timeframes. The price is always the key
Of course, think about the DOW theory.
MILAN OSCILLATOR INDICATORThe most important signals are related to the divergence.
A recap for divergence from previous lessons:
DIVERGENCE AND HIDDEN DIVERGENCE
Positive Divergence is bullish and occurs in a downtrend when the price action prints lower lows that are not confirmed by the oscillating indicator.
Negative Divergence is bearish and occurs in an uptrend when the price action makes higher highs that are not confirmed by the oscillating indicator.
Bullish Hidden Divergence occurs during a correction in an uptrend when the oscillator makes a higher high while the price action does not as it is in a correction or consolidation phase.
Bearish Hidden Divergence occurs during a reaction in a downtrend when the oscillator makes a lower low while the price action does not as it is in a reaction or consolidation phase.
Other Signals can be crossing 0 lines or confirmation of change of bars colour.
Is Bitcoin facing a potential correction in the short term?NOT FINANCIAL ADVICE
Keeping things simple, studying $BTC vs MACD vs RSI, a divergence pops out clearly on the shortterm 4H charts.
While these do not always indicate a top or a dip, it is a signal that it is usually potentially accompanies one.
Also charted are the various levels of potentiall strong resistances that may deflate bitcoin’s current rally. These are based off the previous peaks preceeding selloffs, with the Major Resistance being bitcoin’s ATH.
If we are to analyse the volume trend, we can see that there’s a slight upslope of interest in trading which may be indicate that this rally may not yet be over — that the Minor and Primary resistances may be just a breather for the Bulls to regain their strength back.
In summary, I’d surmise that it’s still not too late to get on the $BTC train. Wait for the dip, accumulate, and prepare to take profits as and when signs of weakness are showing during rallies.
I do feel that retesting of ATH is incoming, but I won’t be surprised if the corrections are coming sooner than later, in this journey.
Again, not financial advice — just an educational tool.
BTCUSD - H4 - "DOJI" WARNING ...!Today we are going to look at the 4 hours chart.
Currently catch in a sideways broad 47'500-50'000 trading range.
Indeed, after having filled the triangle technical target @ 49'421, the BTC
pushed still a little bit higher towards an intraday high so far @ 49'811, being unable,
so far to break the psychological 50'000 important resistance level.
In addition, last H4 candle, triggered on a closing basis, a "Doji" pattern which should be seen
as a first warning signal for a potential trend reversal.(should be confirmed !)
Moreover, RSI is showing successive bearish divergences !
Therefore, next H4 closing level should be watch at very carefully and will give more clues for
the next move; in the meantime, as always, monitor price action on shorter time frames to get
intermediate signal (s) (such as divergences) which will help you to act accordingly.
A successful upside breakout of 50'000, would put the focus on the 51'000 (weekly downtrend resistance line) area ahead of 53'000 zone, former high of
beginning of September.
On the downside, looking at the daily picture, first significant support to look at is the top of the clouds (former resistance which becomes now the new support level),
currently around the 48'000 level.
If you like my analysis, please do not forget to support with a like and a follow. Thanks.
Ironman8848
Divergences on USDTRY - Daily ChartSo I am continuing to work on identifying divergences with a focus on USDTRY. I started at 2018 on the Daily and think I need to go down to the 30 minute because are a few bearish points in the chart that don't seem to be the result of divergence. I know divergence doesn't explain every move but it's possible I'm missing something.
Let me know your thoughts.
C
MORNING CHART REVIEW: 8/23/21Yet another potential scallop.
Seems to be a scallop and wedge with some divergences showing up on the 1hr.
If it holds true, it could take a while to break, regardless of direction.
I did find some divergences of the bullish variety, so we will see how those play out.
I will publish this chart so you can watch it at your leisure.
MORNING CHART REVIEWS w/ a WARNING : 8/20/21This video goes over the charts we have been looking at on the streams.
We see a bunch of 1.618 fib targets got knocked out.
But we also see some warning signs of a pullback, and some of them are a bit creepy.
I end it with a moonshot chart just for funsies.
See you guys in tonight's stream, we'll go over whatever happens today and make some new charts. FUN!
LATE NIGHT REVIEWS: A Plethora of ChartsIn this video I just quickly go over all the charts we looked at in the stream today and a couple new ones.
Main takeaway is the bullish divergences on the daily chart, the high timeframe channels, and wedges, and the fun rounded-top/scallop chart.
Hope this was helpful, I just wanted to get these charts out without too many tangents or extra analysis that takes away from the charts observations.
Tomorrow we will do a stream where we look at these again, make changes, and then toss a bunch of indicators around.
Divergences Explained by a RaccoonThis video's purpose is to go over the fundamentals of divergences.
How to spot them and the effects they have.
I might make a video later on practical application and how to trade them; as well as how to combine them with other technical analysis tools and techniques.
And I should be doing a stream soon where we just spend an hour hunting divergences on different commodities; whether it's crytpo, stonks, or forex.
I hope this helps those trying to understand divergences.
Let me know if anything seems off or is confusing, I am more than happy to make another video to clarify anything that seems off or incomplete.
Thanks for watching.
HAPPY RACCON: CHART REVIEWS: 30 min, 1 day, 4 hrThis videos main focus is on the 30 min chart I am currently watching, as well as some observations on the daily chart and the 4hr timeframe.
Why am I happy? Because I can now stream, which means I can freestyle explain and analyze, and then consolidate and streamline that info from the stream into a summarized 20 min video idea.
I did 2 streams last night, there was some technical difficulties, but I did go over divergences, and today I should be getting around to making a well thought out 20 min video on divergences, and eliminating all the tangents I love so much.
Hope this video was helpful, thanks!
SALTY RACCOON: CHART REVIEW: Daily ChartWell, this video had to be re-done as well, BUT I think I covered the most important stuff... except volume profile stuff... why? Because 20 minutes isnt enough and I forgot due to the pressure, lol.
Biggest takeaway though is to keep an eye on that daily chart developing bearish divergence.
I am going to make one more video after this, it will be a Charting Out Loud video with an emphasis on Divergence Hunting and just seeing what stands out.
CHART REVIEWS: BIG BOYS: 1day, 1week, & a couple microsThis video was my attempt to go over my larger timeframe charts of the daily and weekly BTC charts.
Sadly, 20 min never feels like enough time, the pressure to cover as much as I can in a short amount of time always makes me forget stuff, but I think I covered the big stuff.
Once TV lets me stream, I will be able to go over all the details at a much more calm pace and more thorough coverage.
The weekly doesnt require a ton of coverage as changes take forever to occur, but my daily chart is looks like pure chaos without any context.
I do go over a couple small timeframe charts in the beginning, which was a mistake in the end, but I cant make another video until later today, so this will have to do for now, lol.
Thanks!
RAMBLIN' RACCOON: Chart Reviews/Charting Out LoudSorry, this video was a bit rushed, I am on a time crunch.
I basically go over a couple charts in the beginning, multiple tangents, and then at the end some charting out loud on the 2 hr timeframe.
Takeaway, we broke a falling channel, and are potentially in a large rising channel.
Will make more videos today when IRL is less busy.
Hope some of this was helpful, cya!
MORNING CHART REVIEWS: BTCThis video just goes over my old chart that became invalidated due to my own negligence.
Biggest takeaway from this video is the large descending channel, potential wedge, and potential bullish divergence.
I will make another video today if things make some big moves.
And, I will be making a video soon to go over my daily and weekly charts as they should have their own vids because there is a lot to go over.