Update mltechnicalscanner.py
Browse files- mltechnicalscanner.py +6 -6
mltechnicalscanner.py
CHANGED
@@ -205,20 +205,20 @@ class MLTechnicalScanner:
|
|
205 |
downtrend = (ema_20 < ema_50) and (price < ema_20)
|
206 |
|
207 |
if uptrend and prediction == 1:
|
208 |
-
self.alert(symbol, "STRONG UPTREND", timeframes)
|
209 |
elif downtrend and prediction == -1:
|
210 |
-
self.alert(symbol, "STRONG DOWNTREND", timeframes)
|
211 |
elif uptrend:
|
212 |
-
self.alert(symbol, "UPTREND", timeframes)
|
213 |
elif downtrend:
|
214 |
-
self.alert(symbol, "DOWNTREND", timeframes)
|
215 |
|
216 |
except Exception as e:
|
217 |
print(f"Error scanning {symbol}: {str(e)}")
|
218 |
|
219 |
-
def alert(self, symbol, trend_type, timeframes):
|
220 |
"""Generate alert for detected trend"""
|
221 |
-
message = f"({trend_type}) detected for {symbol} on {timeframes} at {datetime.now()}"
|
222 |
print(message)
|
223 |
|
224 |
# Main execution
|
|
|
205 |
downtrend = (ema_20 < ema_50) and (price < ema_20)
|
206 |
|
207 |
if uptrend and prediction == 1:
|
208 |
+
self.alert(symbol, "STRONG UPTREND", timeframes, price)
|
209 |
elif downtrend and prediction == -1:
|
210 |
+
self.alert(symbol, "STRONG DOWNTREND", timeframes, price)
|
211 |
elif uptrend:
|
212 |
+
self.alert(symbol, "UPTREND", timeframes, price)
|
213 |
elif downtrend:
|
214 |
+
self.alert(symbol, "DOWNTREND", timeframes, price)
|
215 |
|
216 |
except Exception as e:
|
217 |
print(f"Error scanning {symbol}: {str(e)}")
|
218 |
|
219 |
+
def alert(self, symbol, trend_type, timeframes, current_price):
|
220 |
"""Generate alert for detected trend"""
|
221 |
+
message = f"({trend_type}) detected for {symbol} at price {current_price} on {timeframes} at {datetime.now()}"
|
222 |
print(message)
|
223 |
|
224 |
# Main execution
|