Skip to main content

Python implementation of Lorentzian Classification algorithm.

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

advanced_ta-0.1.8.tar.gz (12.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

advanced_ta-0.1.8-py3-none-any.whl (14.2 kB view details)

Uploaded Python 3

File details

Details for the file advanced_ta-0.1.8.tar.gz.

File metadata

  • Download URL: advanced_ta-0.1.8.tar.gz
  • Upload date:
  • Size: 12.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.0 CPython/3.11.5 Linux/6.6.10-76060610-generic

File hashes

Hashes for advanced_ta-0.1.8.tar.gz
Algorithm Hash digest
SHA256 c29194cae57de69baa340381bd73377a2c942b0f43c7895b550bdb0384a3647e
MD5 6bce88ad5fca1172874bfa939cc1ba00
BLAKE2b-256 0f7ee759cb4b729a915abf7bd8dae685945f45b61e608af71da47219295a21ca

See more details on using hashes here.

File details

Details for the file advanced_ta-0.1.8-py3-none-any.whl.

File metadata

  • Download URL: advanced_ta-0.1.8-py3-none-any.whl
  • Upload date:
  • Size: 14.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.0 CPython/3.11.5 Linux/6.6.10-76060610-generic

File hashes

Hashes for advanced_ta-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 e4f8a04d1b9b500c32fb70a55959af40b9cfa155e5d992bc4882e157d8d71312
MD5 15deae94307c0b392bbc0760d2ad89d0
BLAKE2b-256 a3aa9dec2c31848ae74d527b5712c895ca62e20b97349b575870579e820eb460

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page