Skip to content

Reject MACD signalperiod=1 for look-ahead affected TA-Lib paths#749

Open
Whning0513 wants to merge 2 commits into
TA-Lib:masterfrom
Whning0513:reject-macd-signalperiod-one-725
Open

Reject MACD signalperiod=1 for look-ahead affected TA-Lib paths#749
Whning0513 wants to merge 2 commits into
TA-Lib:masterfrom
Whning0513:reject-macd-signalperiod-one-725

Conversation

@Whning0513

Copy link
Copy Markdown
Contributor

Fixes #725.

Summary

  • reject signalperiod=1 for MACD and MACDFIX at the Python wrapper level
  • keep MACDEXT untouched because it does not exhibit the same look-ahead issue in the current TA-Lib implementation
  • add regression coverage for talib, talib.func, talib.stream, and talib.abstract entry points

Why

  • with the current upstream TA-Lib behavior, MACD(..., signalperiod=1) and MACDFIX(..., signalperiod=1) can produce values that change when a future sample is appended
  • rejecting this unsupported edge case is safer than returning silently look-ahead affected results

Validation

  • reproduced the issue locally against the current wheel: MACD and MACDFIX show large deltas when appending a future outlier, while MACDEXT does not
  • verified the patched Python wrappers from a wheel-backed local import overlay for talib, func, stream, and abstract
  • I could not run the source-tree pytest suite end-to-end because rebuilding the extension locally requires MSVC build tools on this machine

@mrjbq7

mrjbq7 commented Jun 29, 2026

Copy link
Copy Markdown
Member

I will look at this in a week when I return. But my first reaction is that this is an upstream issue and should be fixed in the upstream TA-Lib C library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: MACD with signalperiod = 1 - data leak

2 participants