Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -350,7 +350,7 @@ def generate_trading_signals(df):
|
|
| 350 |
|
| 351 |
# Less strict RSI Signal - Use common thresholds (30/70 instead of 15/90)
|
| 352 |
df['RSI_Signal'] = np.where(df['RSI'] < 30, 1, 0)
|
| 353 |
-
df['RSI_Signal'] = np.where(df['RSI'] >
|
| 354 |
|
| 355 |
# Less strict Bollinger Bands Signal - Touch or slight breach (no 3% buffer)
|
| 356 |
df['BB_Signal'] = np.where(df['Close'] <= df['LowerBB'], 1, 0)
|
|
@@ -358,14 +358,14 @@ def generate_trading_signals(df):
|
|
| 358 |
|
| 359 |
# Less strict Stochastic Signal - Standard overbought/oversold (20/80 instead of 10/95)
|
| 360 |
df['Stochastic_Signal'] = np.where((df['SlowK'] < 20) & (df['SlowD'] < 20), 1, 0)
|
| 361 |
-
df['Stochastic_Signal'] = np.where((df['SlowK'] >
|
| 362 |
|
| 363 |
# Less strict CMF Signal - Use ±0.1 instead of ±0.4
|
| 364 |
df['CMF_Signal'] = np.where(df['CMF'] > 0.1, -1, np.where(df['CMF'] < -0.1, 1, 0))
|
| 365 |
|
| 366 |
# Less strict CCI Signal - Standard thresholds (±100 instead of ±220)
|
| 367 |
df['CCI_Signal'] = np.where(df['CCI'] < -100, 1, 0)
|
| 368 |
-
df['CCI_Signal'] = np.where(df['CCI'] >
|
| 369 |
|
| 370 |
# Combined signal (still sums all component signals)
|
| 371 |
df['Combined_Signal'] = df[['MACD_Signal', 'RSI_Signal', 'BB_Signal',
|
|
|
|
| 350 |
|
| 351 |
# Less strict RSI Signal - Use common thresholds (30/70 instead of 15/90)
|
| 352 |
df['RSI_Signal'] = np.where(df['RSI'] < 30, 1, 0)
|
| 353 |
+
df['RSI_Signal'] = np.where(df['RSI'] > 90, -1, df['RSI_Signal'])
|
| 354 |
|
| 355 |
# Less strict Bollinger Bands Signal - Touch or slight breach (no 3% buffer)
|
| 356 |
df['BB_Signal'] = np.where(df['Close'] <= df['LowerBB'], 1, 0)
|
|
|
|
| 358 |
|
| 359 |
# Less strict Stochastic Signal - Standard overbought/oversold (20/80 instead of 10/95)
|
| 360 |
df['Stochastic_Signal'] = np.where((df['SlowK'] < 20) & (df['SlowD'] < 20), 1, 0)
|
| 361 |
+
df['Stochastic_Signal'] = np.where((df['SlowK'] > 90) & (df['SlowD'] > 90), -1, df['Stochastic_Signal'])
|
| 362 |
|
| 363 |
# Less strict CMF Signal - Use ±0.1 instead of ±0.4
|
| 364 |
df['CMF_Signal'] = np.where(df['CMF'] > 0.1, -1, np.where(df['CMF'] < -0.1, 1, 0))
|
| 365 |
|
| 366 |
# Less strict CCI Signal - Standard thresholds (±100 instead of ±220)
|
| 367 |
df['CCI_Signal'] = np.where(df['CCI'] < -100, 1, 0)
|
| 368 |
+
df['CCI_Signal'] = np.where(df['CCI'] > 120, -1, df['CCI_Signal'])
|
| 369 |
|
| 370 |
# Combined signal (still sums all component signals)
|
| 371 |
df['Combined_Signal'] = df[['MACD_Signal', 'RSI_Signal', 'BB_Signal',
|