Logic of Code is borrowed from Metastock expert so I expected it to work correctly.But somehow it misses divergences even within 9 bars.You may use it to check.Pl. correct it.
code seems ok subject to
1. It is not comparing corresponding close...that is the HHV close maybe on a diff bar from HHV of RSI. But I don't think this should be a big issue.
2. more importantly, is the fact that it will detect only RSI divergences that happen within 9 bars
1. It is not comparing corresponding close...that is the HHV close maybe on a diff bar from HHV of RSI. But I don't think this should be a big issue.
2. more importantly, is the fact that it will detect only RSI divergences that happen within 9 bars