Skip to main content

Triggers (Conditions + Indicators)

In Auto, a trigger is a condition tree that evaluates continuously. When the tree resolves to true, configured actions run.

Market Coverage

Auto supports broad CEX/perps and DEX/on-chain symbol coverage, including markets indexed through our market-data providers.

Trigger Shape

All triggers are expressed as conditions with a root boolean group:

{
"conditions": {
"AND": [
{
"source": "ta",
"method": "rsi",
"args": { "symbol": "BTC", "timeframe": "1h", "period": 14 },
"operator": "<",
"value": 30
}
]
}
}

Rules:

  • Root group must be AND or OR.
  • Groups can be nested.
  • Max condition tree depth: 3.
  • Max leaf conditions per query: 10.

Supported Condition Sources

Price Source (price)

MethodArgumentsReturnsDescription
currentsymbolnumberCurrent market price
changesymbol, periodnumberPercent price change over period
highsymbol, periodnumberHighest price in period
lowsymbol, periodnumberLowest price in period
volumesymbol, periodnumberVolume in USD over period

TA Source (ta) - Indicator Methods

Indicator methodArgumentsReturnsDescription
rsisymbol, timeframe, period?numberRSI (0-100), default period=14
macd_valuesymbol, timeframenumberMACD line value
macd_signalsymbol, timeframenumberMACD signal line
macd_histogramsymbol, timeframenumberMACD histogram
bbands_uppersymbol, timeframe, period?numberUpper Bollinger Band
bbands_middlesymbol, timeframe, period?numberMiddle Bollinger Band
bbands_lowersymbol, timeframe, period?numberLower Bollinger Band
emasymbol, timeframe, periodnumberExponential moving average
smasymbol, timeframe, periodnumberSimple moving average
atrsymbol, timeframe, period?numberAverage true range
stoch_ksymbol, timeframenumberStochastic %K
stoch_dsymbol, timeframenumberStochastic %D
ccisymbol, timeframe, period?numberCommodity Channel Index
willrsymbol, timeframe, period?numberWilliams %R

TA Args Contract

This is the exact args contract validated by Athena for TA methods.

MethodRequired argsOptional argsNotes
rsisymbol:string, timeframe:stringperiod:number (default 14)period is optional.
macd_valuesymbol:string, timeframe:stringNoneUses MACD defaults internally.
macd_signalsymbol:string, timeframe:stringNoneUses MACD defaults internally.
macd_histogramsymbol:string, timeframe:stringNoneUses MACD defaults internally.
bbands_uppersymbol:string, timeframe:stringperiod:number (default 20)period is optional.
bbands_middlesymbol:string, timeframe:stringperiod:number (default 20)period is optional.
bbands_lowersymbol:string, timeframe:stringperiod:number (default 20)period is optional.
emasymbol:string, timeframe:string, period:numberNoneperiod is required.
smasymbol:string, timeframe:string, period:numberNoneperiod is required.
atrsymbol:string, timeframe:stringperiod:number (default 14)period is optional.
stoch_ksymbol:string, timeframe:stringNoneNo period argument in EQL.
stoch_dsymbol:string, timeframe:stringNoneNo period argument in EQL.
ccisymbol:string, timeframe:stringperiod:number (default 20)period is optional.
willrsymbol:string, timeframe:stringperiod:number (default 14)period is optional.

Common TA Arg Errors

  • ema and sma require period; length is not a recognized alias.
  • period must be a JSON number (for example 14), not a string ("14").
  • timeframe is required for all TA methods.

Invalid EMA example (length used, period missing):

{
"source": "ta",
"method": "ema",
"args": { "symbol": "BTC", "timeframe": "1h", "length": 20 },
"operator": ">",
"value": 100000
}

Expected validation failure:

  • EQL_MISSING_ARG for period on method ema

Valid EMA example:

{
"source": "ta",
"method": "ema",
"args": { "symbol": "BTC", "timeframe": "1h", "period": 20 },
"operator": ">",
"value": 100000
}

Cron Source (cron)

MethodArgumentsReturnsDescription
onceperiodbooleanTrue on first due evaluation at/after createdAt + period
onceRemainTrueperiodbooleanTrue on first due evaluation and remains true afterward
everyperiodbooleanTrue at each period interval from query creation

LLM Source (llm)

MethodArgumentsReturnsDescription
athena_conditionquery, period, speed?booleanLLM-evaluated condition

Note:

  • cron and llm support shorthand forms and are expanded server-side.

Supported Operators

  • >
  • <
  • >=
  • <=
  • ==
  • !=
  • crosses_above
  • crosses_below

Cross operators use previous-state tracking and evaluate transitions:

  • crosses_above: previous < threshold and current >= threshold
  • crosses_below: previous > threshold and current <= threshold

Dynamic Comparisons (Dynamic Values)

value does not need to be a static literal. It can also reference another data source result at evaluation time.

This lets you compare one live metric against another live metric, for example current price vs. an indicator band.

Example: trigger when ETH price crosses above the current 4h upper Bollinger Band.

{
"conditions": {
"AND": [
{
"source": "price",
"method": "current",
"args": { "symbol": "ETH" },
"operator": "crosses_above",
"value": {
"source": "ta",
"method": "bbands_upper",
"args": { "symbol": "ETH", "timeframe": "4h" }
}
}
]
}
}

Important:

  • Dynamic values are supported only in condition value.
  • Dynamic values are not supported in action parameters.

Timeframe and Period Enums

TA timeframe values:

  • 1m, 5m, 15m, 30m, 1h, 2h, 4h, 8h, 12h, 1d

period values:

  • 5m, 15m, 30m, 1h, 2h, 4h, 8h, 12h, 24h, 1d, 7d