About this project

Techan is a Go library for analyzing financial market data and building trading-decision logic. Its core model uses chronological time series made up of candles containing open, close, high, low and volume values. The library includes basic and advanced technical-analysis indicators, including moving averages, MACD, RSI, Bollinger Bands and windowed standard deviation, along with helpers for determining when an indicator has enough data to be valid. Indicators can be composed around price inputs. Windowed indicators return zero until their first complete window is available, and the library documents warm-up behavior such as MACD signal availability and RSI seeding. EMA and MMA calculations use cached, high-precision values rather than narrowing prices to float64. When candles are modified, indicator caches can be reset from a specified index; callers must serialize shared indicator access across goroutines. Techan also supports strategy construction through entry and exit rules. Available rules include upward and downward crossover rules, position-state rules, and logical combinations such as And. A RuleStrategy can define an unstable period during which entries and exits are suppressed. Trading records can be passed to strategy methods and used with analysis tools. Analysis features cover long and short positions, percentage gain, period profit, buy-and-hold comparison, and maximum drawdown. The documented percentage-gain calculation uses the first closed position's entry cost as initial capital and does not model deposits, withdrawals or fees. The project is installed with go get github.com/sdcoffey/techan, requires Go 1.21 or newer, and includes tests, benchmarks, formatting, linting and fuzz targets. It is influenced by ta4j and released under the MIT license.