REQUEST TO CODE OPPOSITE DIVERGENCES
- This topic has 4 replies, 2 voices, and was last updated 8 years ago by .
Viewing 5 posts - 1 through 5 (of 5 total)
Viewing 5 posts - 1 through 5 (of 5 total)
Forums › ProRealTime English forum › ProBuilder support › REQUEST TO CODE OPPOSITE DIVERGENCES
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.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
sto = stochastic[p,k] avg = average[d](sto) lookback = 20 //bullish divergence //first sto cross if sto crosses over avg then currentsto = sto//[1] currentprice = lowest[3](low) endif //previous sto cross if barindex<>mybar then for i = 1 to lookback do if sto[i] crosses over avg[i] then previoussto = sto[i] previousprice = lowest[i+3](low) mybar = barindex[i] break endif next endif //divergence or not? if currentsto<previoussto and currentprice>previousprice then bulldiv = 1 else bulldiv = 0 endif return bulldiv |
Hello 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