Stochastic + RSI + MACD engine self-test 2026-10-14T10:58:21.144Z [PASS] Stochastic (14, 3, 3): %K = 3-bar average of the raw %K, %D = 3-bar average of %K, NaN before: 47.99999999999995 49.999999999999964 [PASS] EMA seeded with the simple average from its first defined value (signal line from bar 25) [PASS] long: both lines below 20 at bar 3 arm it; the MACD crossing at bar 5 with RSI above 50 is the signal [PASS] only one line below 20: not armed, no signal [PASS] a crossing with RSI at or below 50 is no signal and the setup stays armed (signal at the next crossing, bar 8) [PASS] either line above 80 before the crossing disarms the long setup [PASS] a signal uses up the setup: a second crossing without a new oversold reading is no signal [PASS] short: both lines above 80, MACD crosses below its signal line with RSI below 50 [PASS] nearest swing low below the close, one point under it [PASS] the swing must be confirmed: a fractal at k-1 is not yet known [PASS] a swing more than 200 bars back is ignored [PASS] target 1.5R reached in minute 1 [PASS] a minute touching both: the stop [PASS] a stop gapped through fills at the open [PASS] variant A: stop one point under the swing low (1.0900), held; the second signal (bar 6) is missed while the first trade is open: 1 trades [PASS] variant B: the same stop capped at 0.15% of the fill: 1.0983500000000002 [PASS] result in R after 1 pip, financing A (2% a year) and B (swap nights) real data: 8326700 minutes, 2004-01-01 00:03 .. 2026-09-28 15:46 New York (stamps at the minute's close) [PASS] 15-minute Stochastic %K and %D equal a naive recomputation (every 997th bar): largest difference 0.00e+0 [PASS] SM-M15-A: engine and independent re-implementation agree trade by trade: 5997 vs 5997 trades, 0 differences [PASS] SM-M15-A: control at offset 0 reproduces the real trades: 5997 of 5997, 0 differences [PASS] SM-M15-B: engine and independent re-implementation agree trade by trade: 7775 vs 7775 trades, 0 differences [PASS] SM-M15-B: control at offset 0 reproduces the real trades: 7775 of 7775, 0 differences [PASS] 30-minute Stochastic %K and %D equal a naive recomputation (every 997th bar): largest difference 0.00e+0 [PASS] SM-M30-A: engine and independent re-implementation agree trade by trade: 2904 vs 2904 trades, 0 differences [PASS] SM-M30-A: control at offset 0 reproduces the real trades: 2904 of 2904, 0 differences [PASS] SM-M30-B: engine and independent re-implementation agree trade by trade: 4077 vs 4077 trades, 0 differences [PASS] SM-M30-B: control at offset 0 reproduces the real trades: 4077 of 4077, 0 differences [PASS] 60-minute Stochastic %K and %D equal a naive recomputation (every 997th bar): largest difference 0.00e+0 [PASS] SM-H1-A: engine and independent re-implementation agree trade by trade: 1395 vs 1395 trades, 0 differences [PASS] SM-H1-A: control at offset 0 reproduces the real trades: 1395 of 1395, 0 differences [PASS] SM-H1-B: engine and independent re-implementation agree trade by trade: 2068 vs 2068 trades, 0 differences [PASS] SM-H1-B: control at offset 0 reproduces the real trades: 2068 of 2068, 0 differences PASSED