Riy777 commited on
Commit
3634c88
·
1 Parent(s): 278663e

Update ml_engine/indicators.py

Browse files
Files changed (1) hide show
  1. ml_engine/indicators.py +7 -4
ml_engine/indicators.py CHANGED
@@ -1,4 +1,4 @@
1
- # ml_engine/indicators.py (V10.1 - SyntaxError FIX)
2
  import pandas as pd
3
  import pandas_ta as ta
4
  import numpy as np
@@ -94,8 +94,9 @@ class AdvancedTechnicalAnalyzer:
94
  vol_of_vol_series = ta.atr(atr_series, length=10) # (Vol-of-Vol)
95
  if vol_of_vol_series is not None: features['vol_of_vol'] = vol_of_vol_series.iloc[-1]
96
  last_return = close.pct_change().iloc[-1]
97
- if atr_val and atr_val > 0: features['atr_normalized_return'] = last_return / atr_val
98
-
 
99
  # --- 7. (جديد V9.8) ميزات النظام (Regime Features) ---
100
  if HURST_AVAILABLE:
101
  hurst_series = close.tail(100).to_numpy()
@@ -118,6 +119,8 @@ class AdvancedTechnicalAnalyzer:
118
  if value is not None and np.isfinite(value): final_features[key] = float(value)
119
  else: final_features[key] = 0.0
120
  return final_features
 
 
121
 
122
  # -----------------------------------------------------------------
123
  # --- (الدوال القديمة تبقى كما هي للاستخدامات الأخرى مثل Sentry 1m) ---
@@ -270,7 +273,7 @@ class AdvancedTechnicalAnalyzer:
270
  volatility['atr'] = atr_value
271
  current_close = dataframe['close'].iloc[-1] if not dataframe['close'].empty else 0
272
  if atr_value and current_close > 0:
273
- volatility['atr_percent'] = (atr_value / current_close) * 100
274
 
275
  except Exception as e:
276
  # print(f"⚠️ خطأ في حساب مؤشرات التقلب: {e}")
 
1
+ # ml_engine/indicators.py (V10.1 - SyntaxError FIX & Super-Brain)
2
  import pandas as pd
3
  import pandas_ta as ta
4
  import numpy as np
 
94
  vol_of_vol_series = ta.atr(atr_series, length=10) # (Vol-of-Vol)
95
  if vol_of_vol_series is not None: features['vol_of_vol'] = vol_of_vol_series.iloc[-1]
96
  last_return = close.pct_change().iloc[-1]
97
+ if atr_val and atr_val > 0:
98
+ features['atr_normalized_return'] = last_return / atr_val
99
+
100
  # --- 7. (جديد V9.8) ميزات النظام (Regime Features) ---
101
  if HURST_AVAILABLE:
102
  hurst_series = close.tail(100).to_numpy()
 
119
  if value is not None and np.isfinite(value): final_features[key] = float(value)
120
  else: final_features[key] = 0.0
121
  return final_features
122
+ # 🔴 --- END OF UPDATED FUNCTION (V10.0) --- 🔴
123
+
124
 
125
  # -----------------------------------------------------------------
126
  # --- (الدوال القديمة تبقى كما هي للاستخدامات الأخرى مثل Sentry 1m) ---
 
273
  volatility['atr'] = atr_value
274
  current_close = dataframe['close'].iloc[-1] if not dataframe['close'].empty else 0
275
  if atr_value and current_close > 0:
276
+ volatility['atr_percent'] = (atr_value / current_price) * 100
277
 
278
  except Exception as e:
279
  # print(f"⚠️ خطأ في حساب مؤشرات التقلب: {e}")