Print Page | Close Window

Divergence

Printed From: BullCharts Forum
Category: BullCharts
Forum Name: BullScript
Forum Discription: Technical discussion related specifically to the BullScript programming language.
URL: http://www.bullcharts.com.au/forum/forum_posts.asp?TID=535
Printed Date: 24 Apr 2025 at 12:53am
Software Version: Web Wiz Forums 9.69 - http://www.webwizforums.com


Topic: Divergence
Posted By: brentjedi
Subject: Divergence
Date Posted: 06 Feb 2009 at 6:17pm
Hi Forum

I am back into trading and need to get some help in coding BC scan to look for divergence of ROC or any other indicator that sits in a new pane under price bars.

In divergence its about opposite troughs and peaks to what price action is doing.

It is a very good setup if you can find them.

Thus BC scan to find them is needed. The default stochastic divergence scan seem not to do the trick.

Any Ideas

brentjedi



-------------
Trading is art of self



Replies:
Posted By: maximo
Date Posted: 08 Feb 2009 at 2:08am
Welcome back brentjedi and hope you've had a nice holiday.
 
There's many ways of displaying and working out divergence(s).
I generally look for the simplest solution, this may be it.
 
I converted this metastock code, which displays points of diverg
signals.   This site has 100's more indicators that anyone can
use in BS.    http://trader.online.pl/MSZ/e-w-Divergence_Signal.html - http://trader.online.pl/MSZ/e-w-Divergence_Signal.html
Setting up a scan should be easy enough for single signals, though
multiple signals would have a higher probability.   There's also one
that uses zigzag + RSI divergence, that may be a better one.
 
The converted code:
 

{ Divergence Signal (RSI) }

expr := expression("Expression");

nrsi := input("RSI Time periods",14,1);

rsival := rsi(expr, nrsi);

[color = blue]

If(C = LLV(C,20),1,0) * If(rsival > LLV(rsival,20),50,0)+If(C = HHV(C,20),1,0) * If(rsival < HHV(rsival,20),-50,0)+50;

[Color = Red]

rsival;

 


Posted By: peter1
Date Posted: 08 Feb 2009 at 1:23pm
That is the same site that I found some code to help me Maximo. 


Posted By: maximo
Date Posted: 08 Feb 2009 at 7:04pm
Yes it's a great site.  I found a lot of useful idea's and indicators there too including the full source to indicators like ADX, Aroon and CCI.    Important if you want to understand how they work or program them for other trading platforms.   Useful for anyones trading ideas.
 
Cheers!


Posted By: maximo
Date Posted: 08 Feb 2009 at 11:33pm

Here's some information on Divergences if anyone is interested.  http://www.tradeology.com/hidden-divergence-a.html - http://www.tradeology.com/hidden-divergence-a.html

These guys call Divergence continuation patterns, "Hidden Divergence" and Divergence 'reversal patterns', "Bullish Divergence" or "Bearish Divergence".    Well the increase in terminology among trading educators certainly does not help one's trading..  In truth Divergence is really just the contraction of 2 averages of different periods, meaning that the trend is just slowing on 2 different time frames.   Like that traders saying: If its not going down then its looking to go up.. and vica versa.   Definitely not a sure thing.. but any probability > 50/50 is an advantage.


Posted By: brentjedi
Date Posted: 09 Feb 2009 at 1:15pm
Maximo

Glad to be back and even more joy that people are on the forum.

Thanks for the formula, however I am wanting to use it on a indicator I put together instead of the RSI. I tried to change the names but it didn't work.

The indicator is, H - REF( C, -10) of course MACD or ROC or anything else works to the problem to get BC to do the looking and find them. Could you help with the code?.

Cheers

Brentjedi




-------------
Trading is art of self


Posted By: maximo
Date Posted: 10 Feb 2009 at 12:37am
Yeah it's a bit more involved than that.  The indicator needs to be re-scaled so that it matches the size of the signals being displayed.   RSI ranges from 0 to 100 so that one's okay, but other indicators also need to be in that range.  Alternatively you can adjust the signal range from +/- 50 to say +/- 10 or within the range of the indicator being used. 
 
To scan for it or any indicator, click on New scan, select 'is an indicator'.
Find the indicator you want to scan for in the drop down list and then
select your required scan parameters.
 
The indicator is doing it's job, though the signals reliability could be improved by filtering for peak divergences instead of just willy nilly indicator is going in the opposite direction to price.  Hmm maybe green for a long signal and red for a short signal would make things clearer as to the direction and have the indicator in blue.

{ Divergence Signal C-10 }

Lookback := input("LookBack period",-10);

cval := (H-ref(C,Lookback))/C*100+50;

[color = blue]

sig:=If(C = LLV(C,20),1,0) * If(cval > LLV(cval,20),50,0)+If(C = HHV(C,20),1,0) * If(cval < HHV(cval,20),-50,0)+50;

sig;

[Color = Red]

cval;




Print Page | Close Window

Bulletin Board Software by Web Wiz Forums® version 9.69 - http://www.webwizforums.com
Copyright ©2001-2010 Web Wiz - http://www.webwiz.co.uk