Skip to main content

This module is a python implementation of Lorentzian Classification algorithm developed by @jdehorty in pinescript. The original work can be found here - https://www.tradingview.com/script/WhBzgfDu-Machine-Learning-Lorentzian-Classification/

Usage

At the most simplest, you can just do this:

from advanced_ta import LorentzianClassification
.
.
    # df here is the dataframe containing stock data as [['open', 'high', 'low', 'close', 'volume']]. Notice that the column names are in lower case.
    lc = LorentzianClassification(df)
    lc.dump('output/result.csv')
    lc.plot('output/result.jpg')
.
.

For advanced use, you can do:

from advanced_ta import LorentzianClassification
from ta.volume import money_flow_index as MFI
.
.
    # df here is the dataframe containing stock data as [['open', 'high', 'low', 'close', 'volume']]. Notice that the column names are in lower case.
    lc = LorentzianClassification(
        df,
        features=[
            LorentzianClassification.Feature("RSI", 14, 2),  # f1
            LorentzianClassification.Feature("WT", 10, 11),  # f2
            LorentzianClassification.Feature("CCI", 20, 2),  # f3
            LorentzianClassification.Feature("ADX", 20, 2),  # f4
            LorentzianClassification.Feature("RSI", 9, 2),   # f5
            MFI(df['open'], df['high'], df['low'], df['close'], df['volume'], 14) #f6
        ],
        settings=LorentzianClassification.Settings(
            source='close',
            neighborsCount=8,
            maxBarsBack=2000,
            useDynamicExits=False
        ),
        filterSettings=LorentzianClassification.FilterSettings(
            useVolatilityFilter=True,
            useRegimeFilter=True,
            useAdxFilter=False,
            regimeThreshold=-0.1,
            adxThreshold=20,
            kernelFilter = LorentzianClassification.KernelFilter(
                useKernelSmoothing = False
                lookbackWindow = 8
                relativeWeight = 8.0
                regressionLevel = 25
                crossoverLag = 2
            )
        ))
    lc.dump('output/result.csv')
    lc.plot('output/result.jpg')
.
.

Sample Plot

Generated

generated

Reference From TradingView

reference

Version History

0.1.8

  • Replacing dependency on TA-Lib with ta to simplify setup

Metadata

Release files for advanced-ta 0.1.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for advanced-ta 0.1.8
File Size Uploaded
advanced_ta-0.1.8.tar.gz 12.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for advanced-ta 0.1.8
File Interpreter ABI Platform
advanced_ta-0.1.8-py3-none-any.whl Python 3 none any Details

Total release size: 27.1 kB

Release files / advanced_ta-0.1.8.tar.gz

Download URL advanced_ta-0.1.8.tar.gz
Size 12.9 kB
Tags Source
SHA-256 checksum
How to use checksums
c29194cae57de69baa340381bd73377a2c942b0f43c7895b550bdb0384a3647e
BLAKE2b-256 checksum
How to use checksums
0f7ee759cb4b729a915abf7bd8dae685945f45b61e608af71da47219295a21ca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.0 CPython/3.11.5 Linux/6.6.10-76060610-generic

Release files / advanced_ta-0.1.8-py3-none-any.whl

Download URL advanced_ta-0.1.8-py3-none-any.whl
Size 14.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e4f8a04d1b9b500c32fb70a55959af40b9cfa155e5d992bc4882e157d8d71312
BLAKE2b-256 checksum
How to use checksums
a3aa9dec2c31848ae74d527b5712c895ca62e20b97349b575870579e820eb460
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.0 CPython/3.11.5 Linux/6.6.10-76060610-generic

Release history Release notifications | RSS feed

This release

0.1.8 This release

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page