Hi,
Relatively new to Python and Quantopian.
Currently working on my first momentum strategy algorithm and I’m looking for feedback on the following set of functions (see attached Notebook) to spot divergences between a given indicator and its underlying security's price movement.
The divergence function returns the following:
- Security's price action (higher highs, lower lows or None)
- Whether a bullish/bearish divergence exists
- Start date of divergence signal
- Divergence high
- Divergence low
Specifically looking for feedback on the following:
Is there a better way to identify price action, specifically identify if prices are consolidating. Have a feeling my function would generate false signals when market is sideways
Is there a better way to identify tops and bottoms? Experimented with scipy's find_peaks_cwt but wasn't satisfied with the results.
Is there a simpler way to spot for divergences? I’ve looked at a couple of posts on Quantopian’s forum on the topic but none seemed to be satisfactory.
Any feedback is greatly appreciated!