# Incremental Technical Analysis indicators

**URL:** <https://discourse.julialang.org/t/incremental-technical-analysis-indicators/107844>\
**Category:** Finance and Economics\
**Created:** [December 20, 2023, 8:46am UTC](https://discourse.julialang.org/t/incremental-technical-analysis-indicators/107844 "2023-12-20T08:46:49Z")\
**Posts on this page:** 1\
**Showing post:** 12

<div class="post-metadata">

**Author:** ![FemtoTrader](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/femtotrader/32/309_2.png) [@FemtoTrader](https://discourse.julialang.org/u/FemtoTrader)\
**Post date:** [January 1, 2024, 5:09pm UTC](https://discourse.julialang.org/t/incremental-technical-analysis-indicators/107844/12 "2024-01-01T17:09:53Z")

</div>

Hi @g-gundam and all

I wish you an happy new year 2024 !  
Just a post to let you know the status of the lib

Here is a table showing current status of indicators porting

| Name | Description | Input | Output | Dependencies | Implementation status |
| --- | --- | --- | --- | --- | --- |
| `AccuDist` | Accumulation and Distribution | 🕯 | 🔢 | - | ✔ |
| `ADX` | Average Directional Index | 🕯 | Ⓜ | `ATR` | :heavy\_exclamation\_mark: Doesn’t work as expected - help wanted |
| `ALMA` | Arnaud Legoux Moving Average | 🔢 | 🔢 | `CircBuff` | ✔ |
| `AO` | Awesome Oscillator | 🕯 | 🔢 | `SMA` | ✔ |
| `Aroon` | Aroon Up/Down | 🕯 | Ⓜ | - | :heavy\_exclamation\_mark: Doesn’t work as expected - help wanted (need to search in reversed list in order to get the right-most index) |
| `ATR` | Average True Range | 🕯 | 🔢 | `CircBuff` | ✔ |
| `BB` | Bollinger Bands | 🔢 | Ⓜ | `SMA`, `StdDev` | ✔ |
| `BOP` | Balance Of Power | 🕯 | 🔢 | - | ✔ |
| `CCI` | Commodity Channel Index | 🕯 | 🔢 | `MeanDev` | ✔ |
| `ChaikinOsc` | Chaikin Oscillator | 🕯 | 🔢 | `AccuDist`, `EMA` | ✔ |
| `ChandeKrollStop` | Chande Kroll Stop | 🕯 | Ⓜ | `CircBuff`, `ATR` | ✔ |
| `CHOP` | Choppiness Index | 🕯 | 🔢 | `CirBuff`, `ATR` | :heavy\_exclamation\_mark: Doesn’t work as expected - help wanted |
| `CoppockCurve` | Coppock Curve | 🔢 | 🔢 | `ROC`, `WMA` | ✔ |
| `DEMA` | Double Exponential Moving Average | 🔢 | 🔢 | `EMA` | ✔ |
| `DonchianChannels` | Donchian Channels | 🕯 | Ⓜ | `CircBuff` | ✔ |
| `DPO` | Detrended Price Oscillator | 🔢 | 🔢 | `CircBuff`, `SMA` | ✔ |
| `EMA` | Exponential Moving Average | 🔢 | 🔢 | `CircBuff` | ✔ |
| `EMV` | Ease of Movement | 🕯 | 🔢 | `CircBuff`, `SMA` | ✔ |
| `FibRetracement` | Fibonacci Retracement | ❓ | ❓ | | doesn’t look an indicator just a simple class with 236 382 5 618 786 values |
| `ForceIndex` | Force Index | 🕯 | 🔢 | prev input val, `EMA` | ✔ |
| `HMA` | Hull Moving Average | 🔢 | 🔢 | `WMA` | ✔ |
| `Ichimoku` | Ichimoku Clouds | 🔢 | Ⓜ | `CircBuff` | 5 managed sequences ❓ unit tests doesn’t exists in [reference implementation](https://github.com/nardew/talipp/issues/87) |
| `KAMA` | Kaufman’s Adaptive Moving Average | 🔢 | 🔢 | `CircBuff` | ✔ |
| `KeltnerChannels` | Keltner Channels | 🕯 | Ⓜ | `ATR`, `EMA` with `input_modifier` to extract close value of a candle | ✔ |
| `KST` | Know Sure Thing | 🔢 | Ⓜ | `SMA` | :heavy\_exclamation\_mark: Doesn’t work as expected - help wanted |
| `KVO` | Klinger Volume Oscillator | 🕯 | 🔢 | `EMA` | ✔ |
| `MACD` | Moving Average Convergence Divergence | 🔢 | Ⓜ | `EMA` | ✔ |
| `MassIndex` | Mass Index | 🕯 | 🔢 | `EMA`, `CircBuff` | ✔ |
| `McGinleyDynamic` | McGinley Dynamic | 🔢 | 🔢 | `CircBuff` | ✔ |
| `MeanDev` | Mean Deviation | 🔢 | 🔢 | `CircBuff`, `SMA` | ✔ |
| `OBV` | On Balance Volume | 🕯 | 🔢 | prev input val | ✔ |
| `ParabolicSAR` | Parabolic Stop And Reverse | 🕯 | Ⓜ | `CirBuff` | ✔ |
| `PivotsHL` | High/Low Pivots | 🕯 | Ⓜ | `-` | 🚧 unit tests in reference implementation are [missing](https://github.com/nardew/talipp/issues/85). |
| `ROC` | Rate Of Change | 🔢 | 🔢 | `CircBuff` | ✔ |
| `RSI` | Relative Strength Index | 🔢 | 🔢 | `CircBuff`, `SMMA` | ✔ |
| `SFX` | SFX | 🕯 | Ⓜ | `ATR`, `StdDev`, `SMA` and `input_modifier` (to extract `close`) | ✔ |
| `SMA` | Simple Moving Average | 🔢 | 🔢 | `CircBuff` | ✔ |
| `SMMA` | Smoothed Moving Average | 🔢 | 🔢 | `CircBuff` | ✔ |
| `SOBV` | Smoothed On Balance Volume | 🕯 | 🔢 | `OBV`, `SMA` | ✔ |
| `STC` | Schaff Trend Cycle | 🔢 | 🔢 | `MACD`, `Stoch` with `input_modifier` (MACDVal-\>OHLCV and stoch\_d-\>OHLCV), indicator chaining, `MAFactory` (default `SMA`) | ✔ |
| `StdDev` | Standard Deviation | 🔢 | 🔢 | `CircBuff` | ✔ |
| `Stoch` | Stochastic | 🕯 | Ⓜ | `CircBuff`, `SMA` | ✔ [🎄](https://discourse.julialang.org/t/incremental-technical-analysis-indicators/107844/5) |
| `StochRSI` | Stochastic RSI | 🔢 | Ⓜ | `RSI`, `SMA` | ✔ |
| `SuperTrend` | Super Trend | 🕯 | Ⓜ | `CircBuff`, `ATR` | :heavy\_exclamation\_mark: Doesn’t work as expected - help wanted |
| `T3` | T3 Moving Average | 🔢 | 🔢 | `EMA` with indicator chaining and input filter | ✔ |
| `TEMA` | Triple Exponential Moving Average | 🔢 | 🔢 | `EMA` | ✔ |
| `TRIX` | TRIX | 🕯 | Ⓜ | `EMA`, indicator chaining | ✔ |
| `TSI` | True Strength Index | 🔢 | 🔢 | `EMA`, indicator chaining | ✔ |
| `TTM` | TTM Squeeze | 🕯 | Ⓜ | `SMA`, `BB`, `DonchianChannels`, `KeltnerChannels` and `input_modifier` to extract `close` value of a candle | ✔ |
| `UO` | Ultimate Oscillator | 🕯 | 🔢 | `CircBuff` | ✔ |
| `VTX` | Vortex Indicator | 🕯 | Ⓜ | `CircBuff`, `ATR` | :heavy\_exclamation\_mark: Doesn’t work as expected - help wanted |
| `VWAP` | Volume Weighted Average Price | 🕯 | 🔢 | - | ✔ |
| `VWMA` | Volume Weighted Moving Average | 🕯 | 🔢 | `CircBuff` | ✔ |
| `WMA` | Weighted Moving Average | 🔢 | 🔢 | `CircBuff` | ✔ |
| `ZLEMA` | Zero Lag Exponential Moving Average | 🔢 | 🔢 | `EMA` | ✔ |

We have now 52 technical indicators.

As you can see `StochRSI` (and many others indicators have been) implemented.  
We have now a mechanism for indicator chaining.

What is indicator chaining?

Indicator chaining is like using Lego blocks to create unique combinations. When you chain indicators together, output of one indicator is the input of the following indicator.

`T3` for example is composed of 6 `EMA` (Exponential Moving Average) which are chained

> **[T3 Moving Average Indicator](https://www.tradingpedia.com/forex-trading-indicators/t3-moving-average-indicator/)**
>
> The T3 Moving Average is considered superior to traditional MAs as it is smoother, more responsive and thus performs better in ranging market conditions as well.

So by chaining them you can replace code like

```julia

function _calculate_new_value(ind::T3)
    _ema1 = value(ind.ema1)
    if !ismissing(_ema1)
        fit!(ind.ema2, value(ind.ema1))
        _ema2 = value(ind.ema2)
        if !ismissing(_ema2)
            fit!(ind.ema3, _ema2)
            _ema3 = value(ind.ema3)
            if !ismissing(_ema3)
                fit!(ind.ema4, _ema3)
                _ema4 = value(ind.ema4)
                if !ismissing(_ema4)
                    fit!(ind.ema5, _ema4)
                    _ema5 = value(ind.ema5)
                    if !ismissing(_ema5)
                        fit!(ind.ema6, _ema5)
                    end
                end
            end
        end
    end

    if has_output_value(ind.ema6)
        return ind.c1 * value(ind.ema6) +
               ind.c2 * value(ind.ema5) +
               ind.c3 * value(ind.ema4) +
               ind.c4 * value(ind.ema3)
    else
        return missing
    end
end

```

by something much simpler such as

```julia

function _calculate_new_value(ind::T3)
    if has_output_value(ind.ema6)
        return ind.c1 * value(ind.ema6) +
               ind.c2 * value(ind.ema5) +
               ind.c3 * value(ind.ema4) +
               ind.c4 * value(ind.ema3)
    else
        return missing
    end
end

```

See [T3 code](https://github.com/femtotrader/IncTA.jl/blob/main/src/indicators/T3.jl)

We also have now a input\_filter/input\_modifier functions for every indicators so we can for example feed a SISO indicator (single input single output) with candle data (OHLCV) when passing also an input\_modifier function which take for example close price of a candle.

A good example of indicator which use such a mechanism is `TTM` (probably the most complex indicator I have implemented currently)

[https://school.stockcharts.com/doku.php?id=technical\_indicators:ttm\_squeeze](https://school.stockcharts.com/doku.php?id=technical_indicators:ttm_squeeze)

`TTM` uses `BB` (Bollinger Bands), `DonchianChannels`, `KeltnerChannels` and a moving average (`SMA` by default but any other moving average can be used thanks to a moving average factory (`MAFactory`))

See [TTM Squeeze code](https://github.com/femtotrader/IncTA.jl/blob/main/src/indicators/TTM.jl)

Here is status of unit tests

```julia
Precompiling project...
  1 dependency successfully precompiled in 5 seconds. 45 already precompiled.
     Testing Running tests...
┌ Warning: WIP - buggy
└ @ IncTA C:\Users\femto\.julia\dev\IncTA\src\indicators\KST.jl:72
┌ Warning: WIP - buggy
└ @ IncTA C:\Users\femto\.julia\dev\IncTA\src\indicators\CHOP.jl:32
┌ Warning: WIP - buggy
└ @ IncTA C:\Users\femto\.julia\dev\IncTA\src\indicators\ADX.jl:49
┌ Warning: WIP - buggy
└ @ IncTA C:\Users\femto\.julia\dev\IncTA\src\indicators\SuperTrend.jl:45
┌ Warning: WIP - buggy
└ @ IncTA C:\Users\femto\.julia\dev\IncTA\src\indicators\VTX.jl:39
┌ Warning: WIP - buggy
└ @ IncTA C:\Users\femto\.julia\dev\IncTA\src\indicators\Aroon.jl:31
Test Summary: | Pass Broken Total Time
IncTA.jl | 788 6 794 29.2s
     Testing IncTA tests passed

```

So we still have some indicators which doesn’t behave like reference implementation (`talipp`). I must admit that I haven’t searched quite a long time on each… but enough to lose patience.

If some of you want to have a look, PR are welcome ! I think a good way to fix this could be to install latest development version of talipp (v2.x) and do some “print debugging” on internal state of indicator

Doc also need to be improved (and published !).

This project is not really complex but very time consuming given the number of indicators which are reimplemented in pure Julia (contrary to [TALib.j](https://github.com/femtotrader/TALib.jl) which was a wrapper around C library [talib](https://ta-lib.org/) !

My hope will be to have this lib used by some others (especially those who are building [backtesters](https://discourse.julialang.org/t/backtesting-framework/47351))

---

_[View the full topic](https://discourse.julialang.org/t/incremental-technical-analysis-indicators/107844)._
