Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -513,6 +513,8 @@ def get_bot_skills():
|
|
| 513 |
|
| 514 |
|
| 515 |
|
|
|
|
|
|
|
| 516 |
def detect_chart_scenario(df, df_1m=None, df_5m=None, df_15m=None, df_1h=None):
|
| 517 |
try:
|
| 518 |
# 🛠️ Fix colonnes KuCoin
|
|
@@ -531,6 +533,7 @@ def detect_chart_scenario(df, df_1m=None, df_5m=None, df_15m=None, df_1h=None):
|
|
| 531 |
vwap = (typical_price * df['volume']).cumsum() / (df['volume'].cumsum() + 1e-9)
|
| 532 |
price_above_vwap = df['close'].iloc[-1] > vwap.iloc[-1]
|
| 533 |
price_below_vwap = df['close'].iloc[-1] < vwap.iloc[-1]
|
|
|
|
| 534 |
# ========================
|
| 535 |
# 🔥 VWAP BANDS (Institutional zones)
|
| 536 |
# ========================
|
|
@@ -540,7 +543,6 @@ def detect_chart_scenario(df, df_1m=None, df_5m=None, df_15m=None, df_1h=None):
|
|
| 540 |
|
| 541 |
price_extended_high = df['close'].iloc[-1] > vwap_upper.iloc[-1]
|
| 542 |
price_extended_low = df['close'].iloc[-1] < vwap_lower.iloc[-1]
|
| 543 |
-
|
| 544 |
|
| 545 |
# --- 2. MULTI TIMEFRAME (1m, 5m, 15m, 1h) ---
|
| 546 |
mtf_bull = mtf_bear = 0
|
|
@@ -593,12 +595,6 @@ def detect_chart_scenario(df, df_1m=None, df_5m=None, df_15m=None, df_1h=None):
|
|
| 593 |
near_liquidity_high = abs(c[-1] - liquidity_high_zone) / c[-1] < 0.002
|
| 594 |
near_liquidity_low = abs(c[-1] - liquidity_low_zone) / c[-1] < 0.002
|
| 595 |
|
| 596 |
-
# ========================
|
| 597 |
-
# 🔥 FAKE BREAKOUT FILTER
|
| 598 |
-
# ========================
|
| 599 |
-
fake_breakout_up = bos_up and c[-1] < recent_high
|
| 600 |
-
fake_breakout_down = bos_down and c[-1] > recent_low
|
| 601 |
-
|
| 602 |
# --- 5. STRUCTURE ET RSI ---
|
| 603 |
range_start, range_end = np.mean(h[:20] - l[:20]), np.mean(h[-20:] - l[-20:])
|
| 604 |
squeeze = range_end < range_start * 0.65
|
|
@@ -611,6 +607,12 @@ def detect_chart_scenario(df, df_1m=None, df_5m=None, df_15m=None, df_1h=None):
|
|
| 611 |
bos_up = np.max(h[-20:]) > np.max(h[-40:-20])
|
| 612 |
bos_down = np.min(l[-20:]) < np.min(l[-40:-20])
|
| 613 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 614 |
bullish_div = bearish_div = False
|
| 615 |
if 'RSI' in df.columns:
|
| 616 |
rsi = df['RSI'].values
|
|
|
|
| 513 |
|
| 514 |
|
| 515 |
|
| 516 |
+
|
| 517 |
+
|
| 518 |
def detect_chart_scenario(df, df_1m=None, df_5m=None, df_15m=None, df_1h=None):
|
| 519 |
try:
|
| 520 |
# 🛠️ Fix colonnes KuCoin
|
|
|
|
| 533 |
vwap = (typical_price * df['volume']).cumsum() / (df['volume'].cumsum() + 1e-9)
|
| 534 |
price_above_vwap = df['close'].iloc[-1] > vwap.iloc[-1]
|
| 535 |
price_below_vwap = df['close'].iloc[-1] < vwap.iloc[-1]
|
| 536 |
+
|
| 537 |
# ========================
|
| 538 |
# 🔥 VWAP BANDS (Institutional zones)
|
| 539 |
# ========================
|
|
|
|
| 543 |
|
| 544 |
price_extended_high = df['close'].iloc[-1] > vwap_upper.iloc[-1]
|
| 545 |
price_extended_low = df['close'].iloc[-1] < vwap_lower.iloc[-1]
|
|
|
|
| 546 |
|
| 547 |
# --- 2. MULTI TIMEFRAME (1m, 5m, 15m, 1h) ---
|
| 548 |
mtf_bull = mtf_bear = 0
|
|
|
|
| 595 |
near_liquidity_high = abs(c[-1] - liquidity_high_zone) / c[-1] < 0.002
|
| 596 |
near_liquidity_low = abs(c[-1] - liquidity_low_zone) / c[-1] < 0.002
|
| 597 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 598 |
# --- 5. STRUCTURE ET RSI ---
|
| 599 |
range_start, range_end = np.mean(h[:20] - l[:20]), np.mean(h[-20:] - l[-20:])
|
| 600 |
squeeze = range_end < range_start * 0.65
|
|
|
|
| 607 |
bos_up = np.max(h[-20:]) > np.max(h[-40:-20])
|
| 608 |
bos_down = np.min(l[-20:]) < np.min(l[-40:-20])
|
| 609 |
|
| 610 |
+
# ========================
|
| 611 |
+
# 🔥 FAKE BREAKOUT FILTER (Déplacé ici pour corriger le bug !)
|
| 612 |
+
# ========================
|
| 613 |
+
fake_breakout_up = bos_up and c[-1] < recent_high
|
| 614 |
+
fake_breakout_down = bos_down and c[-1] > recent_low
|
| 615 |
+
|
| 616 |
bullish_div = bearish_div = False
|
| 617 |
if 'RSI' in df.columns:
|
| 618 |
rsi = df['RSI'].values
|