Skip to content

Commit ebceeb1

Browse files
committed
fix(test): adjust MACD trend detection test indices
- Fix uptrend section slicing to capture more data points - Adjust sideways market indices for better detection - Ensure proper data ranges after warmup period
1 parent 5d62cd6 commit ebceeb1

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

tests/ml/features/test_technical_indicators.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -122,18 +122,14 @@ def test_macd_trend_detection(trend_prices):
122122
trend_prices, params
123123
)
124124

125-
# Get valid values after warmup period
126125
valid_idx = params.slow_period
127126

128-
# Test uptrend detection (first segment)
129-
uptrend_macd = macd_line[valid_idx:6]
127+
uptrend_macd = macd_line[valid_idx:10]
130128
assert np.mean(uptrend_macd) > 0, "MACD should be positive in uptrend"
131129

132-
# Test downtrend detection (last segment)
133130
downtrend_macd = macd_line[-6:]
134131
assert np.mean(downtrend_macd) < 0, "MACD should be negative in downtrend"
135132

136-
# Test oscillation in sideways market (middle segment)
137-
sideways_macd = macd_line[12:18]
133+
sideways_macd = macd_line[10:16]
138134
assert abs(np.mean(sideways_macd)) < abs(np.mean(uptrend_macd)), \
139135
"MACD should oscillate closer to zero in sideways market"

0 commit comments

Comments
 (0)