Search
Products
Community
Markets
News
Brokers
More
IN
Get started
Community
/
Ideas
/
Divergence
Australian Dollar / U.S. Dollar
Divergence
By khusanboy1212
Follow
Follow
Jan 21, 2024
0
Jan 21, 2024
def divergence_indicator(price_data, oscillator_data):
signals = []
for i in range(1, len(price_data) - 1):
if (price_data
> price_data[i - 1] and oscillator_data
< oscillator_data[i - 1]) or \
(price_data
< price_data[i - 1] and oscillator_data
> oscillator_data[i - 1]):
signals.append("Bearish Divergence")
elif (price_data
> price_data[i - 1] and oscillator_data
> oscillator_data[i - 1]) or \
(price_data
< price_data[i - 1] and oscillator_data
< oscillator_data[i - 1]):
signals.append("Bullish Divergence")
else:
signals.append("No Divergence")
return signals
Technical Indicators
khusanboy1212
Follow
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the
Terms of Use
.