Programming divergence of stochastic
Forums › ProRealTime English forum › ProOrder support › Programming divergence of stochastic
- This topic has 11 replies, 4 voices, and was last updated 6 years ago by pieroim.
Tagged: divergences
-
-
12/12/2016 at 11:29 AM #18306
Hi all, I was hoping that someone would be able to help me program a divergence in price and stochastic indicator.
What I am looking to test for is a lower high in price compared to a previous high, while the stochastic indicator shows a lower high compared to the previous high?
Has anyone coded something like this before?
12/15/2016 at 9:41 AM #18544Please find attached the indicator code for stochastic divergences. The indicator spot divergences between price and the crossover of the stochastic with its own moving average signal line.
The stochastic values are only taken into account if they are above the overbought zone or below the oversold zone (you can modify these levels at will in the parameters).
This is the same code as the ones from the MACD or RSI divergences indicators already posted into the Library in other different format:
12/15/2016 at 1:43 PM #18581Bonjour Nicolas,
Je rajoute cette ligne pour identifier de quelle divergence (bull) on parle mais le retour image n’est pas top ! d’où vient mon erreur STP123DRAWTEXT ( "O " ,barindex,0.20,dialog,standard,20) coloured ( 0,153,0 )DRAWTEXT ( "T " ,barindex,0.30,dialog,standard,20) coloured ( 0,153,0 )DRAWTEXT ( "S " ,barindex,0.40,dialog,standard,20) coloured ( 0,153,0 )12/15/2016 at 1:47 PM #18584Merci de parler en Anglais dans le forum Anglais.
Please speak English in English Forums!!
12/15/2016 at 1:49 PM #1858512/15/2016 at 2:57 PM #1859612345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485<strong>Why the bull histogramm don't match !!??</strong>// DIVERGENCES STO PRC adapted from HK-LISSE codex = stochastic[p,k]y = average[d](x)if x>overboughtzone thenhi=max(hi,x)hico=max(hico,max(high,high[1]))endifif x crosses under y thensto2b=sto1bsto1b=hihi=0p3b=p1bp2b=max(p1b,hico1)p1b=max(highest[3](high),hico)if p2b=p1b thenp2b=max(p3b,p4b)endifhico=0hico1=0endifif x<y thenp4b=hico1hico1=max(hico1,high)endifif p1b>p2b and sto1b<sto2b and x crosses under y and x<x[1] thensignB= -2elsesignB= 0endifif x<oversoldzone thenlo=min(lo,x)lowco=min(lowco,min(low,low[1]))endifif x CROSSES OVER y thensto2h=sto1hsto1h=lolo=100p3h=p1hp2h=min(p1h,lowco1)p1h=min(lowest[3](low),lowco)if p2h=p1h thenp2h=min(p3h,p4h)endiflowco=100000lowco1=100000endifif x>y thenp4h=lowco1lowco1=min(lowco1,low)endifif p1h<p2h and sto1h > sto2h and x crosses over y and x>x[1] thensignH= 2elsesignH= 0endif////////////////////////////////////////////////<strong>If signB CROSSES UNDER 0 thenDRAWTEXT ( "S " ,barindex,- 0.20,dialog,standard,20) coloured ( 255,0,127 )DRAWTEXT ( "T " ,barindex,- 0.30,dialog,standard,20) coloured ( 255,0,127 )DRAWTEXT ( "O " ,barindex,- 0.40,dialog,standard,20) coloured ( 255,0,127 )endifIf signH CROSSES OVER 0 thenDRAWTEXT ( "O " ,barindex,0.20,dialog,standard,20) coloured ( 0,153,0 )DRAWTEXT ( "T " ,barindex,0.30,dialog,standard,20) coloured ( 0,153,0 )DRAWTEXT ( "S " ,barindex,0.40,dialog,standard,20) coloured ( 0,153,0 )endif</strong>return signH as " div STO bull ", signB as " div STO bear " , 0 as " zero "// Variables :// p = 14// Overboughzone = 80// Oversellzone = 20// K = 3// D = 612/15/2016 at 5:10 PM #18608OK
1234567891011If signB < 0 thenDRAWTEXT ( "S " ,barindex,- 0.20,dialog,standard,20) coloured ( 255,0,127 )DRAWTEXT ( "T " ,barindex,- 0.30,dialog,standard,20) coloured ( 255,0,127 )DRAWTEXT ( "O " ,barindex,- 0.40,dialog,standard,20) coloured ( 255,0,127 )endifIf signH > 0 thenDRAWTEXT ( "O " ,barindex,0.20,dialog,standard,20) coloured ( 0,153,0 )DRAWTEXT ( "T " ,barindex,0.30,dialog,standard,20) coloured ( 0,153,0 )DRAWTEXT ( "S " ,barindex,0.40,dialog,standard,20) coloured ( 0,153,0 )endif12/23/2016 at 4:12 PM #1906011/14/2017 at 12:30 PM #52700Hi, I want reduce the false signal on the stochastic divergence by considering true signals only that signals generated when the stochastic remain under the oversold zone or above the overbought zone.
In the attached picture you can see that the code doesn’t work correctly.. you can see the code too, but I don’t understand why.. Nicolas can you help me?
Thanks
Piero
11/15/2017 at 9:52 AM #5280211/15/2017 at 10:30 AM #52806No Nicolas, see the pictures..
————————————–
Another question, from yesterday I have a mistake from the Proscreener web area when I go to write a new post, this is the post:
Title: Is there a way to do a screening of the only last “x” bars?
I’m working on a stochastic divergence screening routine, but it give me all the signals that it find in the period that it go to analyze (I don’t know how long is the period), is there a way to retrieve only the signals that it find in the last fixed number of bars?
Barindex can work in the proscreening?
Thank’s
Piero
11/15/2017 at 10:39 AM #52812 -
AuthorPosts
Find exclusive trading pro-tools on