Build a custom indicator

Chart-platform indicators (Pine Script, ThinkScript) are invisible to everything else you build. A custom signal lives in the API: define it once as a SQL predicate and the name works everywhere the built-in signals do.

The recipe

1. Define it

A boolean SQL predicate over the 421+ built-in columns — and over other custom signals you own, so indicators compose.

curl -s -X POST https://api.tickerbot.io/v2/signals \
  -H "Authorization: Bearer $TICKERBOT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "name": "oversold_quality",
        "expr": "rsi_14 < 30 AND above_sma_200 AND pe_ratio < 20",
        "description": "Oversold pullback in a profitable uptrend" }'

2. Use it like a built-in

Screen the whole market for it.

curl -s -X POST https://api.tickerbot.io/v2/scan \
  -H "Authorization: Bearer $TICKERBOT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "q": "oversold_quality AND market_cap > 1e9" }'

3. Ask for its history

Custom signals mix into /v2/series; transitions_only returns just the rows where the indicator flipped — its full on/off history, as if it had always existed.

curl -s "https://api.tickerbot.io/v2/series?tickers=AAPL,MSFT\
&columns=close,oversold_quality&interval=1d&from=2024-01-01\
&transitions_only=true" \
  -H "Authorization: Bearer $TICKERBOT_API_KEY"

The same retroactivity applies to as-of reads: define it today, query its value at any past moment.

4. Wire it to a push

Because it's a signal, it subscribes like one.

curl -s -X POST https://api.tickerbot.io/v2/scan/subscribe \
  -H "Authorization: Bearer $TICKERBOT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "q": "oversold_quality AND market_cap > 1e9",
        "target_url": "https://your-app.example.com/hook" }'

Endpoints used

EndpointRole in this build
POST /v2/signalsCreate the indicator: name + SQL predicate; composes with other customs
POST /v2/scanScreen on it across the whole market, mixed with any built-in
GET /v2/series?transitions_only=trueIts flip history: every on/off edge on an aligned grid
POST /v2/scan/subscribeThe indicator as a push: fires when a ticker starts matching

More guides