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

Wyłączenie odpowiedzialności