TradingView
Peter_O
19 Feb 2020 pukul 22.15

Multiple divergences NON-REPAINT by PeterO 

Euro Fx/U.S. DollarFXCM

Deskripsi

Divergences are well-known tool for finding trend reversals. Powerful, yet... unreliable. Sometimes they show up, sometimes they don't. Sometimes they really mean trend end, sometimes the trend continues. I've witnessed countless discussions about which indicator to hunt for divergences on. All pointless.

Earlier today I found a very inspirational script by Lonesometheblue, combining multiple divergences together. Actually - summing them up and showing hunted divergences count in a label. Because if a divergence shows up on a single indicator like RSI, it can indeed mean trend reversal, but... yeah, check previous pargraph. But if this divergence shows up on 8 different indicators at the same time, then chances increase, don't they?

I decided to do my own version of Lonesome's indicator, because that one is using Label.New, which doesn't allow analysing entire script, only latest 50 occurences or so. I'm not going to hide it - I copy-pasted a lot from Lonesome's code. And from Everget's built-in divergences script, which you can find in PineScript/New. I didn't even bother to modify variable names or cover tracks in any other way, pretending it is my work from scratch. All with these two gentlemen consent and blessing. I added labels from myself, plus bit of rework and here it is:)

I hope you'll find it useful.

P.S. While analyzing divergences today, I discovered one thing. Hidden divergences are not useless, as many people think. But they should be used at trend dips to join the trend, not at trend ends, as reversals. Experiment yourself.

P.S.2 Still, never use only divergences. They need confirmation, they are not self-fulfilling prophecy.
Komentar
ctrader1
Can you explain what the numbers mean on the chart?

Is it a sign if you see 2 that 2 indicators show possible divergence if its 4 then 4 indicators show possible divergence, and so on?

Thanks
Peter_O
@ctrader1, exactly. Well, actually - they ARE showing a divergence (not "possible" divergence), but will it really reverse the market, is never 100% sure.
Jo-Pippin
alertcondition(posdivergencehidden, "Buy Setup A ", message = 'Setup Buy A {{plot("Setup Buy")}} Completed at {{close}}, Setup in a row : {{plot("Setup Buy Number")}}')
alertcondition(posdivergence, "Buy Setup B ", message = 'Setup Buy B {{plot("Setup Buy")}} Completed at {{close}}, Setup in a row : {{plot("Setup Buy Number")}}')
alertcondition(negdivergencehidden, "Sell Setup A ", message = 'Setup Sell A {{plot("Setup Sell")}} Completed at {{close}}, Setup in a row : {{plot("Setup Sell Number")}}')
alertcondition(negdivergence, "Sell Setup B ", message = 'Setup Sell B {{plot("Setup Sell")}} Completed at {{close}}, Setup in a row : {{plot("Setup Sell Number")}}')
attractivehomie
@Jo-Pippin, thanks for this snippet! I wanted to only allow alerts for 2 or more divs only, but didn't really know how to make that happen so I ended up just deleting the 1 div conditions from the original script so they go straight to 2 divs before painting. Definitely not the most effective solution, but it appears to have solved my problem lol.
andymecx
@attractivehomie, I want to do the same, only have an alert for minimum of 2 div's but not sure how to do it. Could you show me what you did in the code? :-)
katse56
@attractivehomie, hello, I know it's been a long time. But I can't succeed to make it happen, I would like to set up alert with only 4 divs minimum. Is that possible ? I'm trying, but I'm not a dev at all. Thank you in advance. :)
raovida
why open source something that works? Makes it absolete once everyone starts using it...
Peter_O
@raovida, That's the beauty of open source, isn't it?

But seriously - read the description. Divergences are only a part of the game, you need to check trend direction, etc.
lmulrajani
Hey Buddy, this is an amazing script, and I would like to ask about a few things to make it easier to understand and work with the script:
1) If the box is red in color and has 4 written in it, it means 4 indicators showing divergence and it is time to short?
2) There are Regular and Hidden Divergences, which would hold more weightage comparatively?
3) To summarise, if it is a Red or Orange Box, time to short, and if it is light green or dark green, it is to go long?
4) Also, can you provide any parameters which you have tried and tested, so that it makes it easier for the new users?
yashugupta786
@lmulrajani, are you still using this
Lebih lanjut