Altman Z Score – Determining Bankruptcy Probability with QuantConnect

The Altman Z-Score is an indicator used to determine a company’s likelihood of declaring bankruptcy. A total of five ratios are necessary for the calculation. Lucky for us, they are all readily available for public companies.

The Formula

A = Working Capital / Total Assets
B = Retained Earnings / Total Assets
C = Earnings Before Interest / Total Assets
D = Market Value of Equity / Total Liabilities
E = Sales / Total Assets

Then the Altman Z Score can be calculated by:
Z = 1.2A + 1.4B + 3.3C + 0.6D + 1.0E

The relative probability of default is determined by the Z value. Specifically,

Z ≥ 3 → Safe
1.81 ≤ Z < 3 → Warning
Z < 1.81 → Danger

Note that these cutoffs are from the original Altman Z Score. Different intervals have been derived for emerging markets. More information is available on Wikipedia.


This algorithm is heavily based on code from Aaron Gilman. It has been updated to work with new versions of QuantConnect.

It works through universe selection. Universe selection allows us to filter equities based on predefined search criteria. In this case, it selects equities that have 1) all the necessary data available for calculating the ratios and 2) a Z Score greater than 1.81. Next, the results are sorted by EBITDA and capital is equally divided among the top 100 equities. The portfolio is re-balanced on the first trading day each month.

Historic Accuracy

In Altman’s initial publication, the Altman Z Score was 72% accurate in predicting bankruptcy within two years. False negatives, however, were extremely low at just 6%. This initial accuracy has not only been proven, but actually found to be a conservative estimate. Over the years, Altman’s model was found to be 80-90% accurate — but with a higher false negative rate of around 15%.

Today, Altman’s Z Score is widely accepted. Originally designed for manufacturing companies with over $1 million in assets, it’s now used in a variety of countries and industries, though sometimes with slight modifications.


As with most balance sheet models, the Alman Z Score should not be applied to financial companies. The balance sheets of Wallstreet companies are notoriously opaque and off-balance sheet items are numerous — making accurate calculations nearly impossible.

Death Cross – QuantConnect Algorithm

Death crosses are useful as trailing indicators. Specifically, a death cross occurs when the long term moving average passes above the short term moving average. The graph below depicts a death cross, highlighted in pink. It is a sign that the security is likely to fall in value.

Graph showing example of a death cross
Chart generated from

Intuitively, this makes sense. The moving average is a trend over time. If the short term moving average falls below the long term moving average, it’s an indicator something has recently changed — for the worse.

Like any indicator, a death cross is far from foolproof. Since it’s a lagging indicator, if the downturn is short lived, by the time the indicator forms, the equity may have resumed an upward trend. In this instance, acting on the death cross is disadvantageous to the investor.

The opposite of a death cross is a golden cross. That is, a golden cross occurs if the short term moving average crosses above the long term average. A golden cross appears in the graph above in early August and is a sign of an upward trend.

Below are the results of a simple algorithm using death and golden crosses. The algorithm will go long on a golden cross and liquidate on a death cross.

Crosses really shine when used in conjunction with other indicators. The performance of crosses alone is far from groundbreaking.

Feel free to modify the algorithm on QuantConnect (GitHub). Changing the slow/fast period or symbol is a good place to start.

Have any algorithms that use crosses? A burning question I neglected to answer? Let me know in the comments!