INNER CODE UNIT · Python

bb_position

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

                bb_position = (current_price - lower_band.iloc[-1]) / band_range
                bb_position = max(0, min(1, bb_position))  # Ensure between 0 and 1
            
            # Normalize signals
            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

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…