Heikin-Ashi Candles
Calculate the Heikin-Ashi (“average bar”) candles of every ticker: candles built from two-period averages, which smooth the noise so the trend stands out.
Each candle averages the prices of its period, and its open is the midpoint of the previous Heikin-Ashi candle’s body, so the candles smooth out the noise of single periods: a trend shows as a run of candles of one colour, often without a shadow on the side of the open, and a small body with long shadows on both sides hints at a turn.
The formula is as follows:
\[\text{HA Close} = \frac{\text{Open} + \text{High} + \text{Low} + \text{Close}}{4}\] \[\text{HA Open} = \frac{\text{previous HA Open} + \text{previous HA Close}}{2},\;\; \frac{\text{starting from} \;(\text{Open} + \text{Close})}{2 \;\text{on the first candle}}\] \[\text{HA High} = \max(\text{High},\; \text{HA Open},\; \text{HA Close})\] \[\text{HA Low} = \min(\text{Low},\; \text{HA Open},\; \text{HA Close})\]The HA Open is an exponential average of the previous HA Closes with a smoothing factor of 1/2.
Also known as: Heikin-Ashi, Heikin Ashi, Heiken Ashi, HA candles, average bar.
Example · AAPL, MSFT · 2025
Install the Finance Toolkit with pip install financetoolkit -U, then call get_heikin_ashi:
from financetoolkit import Toolkit
toolkit = Toolkit(
["AAPL", "MSFT"],
api_key="FINANCIAL_MODELING_PREP_KEY",
start_date="2025-01-01",
end_date="2025-12-31",
)
heikin_ashi = toolkit.technicals.get_heikin_ashi()
heikin_ashi.xs("AAPL", level=1, axis="columns")
Or, with the Finance Toolkit MCP set up, ask an AI assistant such as Claude or ChatGPT:
What did Apple's Heikin-Ashi candles look like in 2025?
Which returns:
| Date | Open | High | Low | Close |
|---|---|---|---|---|
| 2025-01-02 | 250.850 | 250.850 | 239.895 | 243.968 |
| 2025-01-03 | 247.409 | 247.409 | 239.965 | 241.262 |
| 2025-01-06 | 244.336 | 245.362 | 241.264 | 243.011 |
| 2025-01-07 | 243.673 | 243.673 | 239.429 | 241.088 |
| 2025-01-08 | 242.381 | 242.381 | 238.140 | 240.168 |
| 2025-01-10 | 241.274 | 241.274 | 231.146 | 235.615 |
| 2025-01-13 | 238.445 | 238.445 | 227.892 | 231.225 |
| 2025-01-14 | 234.835 | 234.835 | 230.620 | 232.292 |
| 2025-01-15 | 233.563 | 237.058 | 232.564 | 234.593 |
| 2025-01-16 | 234.078 | 236.116 | 226.215 | 231.059 |
| 2025-01-17 | 232.569 | 232.569 | 226.662 | 228.881 |
| 2025-01-21 | 230.725 | 230.725 | 217.634 | 220.838 |
| 2025-01-22 | 225.782 | 225.782 | 218.041 | 220.117 |
| 2025-01-23 | 222.949 | 225.223 | 220.531 | 222.646 |
| 2025-01-24 | 222.798 | 223.834 | 219.648 | 221.870 |
| 2025-01-27 | 222.334 | 230.302 | 222.197 | 225.692 |
| 2025-01-28 | 224.013 | 238.278 | 224.013 | 233.157 |
| 2025-01-29 | 228.585 | 237.951 | 228.585 | 234.953 |
| 2025-01-30 | 231.769 | 238.874 | 231.769 | 236.666 |
| 2025-01-31 | 234.218 | 245.223 | 231.582 | 239.037 |
| 2025-02-03 | 236.627 | 236.627 | 223.904 | 227.061 |
| 2025-02-04 | 231.844 | 231.844 | 224.846 | 228.127 |
| 2025-02-05 | 229.986 | 230.818 | 226.453 | 228.651 |
| 2025-02-06 | 229.318 | 231.939 | 228.596 | 230.337 |
| 2025-02-07 | 229.828 | 232.138 | 225.451 | 228.539 |
| 2025-02-10 | 229.183 | 229.183 | 225.640 | 227.181 |
| 2025-02-11 | 228.182 | 233.614 | 226.563 | 229.458 |
| 2025-02-12 | 228.820 | 235.333 | 228.820 | 232.321 |
| 2025-02-13 | 230.571 | 240.676 | 230.571 | 237.446 |
| 2025-02-14 | 234.008 | 243.864 | 234.008 | 241.428 |
| 2025-02-18 | 237.718 | 243.496 | 237.718 | 242.235 |
| 2025-02-19 | 239.976 | 244.321 | 239.976 | 242.995 |
| 2025-02-20 | 241.486 | 245.085 | 241.486 | 243.774 |
| 2025-02-21 | 242.630 | 246.982 | 242.630 | 244.661 |
| 2025-02-24 | 243.645 | 247.151 | 242.741 | 244.636 |
| 2025-02-25 | 244.141 | 248.283 | 243.228 | 245.788 |
| 2025-02-26 | 244.964 | 244.964 | 237.488 | 240.537 |
| 2025-02-27 | 242.750 | 242.750 | 235.432 | 237.416 |
| 2025-02-28 | 240.083 | 240.427 | 228.619 | 236.137 |
| 2025-03-03 | 238.110 | 242.354 | 234.488 | 238.342 |
| 2025-03-04 | 238.226 | 238.421 | 233.068 | 235.469 |
| 2025-03-05 | 236.848 | 236.848 | 227.656 | 232.626 |
| 2025-03-06 | 234.737 | 236.226 | 231.559 | 233.582 |
| 2025-03-07 | 234.160 | 239.712 | 233.148 | 235.946 |
| 2025-03-10 | 235.053 | 235.053 | 222.680 | 229.265 |
| 2025-03-11 | 232.159 | 232.159 | 215.957 | 220.460 |
| 2025-03-12 | 226.310 | 226.310 | 213.434 | 216.945 |
| 2025-03-13 | 221.627 | 221.627 | 206.989 | 211.262 |
| 2025-03-14 | 216.444 | 216.444 | 208.141 | 210.611 |
| 2025-03-17 | 213.528 | 213.742 | 208.528 | 211.661 |
| 2025-03-18 | 212.595 | 213.672 | 210.037 | 211.907 |
| 2025-03-19 | 212.251 | 217.258 | 212.251 | 214.012 |
| 2025-03-20 | 213.132 | 215.996 | 210.762 | 212.977 |
| 2025-03-21 | 213.054 | 217.337 | 209.829 | 213.511 |
| 2025-03-24 | 213.283 | 219.959 | 213.283 | 218.934 |
| 2025-03-25 | 216.108 | 222.561 | 216.108 | 220.649 |
| 2025-03-26 | 218.379 | 223.475 | 218.379 | 221.103 |
| 2025-03-27 | 219.741 | 223.445 | 219.045 | 221.168 |
| 2025-03-28 | 220.455 | 222.273 | 216.185 | 218.752 |
| 2025-03-31 | 219.603 | 224.071 | 214.745 | 218.735 |
| 2025-04-01 | 219.169 | 222.144 | 217.397 | 219.875 |
| 2025-04-02 | 219.522 | 223.643 | 219.502 | 221.325 |
| 2025-04-03 | 220.423 | 220.423 | 199.868 | 202.964 |
| 2025-04-04 | 211.694 | 211.694 | 186.053 | 191.051 |
| 2025-04-07 | 201.372 | 201.372 | 173.421 | 180.608 |
| 2025-04-08 | 190.990 | 190.990 | 168.048 | 178.434 |
| 2025-04-09 | 184.712 | 199.232 | 170.709 | 184.549 |
| 2025-04-10 | 184.630 | 193.442 | 181.743 | 188.017 |
| 2025-04-11 | 186.324 | 198.170 | 184.782 | 191.141 |
| 2025-04-14 | 188.732 | 211.478 | 188.732 | 205.593 |
| 2025-04-15 | 197.163 | 202.112 | 197.163 | 200.441 |
| 2025-04-16 | 198.802 | 199.322 | 191.049 | 195.076 |
| 2025-04-17 | 196.939 | 197.464 | 193.085 | 195.506 |
| 2025-04-21 | 196.222 | 196.222 | 188.506 | 191.188 |
| 2025-04-22 | 193.705 | 200.206 | 193.705 | 196.993 |
| 2025-04-23 | 195.349 | 206.571 | 195.349 | 203.940 |
| 2025-04-24 | 199.644 | 207.396 | 199.644 | 204.841 |
| 2025-04-25 | 202.243 | 208.310 | 202.243 | 206.472 |
| 2025-04-28 | 204.357 | 210.048 | 204.357 | 208.334 |
| 2025-04-29 | 206.346 | 210.782 | 206.346 | 208.684 |
| 2025-04-30 | 207.515 | 212.113 | 205.251 | 209.067 |
| 2025-05-01 | 208.291 | 213.087 | 207.465 | 210.013 |
| 2025-05-02 | 209.152 | 209.152 | 200.772 | 203.739 |
| 2025-05-05 | 206.445 | 206.445 | 196.849 | 199.694 |
| 2025-05-06 | 203.070 | 203.070 | 195.667 | 197.234 |
| 2025-05-07 | 200.152 | 200.152 | 191.923 | 195.674 |
| 2025-05-08 | 197.913 | 198.676 | 193.343 | 196.129 |
| 2025-05-09 | 197.021 | 199.163 | 196.183 | 197.536 |
| 2025-05-12 | 197.279 | 210.094 | 197.279 | 208.777 |
| 2025-05-13 | 203.028 | 212.212 | 203.028 | 210.263 |
| 2025-05-14 | 206.645 | 212.749 | 206.645 | 211.138 |
| 2025-05-15 | 208.892 | 211.775 | 208.374 | 210.049 |
| 2025-05-16 | 209.471 | 211.387 | 208.603 | 210.313 |
| 2025-05-19 | 209.892 | 209.892 | 203.123 | 206.452 |
| 2025-05-20 | 208.172 | 208.172 | 203.889 | 205.855 |
| 2025-05-21 | 207.014 | 207.014 | 199.593 | 202.619 |
| 2025-05-22 | 204.816 | 204.816 | 198.589 | 200.011 |
| 2025-05-23 | 202.413 | 202.413 | 192.383 | 193.940 |
| 2025-05-27 | 198.177 | 199.623 | 196.331 | 198.061 |
| 2025-05-28 | 198.119 | 201.602 | 198.119 | 199.792 |
| 2025-05-29 | 198.955 | 202.676 | 197.405 | 200.341 |
| 2025-05-30 | 199.648 | 200.836 | 195.685 | 198.628 |
| 2025-06-02 | 199.138 | 201.005 | 199.006 | 199.939 |
| 2025-06-03 | 199.538 | 202.636 | 199.538 | 201.211 |
| 2025-06-04 | 200.375 | 205.092 | 200.375 | 202.385 |
| 2025-06-05 | 201.380 | 203.611 | 199.036 | 201.132 |
| 2025-06-06 | 201.256 | 204.555 | 200.925 | 202.534 |
| 2025-06-09 | 201.895 | 204.853 | 198.907 | 201.835 |
| 2025-06-10 | 201.865 | 203.213 | 199.454 | 200.923 |
| 2025-06-11 | 201.394 | 203.362 | 197.306 | 200.177 |
| 2025-06-12 | 200.786 | 200.786 | 196.262 | 197.723 |
| 2025-06-13 | 199.255 | 199.255 | 194.611 | 196.960 |
| 2025-06-16 | 198.107 | 198.107 | 195.466 | 196.642 |
| 2025-06-17 | 197.375 | 197.375 | 194.124 | 195.516 |
| 2025-06-18 | 196.445 | 196.470 | 193.984 | 195.198 |
| 2025-06-20 | 195.821 | 200.577 | 195.764 | 198.340 |
| 2025-06-23 | 197.081 | 201.174 | 197.081 | 199.978 |
| 2025-06-24 | 198.530 | 202.308 | 198.530 | 200.510 |
| 2025-06-25 | 199.520 | 202.536 | 199.504 | 200.702 |
| 2025-06-26 | 200.111 | 201.512 | 198.350 | 200.013 |
| 2025-06-27 | 200.062 | 202.089 | 198.887 | 200.426 |
| 2025-06-30 | 200.244 | 206.236 | 198.151 | 202.325 |
| 2025-07-01 | 201.285 | 209.020 | 201.285 | 206.549 |
| 2025-07-02 | 203.917 | 212.153 | 203.917 | 209.535 |
| 2025-07-03 | 206.726 | 213.455 | 206.726 | 211.854 |
| 2025-07-07 | 209.290 | 215.027 | 207.638 | 210.736 |
| 2025-07-08 | 210.013 | 210.253 | 207.290 | 208.829 |
| 2025-07-09 | 209.421 | 210.154 | 206.067 | 208.637 |
| 2025-07-10 | 209.029 | 212.292 | 208.861 | 210.430 |
| 2025-07-11 | 209.729 | 210.949 | 208.692 | 209.756 |
| 2025-07-14 | 209.743 | 209.743 | 206.385 | 208.085 |
| 2025-07-15 | 208.914 | 210.711 | 207.757 | 208.618 |
| 2025-07-16 | 208.766 | 211.218 | 207.479 | 209.204 |
| 2025-07-17 | 208.985 | 210.621 | 208.424 | 209.323 |
| 2025-07-18 | 209.154 | 210.611 | 208.533 | 209.711 |
| 2025-07-21 | 209.433 | 214.579 | 209.433 | 211.812 |
| 2025-07-22 | 210.622 | 213.754 | 210.622 | 212.491 |
| 2025-07-23 | 211.557 | 213.953 | 211.228 | 212.986 |
| 2025-07-24 | 212.271 | 214.490 | 212.271 | 213.028 |
| 2025-07-25 | 212.649 | 214.042 | 212.212 | 213.112 |
| 2025-07-28 | 212.881 | 213.654 | 211.874 | 212.806 |
| 2025-07-29 | 212.844 | 213.614 | 209.647 | 211.586 |
| 2025-07-30 | 212.215 | 212.215 | 206.564 | 209.095 |
| 2025-07-31 | 210.655 | 210.655 | 206.007 | 207.106 |
| 2025-08-01 | 208.880 | 212.391 | 200.379 | 205.930 |
| 2025-08-04 | 207.405 | 207.405 | 200.558 | 203.218 |
| 2025-08-05 | 205.311 | 205.311 | 201.035 | 202.323 |
| 2025-08-06 | 203.817 | 214.181 | 203.817 | 208.794 |
| 2025-08-07 | 206.305 | 219.621 | 206.305 | 217.866 |
| 2025-08-08 | 212.086 | 229.714 | 212.086 | 223.855 |
| 2025-08-11 | 217.970 | 228.542 | 217.970 | 226.346 |
| 2025-08-12 | 222.158 | 229.776 | 222.158 | 227.867 |
| 2025-08-13 | 225.013 | 233.957 | 225.013 | 231.426 |
| 2025-08-14 | 228.219 | 234.077 | 228.219 | 232.168 |
| 2025-08-15 | 230.194 | 233.240 | 228.322 | 231.272 |
| 2025-08-18 | 230.733 | 232.086 | 229.089 | 230.428 |
| 2025-08-19 | 230.580 | 231.837 | 228.332 | 229.990 |
| 2025-08-20 | 230.285 | 230.285 | 224.768 | 227.046 |
| 2025-08-21 | 228.665 | 228.665 | 222.787 | 224.368 |
| 2025-08-22 | 226.517 | 228.074 | 224.410 | 226.100 |
| 2025-08-25 | 226.308 | 228.283 | 225.226 | 226.284 |
| 2025-08-26 | 226.296 | 228.472 | 223.693 | 226.580 |
| 2025-08-27 | 226.438 | 229.875 | 226.438 | 228.547 |
| 2025-08-28 | 227.492 | 232.374 | 227.492 | 230.505 |
| 2025-08-29 | 228.999 | 232.345 | 228.999 | 231.319 |
| 2025-09-02 | 230.159 | 230.159 | 225.963 | 228.181 |
| 2025-09-03 | 229.170 | 237.790 | 229.170 | 236.170 |
| 2025-09-04 | 232.670 | 238.836 | 232.670 | 237.658 |
| 2025-09-05 | 235.164 | 240.249 | 235.164 | 238.811 |
| 2025-09-08 | 236.987 | 239.084 | 235.291 | 237.360 |
| 2025-09-09 | 237.173 | 237.721 | 232.325 | 234.826 |
| 2025-09-10 | 236.000 | 236.000 | 224.947 | 228.320 |
| 2025-09-11 | 232.160 | 232.160 | 225.644 | 227.489 |
| 2025-09-12 | 229.824 | 233.470 | 228.004 | 230.677 |
| 2025-09-15 | 230.251 | 237.133 | 230.251 | 235.680 |
| 2025-09-16 | 232.965 | 240.150 | 232.965 | 237.161 |
| 2025-09-17 | 235.063 | 239.035 | 235.063 | 237.887 |
| 2025-09-18 | 236.475 | 240.130 | 235.600 | 237.865 |
| 2025-09-19 | 237.170 | 245.207 | 237.170 | 242.231 |
| 2025-09-22 | 239.700 | 255.501 | 239.700 | 251.166 |
| 2025-09-23 | 245.433 | 256.198 | 245.433 | 254.175 |
| 2025-09-24 | 249.804 | 254.605 | 249.804 | 252.452 |
| 2025-09-25 | 251.128 | 256.029 | 250.593 | 253.610 |
| 2025-09-26 | 252.369 | 256.457 | 252.369 | 254.103 |
| 2025-09-29 | 253.236 | 253.869 | 251.887 | 253.122 |
| 2025-09-30 | 253.179 | 254.785 | 251.987 | 253.500 |
| 2025-10-01 | 253.339 | 257.642 | 253.339 | 254.916 |
| 2025-10-02 | 254.128 | 257.034 | 253.022 | 255.372 |
| 2025-10-03 | 254.750 | 258.090 | 252.823 | 255.332 |
| 2025-10-06 | 255.041 | 257.921 | 253.918 | 256.059 |
| 2025-10-07 | 255.550 | 256.258 | 254.297 | 255.392 |
| 2025-10-08 | 255.471 | 257.373 | 254.974 | 256.161 |
| 2025-10-09 | 255.816 | 256.855 | 252.017 | 254.613 |
| 2025-10-10 | 255.214 | 255.243 | 242.917 | 249.038 |
| 2025-10-13 | 252.126 | 252.126 | 244.470 | 246.972 |
| 2025-10-14 | 249.549 | 249.549 | 243.614 | 245.884 |
| 2025-10-15 | 247.717 | 250.703 | 246.372 | 248.423 |
| 2025-10-16 | 248.070 | 248.070 | 244.042 | 246.369 |
| 2025-10-17 | 247.220 | 252.256 | 246.173 | 249.130 |
| 2025-10-20 | 248.175 | 263.207 | 248.175 | 258.384 |
| 2025-10-21 | 253.279 | 264.113 | 253.279 | 261.776 |
| 2025-10-22 | 257.527 | 261.684 | 254.297 | 258.692 |
| 2025-10-23 | 258.110 | 259.464 | 256.865 | 258.386 |
| 2025-10-24 | 258.248 | 262.958 | 258.030 | 260.668 |
| 2025-10-27 | 259.458 | 267.926 | 259.458 | 265.681 |
| 2025-10-28 | 262.570 | 268.693 | 262.570 | 267.814 |
| 2025-10-29 | 265.192 | 270.206 | 265.192 | 268.180 |
| 2025-10-30 | 266.686 | 272.924 | 266.686 | 270.298 |
| 2025-10-31 | 268.492 | 276.090 | 267.966 | 272.247 |
| 2025-11-03 | 270.369 | 270.369 | 265.069 | 267.948 |
| 2025-11-04 | 269.159 | 270.285 | 266.433 | 268.175 |
| 2025-11-05 | 268.667 | 270.495 | 265.746 | 268.150 |
| 2025-11-06 | 268.408 | 272.187 | 266.701 | 268.541 |
| 2025-11-07 | 268.475 | 271.082 | 265.586 | 268.137 |
| 2025-11-10 | 268.306 | 272.780 | 266.531 | 268.958 |
| 2025-11-11 | 268.632 | 274.952 | 268.632 | 271.746 |
| 2025-11-12 | 270.189 | 274.773 | 270.189 | 273.024 |
| 2025-11-13 | 271.606 | 275.739 | 271.145 | 273.011 |
| 2025-11-14 | 272.309 | 275.002 | 268.664 | 271.310 |
| 2025-11-17 | 271.809 | 271.809 | 264.808 | 267.194 |
| 2025-11-18 | 269.502 | 269.770 | 264.399 | 267.433 |
| 2025-11-19 | 268.467 | 271.265 | 264.578 | 267.020 |
| 2025-11-20 | 267.744 | 274.474 | 264.997 | 268.671 |
| 2025-11-21 | 268.208 | 272.381 | 264.748 | 268.176 |
| 2025-11-24 | 268.192 | 276.038 | 268.192 | 272.730 |
| 2025-11-25 | 270.461 | 279.407 | 270.461 | 276.006 |
| 2025-11-26 | 273.233 | 278.560 | 273.233 | 276.704 |
| 2025-11-28 | 274.968 | 278.031 | 274.968 | 276.811 |
| 2025-12-01 | 275.889 | 282.436 | 275.181 | 279.195 |
| 2025-12-02 | 277.542 | 286.402 | 277.542 | 283.816 |
| 2025-12-03 | 280.679 | 287.618 | 280.679 | 284.576 |
| 2025-12-04 | 282.628 | 283.741 | 277.623 | 281.051 |
| 2025-12-05 | 281.839 | 281.839 | 277.085 | 278.657 |
| 2025-12-08 | 280.248 | 280.248 | 275.191 | 276.995 |
| 2025-12-09 | 278.622 | 279.058 | 275.959 | 277.107 |
| 2025-12-10 | 277.864 | 278.779 | 275.480 | 277.214 |
| 2025-12-11 | 277.539 | 278.619 | 272.859 | 276.669 |
| 2025-12-12 | 277.104 | 278.251 | 275.859 | 277.090 |
| 2025-12-15 | 277.097 | 279.177 | 271.893 | 275.851 |
| 2025-12-16 | 276.474 | 276.474 | 270.846 | 272.730 |
| 2025-12-17 | 274.602 | 275.201 | 270.697 | 272.712 |
| 2025-12-18 | 273.657 | 273.657 | 266.023 | 270.652 |
| 2025-12-19 | 272.155 | 273.647 | 268.963 | 271.634 |
| 2025-12-22 | 271.894 | 272.929 | 269.571 | 271.111 |
| 2025-12-23 | 271.502 | 271.554 | 268.624 | 270.373 |
| 2025-12-24 | 270.938 | 274.474 | 270.938 | 272.496 |
| 2025-12-26 | 271.717 | 274.414 | 271.717 | 272.996 |
| 2025-12-29 | 272.357 | 273.408 | 271.404 | 272.341 |
| 2025-12-30 | 272.349 | 273.128 | 271.335 | 272.115 |
| 2025-12-31 | 272.232 | 272.730 | 270.807 | 271.641 |
250 rows
Parameters
get_heikin_ashi 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”, in which case the open, high and low prices are adjusted for dividends in the same way. “Close” uses the candles as traded (split-adjusted). | "Close" |
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 Valcu, D. (2004). “Using the Heikin-Ashi Technique.” Technical Analysis of Stocks & Commodities, 22(2).
- Library Referenced against TA-Lib’s HA
- Library Shares similar logic as pandas-ta-classic’s ha