it works buty its not good\
This commit is contained in:
@@ -504,7 +504,7 @@ pub fn generate_signal(symbol: &str, current: &IndicatorRow, previous: &Indicato
|
||||
}
|
||||
}
|
||||
|
||||
// PULLBACK ENTRY
|
||||
// PULLBACK ENTRY (buy-side)
|
||||
if trend_bullish && ema_bullish {
|
||||
if !rsi.is_nan() && rsi > RSI_PULLBACK_LOW && rsi < RSI_PULLBACK_HIGH {
|
||||
buy_score += 3.0;
|
||||
@@ -517,7 +517,20 @@ pub fn generate_signal(symbol: &str, current: &IndicatorRow, previous: &Indicato
|
||||
}
|
||||
}
|
||||
|
||||
// OVERSOLD/OVERBOUGHT
|
||||
// PULLBACK EXIT (sell-side symmetry — bearish trend with RSI bounce)
|
||||
if !trend_bullish && !ema_bullish {
|
||||
if !rsi.is_nan() && rsi > (100.0 - RSI_PULLBACK_HIGH) && rsi < (100.0 - RSI_PULLBACK_LOW) {
|
||||
sell_score += 3.0;
|
||||
}
|
||||
if ema_distance < 0.0 && ema_distance > -0.03 {
|
||||
sell_score += 1.5;
|
||||
}
|
||||
if bb_pct > 0.7 {
|
||||
sell_score += 2.0;
|
||||
}
|
||||
}
|
||||
|
||||
// OVERSOLD/OVERBOUGHT (symmetrized)
|
||||
if !rsi.is_nan() {
|
||||
if rsi < RSI_OVERSOLD {
|
||||
if trend_bullish {
|
||||
@@ -526,11 +539,15 @@ pub fn generate_signal(symbol: &str, current: &IndicatorRow, previous: &Indicato
|
||||
buy_score += 2.0;
|
||||
}
|
||||
} else if rsi > RSI_OVERBOUGHT {
|
||||
sell_score += 3.0;
|
||||
if !trend_bullish {
|
||||
sell_score += 4.0;
|
||||
} else {
|
||||
sell_score += 2.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MACD MOMENTUM
|
||||
// MACD MOMENTUM (symmetrized)
|
||||
if macd_crossed_up {
|
||||
buy_score += 2.5;
|
||||
if strong_trend && trend_up {
|
||||
@@ -538,6 +555,9 @@ pub fn generate_signal(symbol: &str, current: &IndicatorRow, previous: &Indicato
|
||||
}
|
||||
} else if macd_crossed_down {
|
||||
sell_score += 2.5;
|
||||
if strong_trend && !trend_up {
|
||||
sell_score += 1.0;
|
||||
}
|
||||
} else if !macd_hist.is_nan() {
|
||||
if macd_hist > 0.0 {
|
||||
buy_score += 0.5;
|
||||
@@ -574,14 +594,12 @@ pub fn generate_signal(symbol: &str, current: &IndicatorRow, previous: &Indicato
|
||||
sell_score += 0.5;
|
||||
}
|
||||
|
||||
// VOLUME CONFIRMATION
|
||||
// VOLUME GATE — require minimum volume for signal to be actionable
|
||||
let has_volume = volume_ratio >= VOLUME_THRESHOLD;
|
||||
if has_volume && volume_ratio > 1.5 {
|
||||
if buy_score > sell_score {
|
||||
buy_score += 1.0;
|
||||
} else if sell_score > buy_score {
|
||||
sell_score += 1.0;
|
||||
}
|
||||
if !has_volume {
|
||||
// Dampen scores when volume is too low
|
||||
buy_score *= 0.5;
|
||||
sell_score *= 0.5;
|
||||
}
|
||||
|
||||
// DETERMINE SIGNAL
|
||||
@@ -589,7 +607,7 @@ pub fn generate_signal(symbol: &str, current: &IndicatorRow, previous: &Indicato
|
||||
|
||||
let signal = if total_score >= 6.0 {
|
||||
Signal::StrongBuy
|
||||
} else if total_score >= 3.5 {
|
||||
} else if total_score >= 4.5 {
|
||||
Signal::Buy
|
||||
} else if total_score <= -6.0 {
|
||||
Signal::StrongSell
|
||||
@@ -617,5 +635,7 @@ pub fn generate_signal(symbol: &str, current: &IndicatorRow, previous: &Indicato
|
||||
ema_long: if ema_long.is_nan() { 0.0 } else { ema_long },
|
||||
current_price,
|
||||
confidence,
|
||||
atr: if current.atr.is_nan() { 0.0 } else { current.atr },
|
||||
atr_pct: if current.atr_pct.is_nan() { 0.0 } else { current.atr_pct },
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user