KFI MicroPython Scripts

Started by Pallas_Boreas, 2026-Aug-27, 04:07:10

Previous topic - Next topic

Pallas_Boreas

These scripts should work on any relatively recent device that has MicroPython of at least version 1.9.4, equivalent too Python 3.8, and maybe older since it uses only core features and simple logic with the standard math library being the only import. They will also work on the full Python.

I wanted a portable, quick, way to calculate the KFI on my calculator. It also serves as a reference on the steps involved.

kfi(.py) will ask for the length of the look back period/candles (n=*) and then the necessary values and then output them and the derivatives Dv, Cr, and F. n between 3 & 5 is optimal before lag starts to be introduced in the denominator Eta and D in the numerator, being more significant for Eta then D because it is in the denominator. If looking over a long period say daily or weekly then the increased lag won't matter.

Included is a complimentary script that prints the information of m_divisor, asset class, and phase thresholds.

I wrote it on the Casio fx-CG100 graphing calculator, MicroPython 1.9.4. Also tested on Python 3.14.6, ipython 9.16.1 on Linux with Positron IDE.

For a zipped file and the possibility to tip they can also be downloaded at: https://ko-fi.com/s/216efb3532.
You can support Polar Sun Research at https://ko-fi.com/psr.

Pallas_Boreas

There is a background story of the equation at the Polar Sun Research SubstackCoffee Rings, Markets, Pencils, Mathematics, Physics, And Capital Flows.
You can support Polar Sun Research at https://ko-fi.com/psr.

Pallas_Boreas

#2
The original kfi(.py) with n=5 is now here renamed kfi0(.py).
You can support Polar Sun Research at https://ko-fi.com/psr.