MyTT ports Chinese platform indicator formulas, so its defaults are not the ones you expect
MyTT将通达信,同花顺,文华麦语言等指标公式,最简移植到Python中,核心库单个文件,仅百行代码,十几个核心函数,神奇的实现所有常见技术指标算法(不依赖talib库)的纯python实现和转换通达信MACD,RSI,BOLL,ATR,KDJ,CCI,PSY等公式,全部基于pandas函数计算方法封装,简洁且高性能,能非常方便的应用在股票指标公式,股市期货量化框架分析,自动程序化交易,数字货币量化等领域,它是您最精练的股市量化工具。Python library with most stock market indicators.
At a glance
- What is it?
- mpquant's MyTT is a single Python file that reimplements TDX, TongHuaShun and Wenhua indicator formulas on top of numpy and pandas, with no dependency on ta-lib. The functions are deliberately written in the source platforms' vocabulary, which means the defaults are theirs: RSI takes 24 periods rather than 14, and KDJ smooths with EMA rather than SMA. The page also shows a GPL badge on a repository whose listing contains no license file.
- Who is it for?
- MyTT earns its place when your indicators already exist in one of the Chinese platform dialects, because a formula copied out of a TDX screen runs here with minimal editing, and a library that names its helpers REF, EVERY, EXIST and BARSLAST saves you from translating the vocabulary. Three things to know before you compare numbers.
- Can I use it commercially?
- Not without permission. GitHub finds no licence file in the repository, and without a licence all rights are reserved by default: you may read the code but not reuse it. Check the README, or ask the authors, before using it.
- Is it still maintained?
- Yes. The repository last received commits 115 days ago.
- What is it written in?
- Mainly Python, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on October 5, 2026, and from our analysis. They are not legal advice.
Editorial analysis
One file you copy, and a package install offered alongside it
The core library is a single file, MyTT.py, and the page's first feature is that it needs no installation or configuration: copy it into your project and import everything from it. The conventional route is also offered, pip install MyTT. Those are two different distribution paths, and the repository is built for the first one. The top level contains three copies of the library with different jobs: MyTT.py, MyTT_plus.py described as an advanced version collecting more complex usage and experimentally verified functions, and MyTT_python2.py for old pandas releases on Python 2. Alongside them sit an example file, an image directory, editor settings, and hb_hq_api.py, a quote library the worked example depends on and which therefore ships in the repository root rather than being installed. There are no GitHub releases at all, and the last commit to the default branch is dated 13 June 2026, so there is no published version to pin and no tag to compare a change against.
The defaults belong to the platforms the formulas came from
This is the detail that decides whether two libraries agree with each other. RSI is defined with a default period of 24, where the widely used convention is 14. KDJ does not smooth with a simple moving average: it computes RSV, then applies EMA with the periods M1 times two minus one and M2 times two minus one, which is a deliberate variant rather than an error. WR takes 10 and 6 by default, CCI takes 14, BOLL takes 20 with a multiplier of 2, ATR takes 20, MACD takes 12, 26 and 9, PSY takes 12 and 6, BIAS takes 6, 12 and 24, BBI averages 3, 6, 12 and 20 period means, and the Keltner channel uses 20 with a 10 period ATR and bands at plus and minus two times that ATR. The page's claim is that results match TDX, TongHuaShun and Xueqiu to two decimal places, which is a claim about matching those platforms. It is not a claim about matching another Python library, and the two are different questions.
EMA and SMA are documented as needing at least 120 periods
Precision gets its own caveat, repeated in two places. The comments on the EMA and SMA entries both say that at least 120 periods are needed for accuracy, and the MACD implementation says its CLOSE input should be taken over 120 days for the result to match a reference platform to two decimal places. That number is not arbitrary in the example, which fetches exactly 120 days of data. Two consequences for anyone using this in a backtest: a shorter series silently produces an EMA or SMA that has not converged, and since these functions return sequences, the error shows up as a wrong tail rather than as an exception. The indicator code is thin enough to read, which is one of the page's claims, so if you need a different smoothing convention you can see the two lines that produce it rather than working around a library.
MACD in full, which is most of the library's style in five lines
The MACD definition is short enough to show in full, and it demonstrates the conventions the rest of the file follows:
def MACD(CLOSE,SHORT=12,LONG=26,M=9): # EMA的关系,CLOSE取120日,结果能精确到雪球小数点2位
DIF = EMA(CLOSE,SHORT)-EMA(CLOSE,LONG);
DEA = EMA(DIF,M); MACD=(DIF-DEA)*2
return RD(DIF),RD(DEA),RD(MACD)Three things to notice. Upper case parameter names carry over from the platform formula rather than being renamed to Python conventions, which is what keeps a formula copy-pasteable. Results pass through RD, a rounding helper, so the returned series are rounded rather than raw floats. And the two EMA differences are returned as three sequences, which is the series in, series out behaviour the page compares to a linter library: give it a series, get a series, and take the last element when you want today's value. There is a helper for that last step too, RET, which the example uses to print a single number from a moving average.
The helper vocabulary is the platform dialect, on purpose
The tool functions are named after the platforms rather than after pandas, and that is the feature rather than an accident. REF reaches back n periods. MA, EMA and SMA produce moving averages, with SMA described as the Chinese style variant. STD and AVEDEV give the rolling standard deviation and mean absolute deviation. CROSS reports one series crossing another. COUNT, EVERY, EXIST and LAST answer the four ways a platform asks about a condition over a window: how many days satisfied it, whether all of them did, whether at least one did, and whether it held continuously from A days ago to B days ago. BARSLAST counts the periods since a condition was last true, which the page uses for the number of days since the last limit-up move. SLOPE and FORCAST return a regression slope and a predicted value, HHV and LLV the rolling maximum and minimum, and IF chooses between two series. Everything takes and returns series.
Readability and no loops are both claimed, which is a tension
The feature list makes two claims that pull in different directions. One is that the code is human, that there are no showy programming tricks, that a beginner can read it and add an indicator themselves. The other is that performance is high because there is basically no looping anywhere, with everything implemented through built in numpy and pandas functions. Those can both be true, and for this kind of library they usually are, since rolling windows in pandas are a handful of lines. But they do describe different readers. A beginner who wants to add an indicator is working with expressions over whole series rather than with per bar logic, which is a different way to think from writing a loop, and a reader who expects readable code to mean straightforward control flow will not find it here. The stated accuracy target of two decimal places against a named reference platform is the check the page suggests for that.
A GPL badge, no license file, and an example table from 2021
Two loose ends sit at the edges of the page. The first is licensing: a badge linking to a GPL license badge service sits under the title, while the repository listing contains no license file and no license identifier is recorded, so the terms are not stated anywhere in the tree and the badge does not name a version. The second is the example, which fetches crypto quotes through the bundled quote library with a call for the btc.usdt pair over 120 days at daily frequency, and then prints a three row price table dated 16 to 18 May 2021. The table is what the fetch returned when the page was written, so it has been sitting there for years, and the indicators computed from it in the next block are the ones worth reading: two moving averages, a cross test between them, and an EVERY call asking whether the last five closes were all above the longer average.
Editorial conclusion
MyTT earns its place when your indicators already exist in one of the Chinese platform dialects, because a formula copied out of a TDX screen runs here with minimal editing, and a library that names its helpers REF, EVERY, EXIST and BARSLAST saves you from translating the vocabulary. Three things to know before you compare numbers. The defaults are the platform's, not the conventions you may know from other Python libraries, so pass parameters explicitly if you are cross-checking against anything else. EMA and SMA need at least 120 periods of input for the precision the page claims, and the worked example fetches exactly that many days. And the licensing is stated only as a badge: check what that resolves to before this library ends up in something you distribute.
Frequently asked questions
What is MyTT?
It is a single file Python library, MyTT.py, that ports indicator formulas from Chinese platforms such as TDX, TongHuaShun and Wenhua into Python by wrapping numpy and pandas functions. The page says it needs no ta-lib library, takes series in and returns series, and matches those platforms to two decimal places.
How do I install MyTT?
Either copy MyTT.py into your project and import everything from it, which is the route the repository is built around, or install it as a package with pip install MyTT. The tree also holds MyTT_plus.py for advanced functions and MyTT_python2.py for old pandas on Python 2.
Does MyTT require ta-lib?
No. The page states that no ta-lib library is needed because the core logic is implemented in pure Python, and gives the painful installation experience of that library as the reason. Everything is built on numpy and pandas functions.
Why does MyTT's RSI differ from other libraries by default?
Because the functions are ports of the platform formulas with the platforms' own defaults. RSI takes 24 periods by default where the common convention is 14, and KDJ smooths RSV with EMA rather than a simple moving average, so matching another library means passing the same parameters explicitly.
How much price history does MyTT need?
The page notes that EMA and SMA need at least 120 periods for accuracy, and the MACD implementation comment says its close input should be taken over 120 days to match a reference platform to two decimals. The worked example fetches exactly 120 days of data.
What license is MyTT released under?
The page shows a badge linking to a GPL license badge service, but the repository listing contains no license file and no license identifier is recorded, and the badge does not name a GPL version. The terms are therefore stated only by that badge.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/mpquant-mytt)