INNER CODE UNIT · Python

rsi_signal

zoharbabin/quantum-trader · src/analysis/technical_analysis.py:60

            rsi_signal = (rsi_value - 50) / 50  # Range: -1 to 1
            macd_signal = np.tanh(macd_value)   # Range: -1 to 1
            bb_signal = 2 * (bb_position - 0.5)  # Range: -1 to 1
            
            # Combine signals with equal weights
            combined_signal = (rsi_signal + macd_signal + bb_signal) / 3
            
            # Ensure result is within bounds
            return float(max(min(combined_signal, 1), -1))
            
        except Exception as e:
            print(f"Error evaluating technical indicators: {e}")
            return None

    def sma(self, period=20):
        """Simple Moving Average"""
        result = self.data['close'].rolling(window=period).mean()
        result.name = None  # Remove name to match test expectations

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…