REQUEST TO CODE OPPOSITE DIVERGENCES
Forums › ProRealTime English forum › ProBuilder support › REQUEST TO CODE OPPOSITE DIVERGENCES
- This topic has 4 replies, 2 voices, and was last updated 7 years ago by ALE.
-
-
01/29/2017 at 5:04 PM #2296401/31/2017 at 11:48 AM #2323401/31/2017 at 2:17 PM #2327101/31/2017 at 3:54 PM #23293
Well .. I think it should work for the bullish divergences you are trying to catch.
But there are of course too many of them with short term period of your stochastic parameters (5,3,3). You should also try to add overbought/oversold level to catch better cases of the stochastic reversal and to avoid whipsaws that the indicator made with its moving average.
In this code, I use the cross of the stochastic with its moving average to spot reversal and then compare the last 2 different levels with the 2 last prices.
12345678910111213141516171819202122232425262728293031sto = stochastic[p,k]avg = average[d](sto)lookback = 20//bullish divergence//first sto crossif sto crosses over avg thencurrentsto = sto//[1]currentprice = lowest[3](low)endif//previous sto crossif barindex<>mybar thenfor i = 1 to lookback doif sto[i] crosses over avg[i] thenprevioussto = sto[i]previousprice = lowest[i+3](low)mybar = barindex[i]breakendifnextendif//divergence or not?if currentsto<previoussto and currentprice>previousprice thenbulldiv = 1elsebulldiv = 0endifreturn bulldiv01/31/2017 at 4:38 PM #23300Hello Nicolas,
fantastic, its perfect. I need to observe noises to proceed to add filter and other solutions to avoid false positive signals.
We are studing a scalper strategy based on Stochastic divergences and opposite divergences. We Keep you informed on our progress
Thanks
Ale -
AuthorPosts