# Technical Analysis Calculator (`ozito/technical-analysis-calculator`) Actor

It receives market data (Open, High, Low, Close, Volume) and a list of technical indicators to calculate. It returns the enriched data as a list, where each data point contains the original OHLCV values as well as the calculated indicator values.

- **URL**: https://apify.com/ozito/technical-analysis-calculator.md
- **Developed by:** [Kal](https://apify.com/ozito) (community)
- **Categories:** Automation, Other
- **Stats:** 4 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 1,000 result items

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Technical Analysis Calculator (TA-Lib)

This Actor calculates technical indicators on OHLCV (Open, High, Low, Close, Volume) data using the [TA-Lib](https://ta-lib.org/) library. It is designed to be used as a utility calculator within larger workflows or for data enrichment.

### Features

- **Dynamic Indicators**: Supports calculation of standard TA-Lib indicators (SMA, RSI, MACD, Bollinger Bands, etc.).
- **Python Powered**: Built with Python and `ta-lib-python`.
- **Flexible Input**: Accepts JSON data arrays.

### Input Usage

The Actor accepts a JSON object with two main fields:

- `data`: An object containing arrays for `open`, `high`, `low`, `close`, and optionally `volume`. All arrays must be of the same length.
- `indicators`: A list of objects defining which indicators to calculate and their parameters.

#### Example Input

```json
{
    "data": {
        "open": [1.1, 1.2, 1.3, 1.2, 1.4],
        "high": [1.5, 1.6, 1.7, 1.6, 1.8],
        "low": [1.0, 1.1, 1.2, 1.1, 1.3],
        "close": [1.2, 1.5, 1.4, 1.6, 1.7],
        "volume": [100, 200, 150, 300, 250]
    },
    "indicators": [
        {
            "name": "SMA",
            "params": {
                "timeperiod": 3
            }
        },
        {
            "name": "RSI",
            "params": {
                "timeperiod": 3
            }
        },
        {
            "name": "BBANDS",
            "params": {
                "timeperiod": 3,
                "nbdevup": 2,
                "nbdevdn": 2,
                "matype": 0
            }
        }
    ]
}
```

### Output

The Actor outputs the original data enriched with the calculated indicators. The output is stored in the default dataset.

#### Example Output Item

```json
{
    "open": 1.4,
    "high": 1.8,
    "low": 1.3,
    "close": 1.7,
    "volume": 250,
    "SMA": 1.566,
    "RSI": 75.5,
    "BBANDS_upperband": 1.8,
    "BBANDS_middleband": 1.566,
    "BBANDS_lowerband": 1.33
}
```

### Supported Indicators

This Actor supports functions available in the `talib.abstract` API. Common indicators include:

- **Overlap Studies**: SMA, EMA, WMA, BBANDS, SAR
- **Momentum**: RSI, MACD, STOCH, ADX, MOM
- **Volume**: AD, OBV
- **Volatility**: ATR, NATR
- **Pattern Recognition**: CDLDOJI, CDLHAMMER, etc.

Ensure that the `name` field in your input matches the TA-Lib function name (case-insensitive usually, but uppercase recommended).

# Actor input Schema

## `data` (type: `object`):

Object containing arrays for open, high, low, close, volume.

## `indicators` (type: `array`):

List of indicators to calculate.

## Actor input object example

```json
{
  "data": {
    "open": [
      150,
      152.5,
      151,
      153.5,
      155,
      154,
      156,
      158.5,
      157,
      159
    ],
    "high": [
      153,
      154,
      153.5,
      156,
      157,
      156.5,
      159,
      160,
      159.5,
      162
    ],
    "low": [
      149,
      151,
      150,
      152,
      153.5,
      152.5,
      154.5,
      157,
      156,
      158
    ],
    "close": [
      152,
      151.5,
      153,
      154.5,
      154,
      155.5,
      158,
      157.5,
      159,
      161.5
    ],
    "volume": [
      1000,
      1200,
      1100,
      1300,
      1250,
      1400,
      1500,
      1450,
      1600,
      1550
    ]
  },
  "indicators": [
    {
      "name": "SMA",
      "params": {
        "timeperiod": 3
      }
    },
    {
      "name": "RSI",
      "params": {
        "timeperiod": 14
      }
    }
  ]
}
```

# Actor output Schema

## `overview` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "data": {
        "open": [
            150,
            152.5,
            151,
            153.5,
            155,
            154,
            156,
            158.5,
            157,
            159
        ],
        "high": [
            153,
            154,
            153.5,
            156,
            157,
            156.5,
            159,
            160,
            159.5,
            162
        ],
        "low": [
            149,
            151,
            150,
            152,
            153.5,
            152.5,
            154.5,
            157,
            156,
            158
        ],
        "close": [
            152,
            151.5,
            153,
            154.5,
            154,
            155.5,
            158,
            157.5,
            159,
            161.5
        ],
        "volume": [
            1000,
            1200,
            1100,
            1300,
            1250,
            1400,
            1500,
            1450,
            1600,
            1550
        ]
    },
    "indicators": [
        {
            "name": "SMA",
            "params": {
                "timeperiod": 3
            }
        },
        {
            "name": "RSI",
            "params": {
                "timeperiod": 14
            }
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("ozito/technical-analysis-calculator").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "data": {
        "open": [
            150,
            152.5,
            151,
            153.5,
            155,
            154,
            156,
            158.5,
            157,
            159,
        ],
        "high": [
            153,
            154,
            153.5,
            156,
            157,
            156.5,
            159,
            160,
            159.5,
            162,
        ],
        "low": [
            149,
            151,
            150,
            152,
            153.5,
            152.5,
            154.5,
            157,
            156,
            158,
        ],
        "close": [
            152,
            151.5,
            153,
            154.5,
            154,
            155.5,
            158,
            157.5,
            159,
            161.5,
        ],
        "volume": [
            1000,
            1200,
            1100,
            1300,
            1250,
            1400,
            1500,
            1450,
            1600,
            1550,
        ],
    },
    "indicators": [
        {
            "name": "SMA",
            "params": { "timeperiod": 3 },
        },
        {
            "name": "RSI",
            "params": { "timeperiod": 14 },
        },
    ],
}

# Run the Actor and wait for it to finish
run = client.actor("ozito/technical-analysis-calculator").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "data": {
    "open": [
      150,
      152.5,
      151,
      153.5,
      155,
      154,
      156,
      158.5,
      157,
      159
    ],
    "high": [
      153,
      154,
      153.5,
      156,
      157,
      156.5,
      159,
      160,
      159.5,
      162
    ],
    "low": [
      149,
      151,
      150,
      152,
      153.5,
      152.5,
      154.5,
      157,
      156,
      158
    ],
    "close": [
      152,
      151.5,
      153,
      154.5,
      154,
      155.5,
      158,
      157.5,
      159,
      161.5
    ],
    "volume": [
      1000,
      1200,
      1100,
      1300,
      1250,
      1400,
      1500,
      1450,
      1600,
      1550
    ]
  },
  "indicators": [
    {
      "name": "SMA",
      "params": {
        "timeperiod": 3
      }
    },
    {
      "name": "RSI",
      "params": {
        "timeperiod": 14
      }
    }
  ]
}' |
apify call ozito/technical-analysis-calculator --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=ozito/technical-analysis-calculator",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/wppFLWhioDI0tKAOr/builds/dvKMVPaont6PnSO39/openapi.json
