> ## Documentation Index
> Fetch the complete documentation index at: https://takeprofit.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Compute indicator values

> Provide `exchange`, `symbol`, and `timeframe`. Nothing else is required:
the indicator runs with its default parameters over the last 1000 bars.

- With `from` the window starts there and runs forward, ending at `to`,
  after `period` seconds, or after `limit` bars (1000 by default).
- Without `from` the window ends at `to` (now by default) and runs
  backwards over `limit` bars (1000 by default) or `period` seconds.
- `period` and `limit` cannot be used together, and neither can be added
  to an explicit `from`+`to` window.
- A time window is limited to at most 10000 estimated bars; a wider one
  is rejected with 400 `too_much_data`. The estimate assumes the market
  trades around the clock, so on a security with trading sessions use
  `limit` for a long stretch of history.
- At most the 10000 most recent bars are computed. A window that starts
  before them is answered from what was computed, with
  `historyComplete: false`.
- Tick timeframes (`1t`, `50t`, ...) accept only `limit`: tick bars have
  no fixed duration, so `from`, `to` and `period` are rejected with 400.
- Pass indicator parameters as `param.<id>`; see `/api/v1/indicators/{uid}`
  for the ids, types and ranges. Unknown ids and out-of-range values are
  rejected with 400.
- `outputs` restricts the returned outputs to the listed ids.

**Cost:** 2000 credits for a window of up to 5000 bars, 4000 up to 10000
bars, or 2 credits per returned bar if that is more.




## OpenAPI

````yaml /platform-api/specs/indicators-openapi.yaml get /api/v1/indicators/{uid}/values
openapi: 3.0.3
info:
  title: TakeProfit API (Indicators, REST)
  version: 0.2.0
  contact:
    email: support@takeprofit.com
  description: >
    Technical indicators computed on TakeProfit market data, over REST. Live

    updates are served over WebSocket and described by the AsyncAPI document at

    `https://public-api.takeprofit.com/api/v1/indicators/asyncapi.yaml`.

    Securities, candles and the exchange catalog are served by the marketdata

    part of the same API (`/api/v1/marketdata/...`) with the same API key.

    Guides (getting an API key, credits and quota, errors) live at

    [takeprofit.com/docs](https://takeprofit.com/docs).


    ## Requests


    - Base URL: `https://public-api.takeprofit.com`.

    - Every endpoint answers `GET` only.

    - Authenticate with the `x-api-key` header; exactly one header value is
      required. The key needs the `indicator:all:read` scope; tick it next
      to `marketdata:all:read` when creating the token to use one key for
      both parts of the API. A key without it is answered with 403.
    - Unknown query parameters and repeated scalar parameters are rejected
      with 400.
    - Identify securities with `exchange` and `symbol` as returned by
      `/api/v1/marketdata/exchanges/{exchange}/securities`; internal ids and
      GUIDs are not accepted.
    - Identify indicators with their `uid` (or the `slug` of a built-in
      indicator) as returned by `/api/v1/indicators`. Pin `version` in
      production: without it the latest published version is used.
    - Your own indicators and the ones you bought in the marketplace are
      served by their platform `uid`, with `version` required: they are not in
      the list. Any uid your account cannot run is answered with 404.
    - Indicator parameters are passed as `param.<id>` query parameters, where
      `<id>` and the accepted type, range and options are listed by
      `/api/v1/indicators/{uid}`. Omitted parameters take the indicator's
      defaults; the response echoes the resolved values in `meta.params`.

    ## Credits and quota


    Requests are metered in credits against the quota window of 100000

    credits per 60 seconds, shared by all API keys of the account and with the

    marketdata endpoints. Each operation states its price. Computing an

    indicator costs at least the price of its history depth (2000 credits for

    windows up to 5000 bars, 4000 up to 10000 bars), or 2 credits per returned

    bar if that is more; catalog operations cost 1000 credits. Every

    authenticated response carries the window state:


    - `X-RateLimit-Limit` - credits per window;

    - `X-RateLimit-Remaining` - credits still available after this request;

    - `X-RateLimit-Reset` - epoch second the window resets at.


    A request the remaining credits cannot cover is rejected with 429 and

    `Retry-After` (seconds until the window resets); the rejection itself is

    free. Only a successful response is billed: a script failure (422), a

    timeout (504), a cancelled request (408), an unavailable upstream (503)

    and a rejected request (4xx) cost nothing.


    ## Bars


    Every computed bar carries `closed`. The last bar of a window is usually

    still forming (`closed: false`): its values change until the bar closes.

    Use `closed: true` bars for signals. A value that an indicator has not

    produced yet (warm-up period, or an output without a value on that bar) is

    absent from `values` rather than null.


    ## Errors


    Every error response is `{"error": {"code": "<stable code>", "message":

    "<human-readable text>"}}`. The statuses listed on each operation (400,

    401, 403, 404, 422, 429) are the outcomes a client handles explicitly. A

    400 is either `invalid_argument` (a malformed request or parameter) or

    `too_much_data`: the request produces more data than can be served in one

    response, and only a narrower window fixes it - it is never a rate limit.

    A 422 is `script_error`: the indicator script failed to compile, raised

    an error or exceeded the worker's computation time limit. In addition, any
    operation can answer 502 (`bad_gateway`), 503

    (`unavailable`) or 504 (`deadline_exceeded`) while the gateway or an

    upstream is unavailable or slow; these are transient - retry with

    exponential backoff and honour `Retry-After` when present.
servers:
  - url: https://public-api.takeprofit.com
    description: Production
security: []
paths:
  /api/v1/indicators/{uid}/values:
    get:
      tags:
        - Values
      summary: Compute indicator values
      description: >
        Provide `exchange`, `symbol`, and `timeframe`. Nothing else is required:

        the indicator runs with its default parameters over the last 1000 bars.


        - With `from` the window starts there and runs forward, ending at `to`,
          after `period` seconds, or after `limit` bars (1000 by default).
        - Without `from` the window ends at `to` (now by default) and runs
          backwards over `limit` bars (1000 by default) or `period` seconds.
        - `period` and `limit` cannot be used together, and neither can be added
          to an explicit `from`+`to` window.
        - A time window is limited to at most 10000 estimated bars; a wider one
          is rejected with 400 `too_much_data`. The estimate assumes the market
          trades around the clock, so on a security with trading sessions use
          `limit` for a long stretch of history.
        - At most the 10000 most recent bars are computed. A window that starts
          before them is answered from what was computed, with
          `historyComplete: false`.
        - Tick timeframes (`1t`, `50t`, ...) accept only `limit`: tick bars have
          no fixed duration, so `from`, `to` and `period` are rejected with 400.
        - Pass indicator parameters as `param.<id>`; see
        `/api/v1/indicators/{uid}`
          for the ids, types and ranges. Unknown ids and out-of-range values are
          rejected with 400.
        - `outputs` restricts the returned outputs to the listed ids.


        **Cost:** 2000 credits for a window of up to 5000 bars, 4000 up to 10000

        bars, or 2 credits per returned bar if that is more.
      operationId: listIndicatorValues
      parameters:
        - name: uid
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/IndicatorUid'
        - name: version
          in: query
          required: false
          schema:
            $ref: '#/components/schemas/IndicatorVersion'
        - name: exchange
          in: query
          required: true
          schema:
            $ref: '#/components/schemas/ExchangeCode'
        - name: symbol
          in: query
          required: true
          schema:
            $ref: '#/components/schemas/SecuritySymbol'
        - name: timeframe
          in: query
          required: true
          schema:
            $ref: '#/components/schemas/TimeframeId'
        - name: from
          in: query
          required: false
          description: >-
            Window start as Unix seconds or RFC3339 timestamp. Without it the
            window is measured backwards from to. Not available on tick
            timeframes.
          schema:
            $ref: '#/components/schemas/TimestampQuery'
        - name: to
          in: query
          required: false
          description: Window end, greater than from. Defaults to now when from is omitted.
          schema:
            $ref: '#/components/schemas/TimestampQuery'
        - name: period
          in: query
          required: false
          description: >-
            Window duration in seconds, counted forward from from or backwards
            from to. Not supported for tick timeframes.
          schema:
            type: integer
            format: int64
            minimum: 1
        - name: limit
          in: query
          required: false
          description: >-
            Bar count, counted forward from from or backwards from to. Defaults
            to 1000.
          schema:
            type: integer
            minimum: 1
            maximum: 10000
        - name: sessionType
          in: query
          required: false
          description: >-
            Optional session filter. Repeat this parameter or pass
            comma-separated values. Defaults to all sessions.
          style: form
          explode: true
          schema:
            type: array
            items:
              type: string
        - name: outputs
          in: query
          required: false
          description: >-
            Comma-separated output ids to return. Defaults to every output that
            has values.
          schema:
            type: string
      responses:
        '200':
          description: Computed bars.
          headers:
            X-RateLimit-Limit:
              $ref: '#/components/headers/RateLimitLimit'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/RateLimitRemaining'
            X-RateLimit-Reset:
              $ref: '#/components/headers/RateLimitReset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValuesResponse'
              example:
                meta:
                  uid: line_0
                  slug: simple_moving_average
                  version: 9
                  exchange: CXBNCE
                  symbol: BTC/USDT
                  timeframe: 5m
                  params:
                    length: 9
                    src: close
                    offset: 0
                  outputs:
                    - line_0
                bars:
                  - timestamp: '2026-10-06T09:55:00Z'
                    closed: true
                    values:
                      line_0: 123456.78
                  - timestamp: '2026-10-06T10:00:00Z'
                    closed: false
                    values:
                      line_0: 123470.12
                hasMoreBefore: true
                historyComplete: false
        '400':
          $ref: '#/components/responses/InvalidRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/ScriptError'
        '429':
          $ref: '#/components/responses/RateLimited'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    IndicatorUid:
      type: string
      pattern: ^[A-Za-z0-9_-]{1,64}$
      description: Indicator uid, or the slug of a built-in indicator.
      example: sma
    IndicatorVersion:
      type: integer
      minimum: 1
      description: |
        Indicator version (major). Defaults to the latest published version of
        a built-in indicator; required for your own and bought indicators.
      example: 3
    ExchangeCode:
      type: string
      description: TakeProfit exchange code from /api/v1/marketdata/exchanges.
      example: CXBNCE
    SecuritySymbol:
      type: string
      description: >-
        TakeProfit security symbol from
        /api/v1/marketdata/exchanges/{exchange}/securities.
      example: BTC/USDT
    TimeframeId:
      type: string
      description: >-
        Timeframe id from /api/v1/indicators/timeframes (count plus unit; units
        t, s, m, h, d, w, M, Q, y).
      example: 5m
    TimestampQuery:
      type: string
      description: Unix seconds or an RFC3339 timestamp.
    ValuesResponse:
      type: object
      required:
        - meta
        - bars
        - hasMoreBefore
        - historyComplete
      properties:
        meta:
          $ref: '#/components/schemas/ValuesMeta'
        bars:
          type: array
          items:
            $ref: '#/components/schemas/Bar'
        hasMoreBefore:
          type: boolean
          description: True when older bars exist within the computed history.
        historyComplete:
          type: boolean
          description: >-
            True when the window lies within the computed history: a computed
            bar precedes it, or the computed history holds everything the
            exchange has. False means the window starts before the oldest
            computed bar and the computed history is full: only the most recent
            10000 bars are computed, so the window was cut there. Always true
            for a last-N window.
    ValuesMeta:
      type: object
      required:
        - uid
        - version
        - exchange
        - symbol
        - timeframe
        - params
        - outputs
      properties:
        uid:
          type: string
        slug:
          type: string
        version:
          $ref: '#/components/schemas/IndicatorVersion'
        exchange:
          $ref: '#/components/schemas/ExchangeCode'
        symbol:
          $ref: '#/components/schemas/SecuritySymbol'
        timeframe:
          $ref: '#/components/schemas/TimeframeId'
        params:
          type: object
          additionalProperties: true
          description: Resolved parameter values, defaults included.
        outputs:
          type: array
          items:
            type: string
          description: Output ids present in `values`, in declaration order.
    Bar:
      type: object
      required:
        - timestamp
        - closed
        - values
      properties:
        timestamp:
          type: string
          format: date-time
          description: Bar open time, UTC.
        closed:
          type: boolean
          description: False while the bar is still forming; its values will change.
        values:
          type: object
          additionalProperties:
            type: number
          description: Output id to value. An output with no value on this bar is absent.
        offsets:
          type: object
          additionalProperties:
            type: integer
          description: >-
            Bars to the right (negative: to the left) the indicator draws the
            value at, by output id; present only for shifted outputs (Alligator
            shifts its lines forward). The value itself stays on the bar it was
            computed for.
        texts:
          type: object
          additionalProperties:
            type: string
          description: Marker texts by output id; present only when a marker carries text.
      example:
        timestamp: '2026-10-06T09:55:00Z'
        closed: true
        values:
          line_0: 123456.78
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
              description: Stable error code.
              enum:
                - invalid_argument
                - too_much_data
                - unauthenticated
                - permission_denied
                - not_found
                - method_not_allowed
                - script_error
                - rate_limited
                - canceled
                - bad_gateway
                - unavailable
                - deadline_exceeded
            message:
              type: string
  headers:
    RateLimitLimit:
      description: Credits allowed per quota window.
      schema:
        type: integer
    RateLimitRemaining:
      description: Credits still available in the current quota window after this request.
      schema:
        type: integer
    RateLimitReset:
      description: Epoch second at which the current quota window resets.
      schema:
        type: integer
        format: int64
    RetryAfter:
      description: Seconds until the request can be retried.
      schema:
        type: integer
  responses:
    InvalidRequest:
      description: >-
        Invalid request or parameter (`invalid_argument`), or a request
        producing more data than can be served (`too_much_data`).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error:
              code: invalid_argument
              message: parameter "param.length" must be an integer between 1 and 5000
    Unauthorized:
      description: Missing or invalid API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error:
              code: unauthenticated
              message: invalid API key
    Forbidden:
      description: >-
        Permission denied (missing scope, or a history depth the account's plan
        does not allow).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error:
              code: permission_denied
              message: permission denied
    NotFound:
      description: >-
        The exchange or the security is not served, or the indicator is not
        available to this account.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error:
              code: not_found
              message: indicator not found
    ScriptError:
      description: >-
        The indicator script failed to compile, raised an error or exceeded its
        computation time limit (`script_error`).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error:
              code: script_error
              message: indicator script failed
    RateLimited:
      description: >-
        The remaining credits of the quota window cannot cover this request;
        retry after the window resets.
      headers:
        X-RateLimit-Limit:
          $ref: '#/components/headers/RateLimitLimit'
        X-RateLimit-Remaining:
          $ref: '#/components/headers/RateLimitRemaining'
        X-RateLimit-Reset:
          $ref: '#/components/headers/RateLimitReset'
        Retry-After:
          $ref: '#/components/headers/RetryAfter'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error:
              code: rate_limited
              message: quota exceeded
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.