GregoryMorse / trendln

Support and Resistance Trend lines Calculator for Financial Analysis
MIT License
663 stars 162 forks source link

ValueError: Accuracy order acc must be positive EVEN integer #31

Closed thistleknot closed 1 year ago

thistleknot commented 1 year ago

Minimal example produces this error. Python 3.10.x

import trendln

this will serve as an example for security or index closing prices, or low and high prices

import yfinance as yf # requires yfinance - pip install yfinance tick = yf.Ticker('^GSPC') # S&P500 hist = tick.history(period="max", rounding=True) h = hist[-1000:].Close mins, maxs = trendln.calc_support_resistance(h) minimaIdxs, pmin, mintrend, minwindows = trendln.calc_support_resistance((hist[-1000:].Low, None)) #support only mins, maxs = trendln.calc_support_resistance((hist[-1000:].Low, hist[-1000:].High)) (minimaIdxs, pmin, mintrend, minwindows), (maximaIdxs, pmax, maxtrend, maxwindows) = mins, maxs

thistleknot commented 1 year ago

I see this can be rectified within findiff's coef.py by modifying the if check for acc if ((acc % 2 == 1 or acc <= 0) and acc !=1):