Matrix Flag Labels
Calculate the matrix flag labels: how closely the prices of the last window periods fit a bull (or bear) flag, a sharp move followed by a consolidation that chartists read as the pause before the move continues.
The window’s prices are laid out as a 10 x 10 grid of their price deciles (rows) over ten consecutive parts of the window (columns), and a template of weights rewards the cells the flag passes through and penalises the others. The score is the sum of the weighted grid; with a threshold the label is 1 from that score.
The templates are those of Leigh, Modani, Purvis and Roberts (2002), “leigh_bull”, and of Cervelló-Royo, Guijarro and Michniuk (2015), “cervello_royo_bull”, who proposed a flag whose weights are concentrated in the consolidation. The bear templates are the bull templates upside down, the highest decile becoming the lowest.
The formula is as follows:
\[D\left[d,\; j\right] = \text{the share of the prices of part}\; j \;\text{of the window in price decile}\; d \;\text{of the whole window},\;\; \text{the highest decile in the top row}\] \[\text{Score} = \sum(W \cdot D),\;\; W \text{ the template}\] \[\text{Label} = 1 \;\text{when Score} \geq \text{threshold},\;\; \text{else 0}\]Unlike the other labels, the score looks back: it uses the prices of the window up to and including the date, so a flag is known at the close of the date.
Also known as: matrix flags, bull flag, bear flag, flag pattern, template matching.
Example · AAPL, MSFT · 2024 to 2025
Install the Finance Toolkit with pip install financetoolkit -U, then call get_matrix_flag_labels:
from financetoolkit import Toolkit
toolkit = Toolkit(
["AAPL", "MSFT"],
api_key="FINANCIAL_MODELING_PREP_KEY",
start_date="2024-01-01",
end_date="2025-12-31",
)
flags = toolkit.technicals.get_matrix_flag_labels(threshold=2.5)
flags.xs("MSFT", level=1, axis="columns")
Or, with the Finance Toolkit MCP set up, ask an AI assistant such as Claude or ChatGPT:
Did Microsoft's price form a bull flag at any point in 2025, with a matrix flag score of at least 2.5?
Which returns:
| Date | Score | Label |
|---|---|---|
| 2024-01-02 | -1.250 | 0 |
| 2024-01-03 | -1.375 | 0 |
| 2024-01-04 | -1.500 | 0 |
| 2024-01-05 | -2.250 | 0 |
| 2024-01-08 | -2.000 | 0 |
| 2024-01-09 | -1.500 | 0 |
| 2024-01-10 | -0.625 | 0 |
| 2024-01-11 | 0.375 | 0 |
| 2024-01-12 | 1.000 | 0 |
| 2024-01-16 | 1.375 | 0 |
| 2024-01-17 | 1.625 | 0 |
| 2024-01-18 | 2.750 | 1 |
| 2024-01-19 | 2.250 | 0 |
| 2024-01-22 | 2.000 | 0 |
| 2024-01-23 | 1.375 | 0 |
| 2024-01-24 | 0.875 | 0 |
| 2024-01-25 | 0.000 | 0 |
| 2024-01-26 | -0.625 | 0 |
| 2024-01-29 | -1.250 | 0 |
| 2024-01-30 | -1.625 | 0 |
| 2024-01-31 | -1.875 | 0 |
| 2024-02-01 | -2.375 | 0 |
| 2024-02-02 | -2.250 | 0 |
| 2024-02-05 | -3.000 | 0 |
| 2024-02-06 | -3.500 | 0 |
| 2024-02-07 | -3.375 | 0 |
| 2024-02-08 | -3.125 | 0 |
| 2024-02-09 | -3.000 | 0 |
| 2024-02-12 | -2.875 | 0 |
| 2024-02-13 | -3.375 | 0 |
| 2024-02-14 | -3.250 | 0 |
| 2024-02-15 | -3.125 | 0 |
| 2024-02-16 | -2.875 | 0 |
| 2024-02-20 | -2.750 | 0 |
| 2024-02-21 | -2.625 | 0 |
| 2024-02-22 | -2.250 | 0 |
| 2024-02-23 | -2.000 | 0 |
| 2024-02-26 | -2.000 | 0 |
| 2024-02-27 | -1.875 | 0 |
| 2024-02-28 | -1.875 | 0 |
| 2024-02-29 | -1.875 | 0 |
| 2024-03-01 | -2.250 | 0 |
| 2024-03-04 | -1.875 | 0 |
| 2024-03-05 | -1.875 | 0 |
| 2024-03-06 | -2.250 | 0 |
| 2024-03-07 | -2.500 | 0 |
| 2024-03-08 | -2.250 | 0 |
| 2024-03-11 | -1.875 | 0 |
| 2024-03-12 | -1.000 | 0 |
| 2024-03-13 | -0.750 | 0 |
| 2024-03-14 | -0.500 | 0 |
| 2024-03-15 | -0.375 | 0 |
| 2024-03-18 | -0.125 | 0 |
| 2024-03-19 | 0.000 | 0 |
| 2024-03-20 | -0.125 | 0 |
| 2024-03-21 | 0.000 | 0 |
| 2024-03-22 | 0.125 | 0 |
| 2024-03-25 | 0.250 | 0 |
| 2024-03-26 | -0.125 | 0 |
| 2024-03-27 | -0.125 | 0 |
| 2024-03-28 | -0.375 | 0 |
| 2024-04-01 | -0.750 | 0 |
| 2024-04-02 | -0.750 | 0 |
| 2024-04-03 | -1.500 | 0 |
| 2024-04-04 | -1.875 | 0 |
| 2024-04-05 | -1.500 | 0 |
| 2024-04-08 | -1.625 | 0 |
| 2024-04-09 | -2.000 | 0 |
| 2024-04-10 | -2.000 | 0 |
| 2024-04-11 | -2.500 | 0 |
| 2024-04-12 | -2.875 | 0 |
| 2024-04-15 | -3.375 | 0 |
| 2024-04-16 | -2.875 | 0 |
| 2024-04-17 | -3.125 | 0 |
| 2024-04-18 | -3.750 | 0 |
| 2024-04-19 | -4.125 | 0 |
| 2024-04-22 | -4.625 | 0 |
| 2024-04-23 | -4.500 | 0 |
| 2024-04-24 | -4.125 | 0 |
| 2024-04-25 | -4.125 | 0 |
| 2024-04-26 | -4.000 | 0 |
| 2024-04-29 | -4.000 | 0 |
| 2024-04-30 | -3.625 | 0 |
| 2024-05-01 | -2.500 | 0 |
| 2024-05-02 | -2.125 | 0 |
| 2024-05-03 | -1.375 | 0 |
| 2024-05-06 | -0.375 | 0 |
| 2024-05-07 | 1.500 | 0 |
| 2024-05-08 | 2.125 | 0 |
| 2024-05-09 | 3.250 | 1 |
| 2024-05-10 | 4.000 | 1 |
| 2024-05-13 | 5.000 | 1 |
| 2024-05-14 | 6.125 | 1 |
| 2024-05-15 | 6.375 | 1 |
| 2024-05-16 | 5.750 | 1 |
| 2024-05-17 | 5.000 | 1 |
| 2024-05-20 | 4.375 | 1 |
| 2024-05-21 | 4.125 | 1 |
| 2024-05-22 | 3.500 | 1 |
| 2024-05-23 | 2.500 | 1 |
| 2024-05-24 | 1.875 | 0 |
| 2024-05-28 | 1.375 | 0 |
| 2024-05-29 | 0.750 | 0 |
| 2024-05-30 | 0.500 | 0 |
| 2024-05-31 | -0.250 | 0 |
| 2024-06-03 | -0.500 | 0 |
| 2024-06-04 | -0.625 | 0 |
| 2024-06-05 | -1.000 | 0 |
| 2024-06-06 | -1.375 | 0 |
| 2024-06-07 | -2.250 | 0 |
| 2024-06-10 | -2.750 | 0 |
| 2024-06-11 | -2.750 | 0 |
| 2024-06-12 | -2.750 | 0 |
| 2024-06-13 | -2.875 | 0 |
| 2024-06-14 | -2.625 | 0 |
| 2024-06-17 | -2.500 | 0 |
| 2024-06-18 | -2.500 | 0 |
| 2024-06-20 | -2.000 | 0 |
| 2024-06-21 | -2.125 | 0 |
| 2024-06-24 | -2.000 | 0 |
| 2024-06-25 | -1.625 | 0 |
| 2024-06-26 | -1.375 | 0 |
| 2024-06-27 | -1.375 | 0 |
| 2024-06-28 | -1.375 | 0 |
| 2024-07-01 | -1.250 | 0 |
| 2024-07-02 | -0.875 | 0 |
| 2024-07-03 | -0.875 | 0 |
| 2024-07-05 | -1.625 | 0 |
| 2024-07-08 | -1.875 | 0 |
| 2024-07-09 | -2.000 | 0 |
| 2024-07-10 | -2.625 | 0 |
| 2024-07-11 | -2.875 | 0 |
| 2024-07-12 | -3.125 | 0 |
| 2024-07-15 | -3.250 | 0 |
| 2024-07-16 | -3.000 | 0 |
| 2024-07-17 | -3.000 | 0 |
| 2024-07-18 | -2.875 | 0 |
| 2024-07-19 | -2.875 | 0 |
| 2024-07-22 | -2.625 | 0 |
| 2024-07-23 | -2.500 | 0 |
| 2024-07-24 | -2.375 | 0 |
| 2024-07-25 | -2.625 | 0 |
| 2024-07-26 | -2.875 | 0 |
| 2024-07-29 | -3.375 | 0 |
| 2024-07-30 | -3.500 | 0 |
| 2024-07-31 | -3.750 | 0 |
| 2024-08-01 | -3.625 | 0 |
| 2024-08-02 | -3.625 | 0 |
| 2024-08-05 | -3.000 | 0 |
| 2024-08-06 | -2.500 | 0 |
| 2024-08-07 | -2.000 | 0 |
| 2024-08-08 | -1.750 | 0 |
| 2024-08-09 | -2.000 | 0 |
| 2024-08-12 | -1.750 | 0 |
| 2024-08-13 | -1.875 | 0 |
| 2024-08-14 | -1.750 | 0 |
| 2024-08-15 | -0.250 | 0 |
| 2024-08-16 | 1.375 | 0 |
| 2024-08-19 | 3.125 | 1 |
| 2024-08-20 | 4.500 | 1 |
| 2024-08-21 | 5.500 | 1 |
| 2024-08-22 | 5.500 | 1 |
| 2024-08-23 | 6.250 | 1 |
| 2024-08-26 | 6.250 | 1 |
| 2024-08-27 | 5.750 | 1 |
| 2024-08-28 | 4.625 | 1 |
| 2024-08-29 | 4.125 | 1 |
| 2024-08-30 | 4.125 | 1 |
| 2024-09-03 | 3.750 | 1 |
| 2024-09-04 | 3.125 | 1 |
| 2024-09-05 | 2.625 | 1 |
| 2024-09-06 | 1.875 | 0 |
| 2024-09-09 | 1.250 | 0 |
| 2024-09-10 | 1.125 | 0 |
| 2024-09-11 | 1.250 | 0 |
| 2024-09-12 | 1.250 | 0 |
| 2024-09-13 | 1.875 | 0 |
| 2024-09-16 | 1.625 | 0 |
| 2024-09-17 | 1.250 | 0 |
| 2024-09-18 | 1.500 | 0 |
| 2024-09-19 | 1.500 | 0 |
| 2024-09-20 | 1.000 | 0 |
| 2024-09-23 | 0.625 | 0 |
| 2024-09-24 | 0.375 | 0 |
| 2024-09-25 | 0.375 | 0 |
| 2024-09-26 | 0.375 | 0 |
| 2024-09-27 | 0.625 | 0 |
| 2024-09-30 | 0.375 | 0 |
| 2024-10-01 | 0.375 | 0 |
| 2024-10-02 | -0.125 | 0 |
| 2024-10-03 | -0.500 | 0 |
| 2024-10-04 | -0.875 | 0 |
| 2024-10-07 | -2.125 | 0 |
| 2024-10-08 | -2.500 | 0 |
| 2024-10-09 | -2.750 | 0 |
| 2024-10-10 | -2.875 | 0 |
| 2024-10-11 | -2.750 | 0 |
| 2024-10-14 | -2.750 | 0 |
| 2024-10-15 | -2.750 | 0 |
| 2024-10-16 | -2.625 | 0 |
| 2024-10-17 | -2.000 | 0 |
| 2024-10-18 | -1.750 | 0 |
| 2024-10-21 | -1.750 | 0 |
| 2024-10-22 | -0.875 | 0 |
| 2024-10-23 | -0.250 | 0 |
| 2024-10-24 | 0.375 | 0 |
| 2024-10-25 | 0.625 | 0 |
| 2024-10-28 | 1.125 | 0 |
| 2024-10-29 | 1.750 | 0 |
| 2024-10-30 | 1.875 | 0 |
| 2024-10-31 | 1.375 | 0 |
| 2024-11-01 | 0.750 | 0 |
| 2024-11-04 | 0.250 | 0 |
| 2024-11-05 | 0.125 | 0 |
| 2024-11-06 | 0.875 | 0 |
| 2024-11-07 | 1.000 | 0 |
| 2024-11-08 | 0.875 | 0 |
| 2024-11-11 | 1.375 | 0 |
| 2024-11-12 | 2.250 | 0 |
| 2024-11-13 | 2.250 | 0 |
| 2024-11-14 | 2.375 | 0 |
| 2024-11-15 | 2.000 | 0 |
| 2024-11-18 | 1.000 | 0 |
| 2024-11-19 | 0.000 | 0 |
| 2024-11-20 | -0.500 | 0 |
| 2024-11-21 | -0.625 | 0 |
| 2024-11-22 | -0.875 | 0 |
| 2024-11-25 | -1.375 | 0 |
| 2024-11-26 | -1.250 | 0 |
| 2024-11-27 | -0.500 | 0 |
| 2024-11-29 | -0.750 | 0 |
| 2024-12-02 | -0.625 | 0 |
| 2024-12-03 | -0.625 | 0 |
| 2024-12-04 | -0.375 | 0 |
| 2024-12-05 | 0.000 | 0 |
| 2024-12-06 | 0.625 | 0 |
| 2024-12-09 | 1.375 | 0 |
| 2024-12-10 | 1.125 | 0 |
| 2024-12-11 | 1.375 | 0 |
| 2024-12-12 | 1.250 | 0 |
| 2024-12-13 | 1.000 | 0 |
| 2024-12-16 | 0.875 | 0 |
| 2024-12-17 | 0.500 | 0 |
| 2024-12-18 | -0.125 | 0 |
| 2024-12-19 | -0.500 | 0 |
| 2024-12-20 | -0.750 | 0 |
| 2024-12-23 | -1.125 | 0 |
| 2024-12-24 | -1.375 | 0 |
| 2024-12-26 | -1.875 | 0 |
| 2024-12-27 | -2.375 | 0 |
| 2024-12-30 | -2.625 | 0 |
| 2024-12-31 | -3.000 | 0 |
| 2025-01-02 | -3.125 | 0 |
| 2025-01-03 | -3.500 | 0 |
| 2025-01-06 | -3.625 | 0 |
| 2025-01-07 | -3.125 | 0 |
| 2025-01-08 | -2.625 | 0 |
| 2025-01-10 | -2.750 | 0 |
| 2025-01-13 | -3.125 | 0 |
| 2025-01-14 | -3.125 | 0 |
| 2025-01-15 | -2.875 | 0 |
| 2025-01-16 | -2.125 | 0 |
| 2025-01-17 | -1.625 | 0 |
| 2025-01-21 | -0.875 | 0 |
| 2025-01-22 | -0.875 | 0 |
| 2025-01-23 | 0.500 | 0 |
| 2025-01-24 | 1.750 | 0 |
| 2025-01-27 | 2.875 | 1 |
| 2025-01-28 | 3.375 | 1 |
| 2025-01-29 | 3.875 | 1 |
| 2025-01-30 | 3.500 | 1 |
| 2025-01-31 | 3.000 | 1 |
| 2025-02-03 | 2.500 | 1 |
| 2025-02-04 | 1.500 | 0 |
| 2025-02-05 | 1.000 | 0 |
| 2025-02-06 | 0.625 | 0 |
| 2025-02-07 | 0.750 | 0 |
| 2025-02-10 | 0.375 | 0 |
| 2025-02-11 | 0.625 | 0 |
| 2025-02-12 | 0.250 | 0 |
| 2025-02-13 | 0.625 | 0 |
| 2025-02-14 | 0.625 | 0 |
| 2025-02-18 | 0.625 | 0 |
| 2025-02-19 | 0.250 | 0 |
| 2025-02-20 | 1.750 | 0 |
| 2025-02-21 | 1.000 | 0 |
| 2025-02-24 | 1.125 | 0 |
| 2025-02-25 | 1.000 | 0 |
| 2025-02-26 | 0.500 | 0 |
| 2025-02-27 | 0.375 | 0 |
| 2025-02-28 | 0.625 | 0 |
| 2025-03-03 | 0.125 | 0 |
| 2025-03-04 | 0.375 | 0 |
| 2025-03-05 | -0.125 | 0 |
| 2025-03-06 | 0.000 | 0 |
| 2025-03-07 | 0.625 | 0 |
| 2025-03-10 | 0.250 | 0 |
| 2025-03-11 | 0.750 | 0 |
| 2025-03-12 | 1.375 | 0 |
| 2025-03-13 | 2.500 | 1 |
| 2025-03-14 | 2.250 | 0 |
| 2025-03-17 | 1.750 | 0 |
| 2025-03-18 | 1.750 | 0 |
| 2025-03-19 | 1.125 | 0 |
| 2025-03-20 | 1.375 | 0 |
| 2025-03-21 | 2.125 | 0 |
| 2025-03-24 | 3.500 | 1 |
| 2025-03-25 | 4.750 | 1 |
| 2025-03-26 | 5.000 | 1 |
| 2025-03-27 | 5.000 | 1 |
| 2025-03-28 | 5.125 | 1 |
| 2025-03-31 | 4.500 | 1 |
| 2025-04-01 | 3.625 | 1 |
| 2025-04-02 | 2.500 | 1 |
| 2025-04-03 | 2.000 | 0 |
| 2025-04-04 | 1.875 | 0 |
| 2025-04-07 | 1.625 | 0 |
| 2025-04-08 | 1.125 | 0 |
| 2025-04-09 | 1.625 | 0 |
| 2025-04-10 | 2.000 | 0 |
| 2025-04-11 | 2.000 | 0 |
| 2025-04-14 | 2.000 | 0 |
| 2025-04-15 | 2.375 | 0 |
| 2025-04-16 | 2.250 | 0 |
| 2025-04-17 | 1.875 | 0 |
| 2025-04-21 | 2.125 | 0 |
| 2025-04-22 | 1.125 | 0 |
| 2025-04-23 | 1.250 | 0 |
| 2025-04-24 | 1.625 | 0 |
| 2025-04-25 | 1.875 | 0 |
| 2025-04-28 | 1.625 | 0 |
| 2025-04-29 | 2.000 | 0 |
| 2025-04-30 | 2.250 | 0 |
| 2025-05-01 | 2.625 | 1 |
| 2025-05-02 | 2.375 | 0 |
| 2025-05-05 | 2.000 | 0 |
| 2025-05-06 | 1.500 | 0 |
| 2025-05-07 | 1.125 | 0 |
| 2025-05-08 | 1.125 | 0 |
| 2025-05-09 | 0.875 | 0 |
| 2025-05-12 | 0.750 | 0 |
| 2025-05-13 | 0.375 | 0 |
| 2025-05-14 | 0.000 | 0 |
| 2025-05-15 | -1.000 | 0 |
| 2025-05-16 | -0.875 | 0 |
| 2025-05-19 | -1.375 | 0 |
| 2025-05-20 | -1.625 | 0 |
| 2025-05-21 | -2.125 | 0 |
| 2025-05-22 | -2.500 | 0 |
| 2025-05-23 | -2.625 | 0 |
| 2025-05-27 | -2.750 | 0 |
| 2025-05-28 | -3.000 | 0 |
| 2025-05-29 | -2.875 | 0 |
| 2025-05-30 | -2.375 | 0 |
| 2025-06-02 | -3.125 | 0 |
| 2025-06-03 | -3.125 | 0 |
| 2025-06-04 | -2.625 | 0 |
| 2025-06-05 | -2.500 | 0 |
| 2025-06-06 | -2.125 | 0 |
| 2025-06-09 | -1.875 | 0 |
| 2025-06-10 | -1.875 | 0 |
| 2025-06-11 | -2.250 | 0 |
| 2025-06-12 | -2.250 | 0 |
| 2025-06-13 | -2.500 | 0 |
| 2025-06-16 | -2.250 | 0 |
| 2025-06-17 | -2.000 | 0 |
| 2025-06-18 | -2.125 | 0 |
| 2025-06-20 | -2.375 | 0 |
| 2025-06-23 | -2.250 | 0 |
| 2025-06-24 | -1.750 | 0 |
| 2025-06-25 | -1.875 | 0 |
| 2025-06-26 | -1.875 | 0 |
| 2025-06-27 | -2.250 | 0 |
| 2025-06-30 | -2.125 | 0 |
| 2025-07-01 | -2.250 | 0 |
| 2025-07-02 | -2.500 | 0 |
| 2025-07-03 | -2.750 | 0 |
| 2025-07-07 | -2.625 | 0 |
| 2025-07-08 | -2.750 | 0 |
| 2025-07-09 | -2.625 | 0 |
| 2025-07-10 | -2.750 | 0 |
| 2025-07-11 | -2.250 | 0 |
| 2025-07-14 | -2.375 | 0 |
| 2025-07-15 | -2.250 | 0 |
| 2025-07-16 | -2.250 | 0 |
| 2025-07-17 | -2.125 | 0 |
| 2025-07-18 | -1.875 | 0 |
| 2025-07-21 | -2.125 | 0 |
| 2025-07-22 | -2.000 | 0 |
| 2025-07-23 | -2.000 | 0 |
| 2025-07-24 | -2.375 | 0 |
| 2025-07-25 | -2.625 | 0 |
| 2025-07-28 | -2.625 | 0 |
| 2025-07-29 | -2.125 | 0 |
| 2025-07-30 | -2.125 | 0 |
| 2025-07-31 | -2.000 | 0 |
| 2025-08-01 | -2.375 | 0 |
| 2025-08-04 | -2.125 | 0 |
| 2025-08-05 | -2.125 | 0 |
| 2025-08-06 | -2.250 | 0 |
| 2025-08-07 | -2.250 | 0 |
| 2025-08-08 | -2.375 | 0 |
| 2025-08-11 | -2.750 | 0 |
| 2025-08-12 | -2.625 | 0 |
| 2025-08-13 | -2.750 | 0 |
| 2025-08-14 | -2.625 | 0 |
| 2025-08-15 | -2.500 | 0 |
| 2025-08-18 | -2.000 | 0 |
| 2025-08-19 | -2.375 | 0 |
| 2025-08-20 | -2.250 | 0 |
| 2025-08-21 | -1.875 | 0 |
| 2025-08-22 | -2.375 | 0 |
| 2025-08-25 | -2.625 | 0 |
| 2025-08-26 | -3.125 | 0 |
| 2025-08-27 | -2.625 | 0 |
| 2025-08-28 | -2.250 | 0 |
| 2025-08-29 | -2.250 | 0 |
| 2025-09-02 | -2.250 | 0 |
| 2025-09-03 | -1.750 | 0 |
| 2025-09-04 | -1.625 | 0 |
| 2025-09-05 | -1.625 | 0 |
| 2025-09-08 | -1.375 | 0 |
| 2025-09-09 | -1.875 | 0 |
| 2025-09-10 | -2.125 | 0 |
| 2025-09-11 | -2.125 | 0 |
| 2025-09-12 | -1.500 | 0 |
| 2025-09-15 | -1.500 | 0 |
| 2025-09-16 | -0.875 | 0 |
| 2025-09-17 | 1.125 | 0 |
| 2025-09-18 | 2.375 | 0 |
| 2025-09-19 | 3.250 | 1 |
| 2025-09-22 | 4.500 | 1 |
| 2025-09-23 | 5.000 | 1 |
| 2025-09-24 | 5.250 | 1 |
| 2025-09-25 | 5.250 | 1 |
| 2025-09-26 | 5.250 | 1 |
| 2025-09-29 | 4.625 | 1 |
| 2025-09-30 | 3.875 | 1 |
| 2025-10-01 | 3.250 | 1 |
| 2025-10-02 | 2.750 | 1 |
| 2025-10-03 | 1.375 | 0 |
| 2025-10-06 | 0.375 | 0 |
| 2025-10-07 | -0.375 | 0 |
| 2025-10-08 | -1.000 | 0 |
| 2025-10-09 | -1.500 | 0 |
| 2025-10-10 | -1.625 | 0 |
| 2025-10-13 | -2.125 | 0 |
| 2025-10-14 | -2.750 | 0 |
| 2025-10-15 | -3.125 | 0 |
| 2025-10-16 | -3.000 | 0 |
| 2025-10-17 | -2.500 | 0 |
| 2025-10-20 | -2.250 | 0 |
| 2025-10-21 | -2.125 | 0 |
| 2025-10-22 | -2.375 | 0 |
| 2025-10-23 | -2.250 | 0 |
| 2025-10-24 | -1.625 | 0 |
| 2025-10-27 | -1.750 | 0 |
| 2025-10-28 | -2.125 | 0 |
| 2025-10-29 | -2.125 | 0 |
| 2025-10-30 | -2.125 | 0 |
| 2025-10-31 | -1.875 | 0 |
| 2025-11-03 | -1.875 | 0 |
| 2025-11-04 | -1.250 | 0 |
| 2025-11-05 | -1.750 | 0 |
| 2025-11-06 | -2.250 | 0 |
| 2025-11-07 | -3.000 | 0 |
| 2025-11-10 | -3.125 | 0 |
| 2025-11-11 | -3.125 | 0 |
| 2025-11-12 | -3.000 | 0 |
| 2025-11-13 | -3.375 | 0 |
| 2025-11-14 | -3.000 | 0 |
| 2025-11-17 | -2.375 | 0 |
| 2025-11-18 | -1.500 | 0 |
| 2025-11-19 | -0.250 | 0 |
| 2025-11-20 | 0.000 | 0 |
| 2025-11-21 | -0.125 | 0 |
| 2025-11-24 | -0.125 | 0 |
| 2025-11-25 | 0.125 | 0 |
| 2025-11-26 | -0.750 | 0 |
| 2025-11-28 | -0.875 | 0 |
| 2025-12-01 | -1.375 | 0 |
| 2025-12-02 | -1.125 | 0 |
| 2025-12-03 | -0.375 | 0 |
| 2025-12-04 | 0.375 | 0 |
| 2025-12-05 | 0.250 | 0 |
| 2025-12-08 | 1.125 | 0 |
| 2025-12-09 | 2.000 | 0 |
| 2025-12-10 | 2.125 | 0 |
| 2025-12-11 | 2.750 | 1 |
| 2025-12-12 | 2.500 | 1 |
| 2025-12-15 | 3.125 | 1 |
| 2025-12-16 | 3.375 | 1 |
| 2025-12-17 | 3.250 | 1 |
| 2025-12-18 | 2.875 | 1 |
| 2025-12-19 | 3.125 | 1 |
| 2025-12-22 | 3.625 | 1 |
| 2025-12-23 | 3.500 | 1 |
| 2025-12-24 | 3.250 | 1 |
| 2025-12-26 | 3.750 | 1 |
| 2025-12-29 | 4.125 | 1 |
| 2025-12-30 | 4.750 | 1 |
| 2025-12-31 | 4.125 | 1 |
502 rows
Parameters
get_matrix_flag_labels accepts the following parameters.
| Parameter | Type | Description | Example |
|---|---|---|---|
period | str | The time period to consider for historical data. Options are: “intraday” (intraday prices), “daily” (daily prices), “weekly” (weekly prices), “monthly” (monthly prices), “quarterly” (quarterly prices), “yearly” (yearly prices). Defaults to “daily”. | "weekly" |
close_column | str | The column name for closing prices in the historical data. Defaults to “Adj Close”. | "Close" |
window | int | The number of prices of the window, at least 10. Defaults to 40. | 20 |
template | str | The template of weights. Options are: “leigh_bull” (the bull flag of Leigh, Modani, Purvis and Roberts, 2002), “leigh_bear” (the Leigh bull flag upside down), “cervello_royo_bull” (the bull flag of Cervelló-Royo, Guijarro and Michniuk, 2015), “cervello_royo_bear” (the Cervelló-Royo bull flag upside down). Defaults to “leigh_bull”. | "leigh_bull" |
threshold | float | None | The score from which the label is 1. Defaults to None, which returns the score only. | None, which returns the score only |
rounding | int | None | The number of decimals to round the results to. Defaults to None, which uses the rounding of the Toolkit (4 unless set otherwise). | 2 |
show_columns | str | list[str] | None | The columns to keep, a name or a list of names, matched on every column level, or the rows when no column has those names (such as the line items of a financial statement). Names that do not exist are logged, and when none exist the result is returned in full. Defaults to None, which keeps every column. | None, which keeps every column |
References
- Paper Leigh, W., Modani, N., Purvis, R. and Roberts, T. (2002). “Stock Market Trading Rule Discovery Using Technical Charting Heuristics.” Expert Systems with Applications, 23(2), 155-159.
- Paper Cervelló-Royo, R., Guijarro, F. and Michniuk, K. (2015). “Stock Market Trading Rule Based on Pattern Recognition and Technical Analysis: Forecasting the DJIA Index with Intraday Data.” Expert Systems with Applications, 42(14), 5963-5975.