Advanced Indicators
Compound indicators, math operators, boolean filters, and condition-based indicators.
Advanced Indicators
Advanced indicators operate on other indicators, perform mathematical operations, or filter based on asset metadata. These are the building blocks for sophisticated, multi-layered strategies.
Compound Indicators (Indicators of Indicators)
Minimum of Indicator
The lowest (for Minimum) or highest (for Maximum) finite observation of one numeric indicator in a rolling time window. A direct ChartBar operand is dated at its completed candle end; reading the same candle again does not extend its age. For exchange-session inputs, TradingDay skips closed dates using observed session evidence. Missing required input or session evidence returns no value. Available history is used from the first observation; compose a separate coverage condition when a full lookback is required. TradingDay follows the input markets: crypto-only inputs use elapsed 24-hour days, including weekends, just like Day. Stock, option, mixed-market and asset-free expressions use confirmed exchange sessions. The window does not change intraday prices into daily closing prices. TradingMinute counts regular-session minutes the same way, so a 70 TradingMinute window at 9:45 reaches back to 3:06 PM on the prior session (the overnight gap is one step); crypto-only inputs use elapsed minutes. It allows at most 1439 minutes; use TradingDay for longer lookbacks. Indicators read every tick have no TradingMinute value outside regular hours, and windows over a ChartBar keep the value of its latest completed candle.
- Parameters: Inner indicator, Window
- Example condition: IndicatorMinimum(ChartBar(AAPL, five-minute low), 20 TradingDay)
Maximum of Indicator
The lowest (for Minimum) or highest (for Maximum) finite observation of one numeric indicator in a rolling time window. A direct ChartBar operand is dated at its completed candle end; reading the same candle again does not extend its age. For exchange-session inputs, TradingDay skips closed dates using observed session evidence. Missing required input or session evidence returns no value. Available history is used from the first observation; compose a separate coverage condition when a full lookback is required. TradingDay follows the input markets: crypto-only inputs use elapsed 24-hour days, including weekends, just like Day. Stock, option, mixed-market and asset-free expressions use confirmed exchange sessions. The window does not change intraday prices into daily closing prices. TradingMinute counts regular-session minutes the same way, so a 70 TradingMinute window at 9:45 reaches back to 3:06 PM on the prior session (the overnight gap is one step); crypto-only inputs use elapsed minutes. It allows at most 1439 minutes; use TradingDay for longer lookbacks. Indicators read every tick have no TradingMinute value outside regular hours, and windows over a ChartBar keep the value of its latest completed candle.
- Parameters: Inner indicator, Window
- Example condition: IndicatorMaximum(ChartBar(AAPL, five-minute low), 20 TradingDay)
SMA of Indicator
Computes the Simple Moving Average of any other indicator over a window. TradingDay follows the input markets: crypto-only inputs use elapsed 24-hour days, including weekends, just like Day. Stock, option, mixed-market and asset-free expressions use confirmed exchange sessions. The window does not change intraday prices into daily closing prices. TradingMinute counts regular-session minutes the same way, so a 70 TradingMinute window at 9:45 reaches back to 3:06 PM on the prior session (the overnight gap is one step); crypto-only inputs use elapsed minutes. It allows at most 1439 minutes; use TradingDay for longer lookbacks. Indicators read every tick have no TradingMinute value outside regular hours, and windows over a ChartBar keep the value of its latest completed candle.
- Parameters: Inner indicator, Window
- Example condition:
SMA(RSI(AAPL, 14), 10 days) — The 10-day average of AAPL's RSI. Smooths out noise.
EMA of Indicator
Computes the Exponential Moving Average of any other indicator. TradingDay follows the input markets: crypto-only inputs use elapsed 24-hour days, including weekends, just like Day. Stock, option, mixed-market and asset-free expressions use confirmed exchange sessions. The window does not change intraday prices into daily closing prices. TradingMinute counts regular-session minutes the same way, so a 70 TradingMinute window at 9:45 reaches back to 3:06 PM on the prior session (the overnight gap is one step); crypto-only inputs use elapsed minutes. It allows at most 1439 minutes; use TradingDay for longer lookbacks. Indicators read every tick have no TradingMinute value outside regular hours, and windows over a ChartBar keep the value of its latest completed candle.
- Parameters: Inner indicator, Window
- Example condition:
EMA(Volume(SPY), 20 days) — The 20-day EMA of SPY's volume. Useful for detecting volume surges.
Standard Deviation of Indicator
Computes the standard deviation of any indicator over a window.
- Parameters: Inner indicator, Window
- Example condition:
StdDev(RSI(AAPL, 14), 30 days) — How much RSI has been fluctuating over the last 30 days.
Mean Absolute Deviation of Indicator
Computes the MAD of any indicator over a window. Less sensitive to outliers than standard deviation.
- Parameters: Inner indicator, Window
Rate of Change of Indicator
The percentage change of any indicator over a window.
- Parameters: Inner indicator, Window
- Example condition:
ROC(Price(AAPL), 30 days) compares the newest reading with the oldest retained reading inside that elapsed window. A completed fiscal-quarter growth calculation is a separate accounting comparison.
Indicator at Minutes After Open
Captures the first non-null evaluated indicator value at or after the configured number of minutes after market open. The captured value is then frozen until its next daily reset. A delayed evaluation can capture after the target minute.
- Parameters: Inner indicator, Minutes after open (0–390)
- Example condition:
Price at 30 Min After Open(SPY) captures the first non-null price evaluated at or after 30 minutes after open; a delayed first evaluation captures later.
Indicator Window Ago
The retained causal value of an indicator. Minute, Hour and Day windows are elapsed calendar time. For exchange-session inputs, a TradingDay lag reads the last confirmed regular-session value from the completed session that many exchange sessions earlier. Missing session-end evidence returns no value, rather than an older session. Missing exchange-calendar evidence returns no value. The lag applies to the inner indicator as defined: Previous Closing Price is already from the prior session, so adding a one-day lag can read an older close than a one-day-lagged current-price indicator. Equal outer windows do not automatically align the underlying source sessions. TradingDay follows the input markets: crypto-only inputs use elapsed 24-hour days, including weekends, just like Day. Stock, option, mixed-market and asset-free expressions use confirmed exchange sessions. The window does not change intraday prices into daily closing prices. TradingMinute counts regular-session minutes the same way, so a 70 TradingMinute window at 9:45 reaches back to 3:06 PM on the prior session (the overnight gap is one step); crypto-only inputs use elapsed minutes. It allows at most 1439 minutes; use TradingDay for longer lookbacks. Indicators read every tick have no TradingMinute value outside regular hours, and windows over a ChartBar keep the value of its latest completed candle.
- Parameters: Inner indicator, Window, optional Initial value
- Example condition:
Price 5 Days Ago(AAPL) reads the retained value at a five-elapsed-day lag. Weekends do not turn that into five trading sessions.
Trailing Sum
The sum of the last N accepted observations of the inner indicator. Generic inputs append when the value changes; source-backed inputs use their own observation identities. Length counts retained observations rather than every evaluation tick.
- Parameters: Inner indicator, Length (number of accepted observations)
- Example condition:
Trailing Sum(inner, 3) sums the last three accepted observations. Generic readings 2, 2, 5 retain 2 and 5, producing 7 rather than 9.
Indicator At Entry
The value an indicator held at a matching fill. LatestFill follows the most recent matching fill; HoldingEntry preserves the original holding entry when shares are added. The captured level stays fixed instead of rolling forward. In a candidate-bound condition, the surrounding action supplies the asset when it is omitted.
- Parameters: Inner indicator, Asset, Order side, Order status, Entry anchor
- Example condition:
Minimum Price(SPY, 5 Minute) at last Filled Buy entry of SPY — the swing low that was there when the position was opened, which stays put for the life of the trade.
Tip: This reads order state, so a book using it cannot be evaluated on the fast columnar path. Reach for it when the level genuinely has to be anchored to a fill.
Consecutive Increase
Number of consecutive completed calendar periods (America/New_York; period is Year, Quarter or Month), ending with the last completed period, whose closing value of the inner indicator was strictly higher (ConsecutiveIncrease) or strictly lower (ConsecutiveDecrease) than the previous period's closing value. A period's closing value is the inner indicator's last non-null value observed in that period. The in-progress current period never counts, equal values are not a change, and a completed period with no value breaks the streak. The count is capped at lookback (an integer from 1 to 60). Returns null when no completed period has a value.
- Parameters: Inner indicator, Period (Year, Quarter or Month), Lookback (1–60)
- Range: 0 to lookback, or null when no completed period has a value
- Example condition:
ConsecutiveIncrease(LastDividend(KO), Year, 10) >= 10 (KO raised its regular dividend per share in each of the last 10 completed years); ConsecutiveIncrease(Fundamental(AAPL, totalRevenue), Quarter, 8) >= 4 (AAPL's reported revenue rose for at least the last 4 completed quarters)
Tip: Inside a DynamicRebalance filter, pass the candidate to the inner indicator to screen for dividend growers or steady revenue growers. Set lookback to the streak you compare against, since the count never exceeds it.
Consecutive Decrease
Number of consecutive completed calendar periods (America/New_York; period is Year, Quarter or Month), ending with the last completed period, whose closing value of the inner indicator was strictly higher (ConsecutiveIncrease) or strictly lower (ConsecutiveDecrease) than the previous period's closing value. A period's closing value is the inner indicator's last non-null value observed in that period. The in-progress current period never counts, equal values are not a change, and a completed period with no value breaks the streak. The count is capped at lookback (an integer from 1 to 60). Returns null when no completed period has a value.
- Parameters: Inner indicator, Period (Year, Quarter or Month), Lookback (1–60)
- Range: 0 to lookback, or null when no completed period has a value
- Example condition:
ConsecutiveDecrease(LastDividend(T), Year, 3) >= 1 (T's regular dividend per share fell in the last completed year); ConsecutiveDecrease(Fundamental(INTC, totalRevenue), Quarter, 8) >= 3 (INTC's reported revenue fell for the last 3 completed quarters)
Tip: Use it as an exit or exclusion filter, for example selling a holding whose dividend was cut or whose revenue has shrunk several quarters in a row.
Mathematical Operators
Plus (+)
Sum of two or more indicators.
- Parameters: Two or more indicators
- Example condition:
Price(AAPL) + Price(MSFT) — Combined price (useful with position sizing).
Minus (−)
Difference between indicators.
- Parameters: Two or more indicators
- Example condition:
SMA(SPY, 50) - SMA(SPY, 200) — The spread between the 50 and 200-day SMA. Positive = bullish trend.
Multiply (×)
Product of indicators.
- Parameters: Two or more indicators
- Example condition:
Price(AAPL) × Shares Outstanding(AAPL) — Manually compute market cap.
Divide (÷)
Quotient of indicators.
- Parameters: Two or more indicators
- Example condition:
Net Income(AAPL) ÷ Revenue(AAPL) — Net profit margin as a ratio.
Max
The maximum value of two or more indicators.
- Parameters: Two or more indicators
- Example condition:
Max(RSI(AAPL, 14), RSI(MSFT, 14)) — The higher RSI of the two.
Min
The minimum value of two or more indicators.
- Parameters: Two or more indicators
Negative
Negates an indicator's value.
- Parameters: One indicator
- Example condition:
Negative(Max Drawdown(SPY, 30)) — Converts drawdown to a positive number for easier comparison.
Current Value
Inside a CountTrue historical condition, hold this operand at its value now while checking historical observations. Outside a historical query it returns the operand normally. Wrap a complete stateful expression, rather than putting this binding inside its recurrence.
- Parameters: One indicator
- Example condition: CountTrue(Price(SPY) <= CurrentValue(SMA(SPY, 20, TradingDay)), 20 TradingDay): compare historical prices against today's moving average.
Absolute Value
The absolute value of an indicator.
- Parameters: One indicator
- Example condition:
Abs(Price Change Since Open(TSLA)) — The magnitude of today's move regardless of direction.
Square Root
Square root of an indicator.
- Parameters: One indicator
Logarithm
Logarithm of an indicator with a specified base.
- Parameters: One indicator, Base (> 0, ≠ 1)
Exponentiation
Raises an indicator to a specified power.
- Parameters: One indicator, Exponent
- Example condition:
Exponentiation(1 + ROC(SPY, 252) / 100, 1/3) — Approximate annualized 3-year return.
Boolean / Metadata Indicators
Is Industry
Returns 1 if the asset belongs to a specified industry, 0 otherwise. Over 100 categories supported including Artificial Intelligence, Semiconductor, Electric Vehicles, Space Exploration, Healthcare, Biotechnology, Cloud Computing, Cybersecurity, Renewable Energy, and many more.
- Parameters: Asset, Industry name
- Example condition:
Is Industry(asset, "Artificial Intelligence") = 1 (Only trade AI stocks)
Is Index Member
Returns 1 if the asset is a member of a specified index, 0 otherwise.
- Parameters: Asset, Index name (S&P 500, Nasdaq-100, or DJIA)
- Example condition:
Is Index Member(asset, "SP500") = 1 (Only trade S&P 500 components)
Is Asset Type
Returns 1 if the asset matches Stock, Cryptocurrency, Option or Other, and 0 otherwise. ETFs are Stock assets; use separate stock metadata or a universe filter to select ETFs.
- Parameters: Asset, Asset type (Stock, Cryptocurrency, Option or Other)
- Example condition:
Is Asset Type(asset, "Stock") = 1 (Select Stock assets, including ETFs)
Is Asset
Returns 1 if the asset matches a specific symbol. Useful for including specific assets in multi-asset strategies.
- Parameters: Asset, Match symbol
- Example condition:
Is Asset(asset, "SPY") = 1 (Apply this condition only to SPY)
Is Not Asset
Returns 1 if the asset does NOT match a specific symbol. Useful for excluding specific assets.
- Parameters: Asset, Match symbol
- Example condition:
Is Not Asset(asset, "SPY") = 1 (Apply this condition to everything except SPY)
Condition-Based Indicators
Consecutive True
Returns 1 after the condition has remained true at every observed evaluation for the configured elapsed duration; returns 0 before then. A false evaluation resets the timer. It does not count N observations.
- Parameters: Condition, Window
- Example condition:
Consecutive True(RSI(AAPL, 14) < 30, 3 days) = 1 (the condition has remained true at each observed evaluation for at least three elapsed days)
Count True
Counts intervals in a lookback window during which an ordinary condition was true at least once. countInterval chooses the counting interval; if omitted, it is one unit of the window interval. A five-minute interval contributes at most one count, even when the condition is true repeatedly. Separate visits can be expressed in the condition by requiring a previous bar outside the zone. TradingDay follows the input markets: crypto-only inputs use elapsed 24-hour days, including weekends, just like Day. Stock, option, mixed-market and asset-free expressions use confirmed exchange sessions. The window does not change intraday prices into daily closing prices. TradingMinute counts regular-session minutes the same way, so a 70 TradingMinute window at 9:45 reaches back to 3:06 PM on the prior session (the overnight gap is one step); crypto-only inputs use elapsed minutes. It allows at most 1439 minutes; use TradingDay for longer lookbacks. Indicators read every tick have no TradingMinute value outside regular hours, and windows over a ChartBar keep the value of its latest completed candle.
- Parameters: Condition, Lookback window, Counting interval (optional)
- Example condition:
CountTrue(condition, 20, TradingDay, {length: 5, interval: Minute}) counts matching five-minute intervals within the last 20 trading sessions. CountTrue(condition, 30, Day) counts matching calendar days within the last 30 days.
Option Position Indicators
Option Position Value
Returns the total market value of option spreads matching the filter criteria.
- Parameters: Underlying (optional), Option Type (call/put, optional), Direction (long/short, optional), Spread Type (optional)
- Range: 0 to ∞ (dollars)
- Example condition:
Option Position Value(AAPL) > 1000 (Total value of AAPL option positions exceeds $1,000)
Option Position Count
Returns the number of open option contract positions/legs matching the filter criteria. Portfolio-wide (no underlying, option type, direction, or spread filters): open legs plus legs reserved by earlier true OpenOption signals in the same tick's strategy loop. Filtered counts (e.g. per ticker) use open legs only. Use Option Spread Count for multi-leg spread groups.
- Parameters: Underlying (optional), Option Type (call/put, optional), Direction (long/short, optional), Spread Type (optional)
- Range: 0 to ∞
- Example condition:
Open option position count (portfolio-wide) < 4 (Global leg cap for single-leg entries; use < maxOpenLegs - 1 for 2-leg verticals)
Option Position P&L%
Returns the weighted average P&L percentage across option spreads matching the filter.
- Parameters: Underlying (optional), Option Type (optional), Direction (optional), Spread Type (optional)
- Range: -100% to ∞
- Example condition:
Option Position P&L% > 50 (Option positions are up over 50%)
Option Position Max Drawdown
Peak-to-current drawdown of the aggregated P&L percentage across option spreads matching the filter. Stateful sibling of Option Position P&L%: while P&L% returns the current value, this indicator tracks the highest P&L% observed and returns how far the position has fallen from that peak. Resets when no matching spreads remain so a fresh entry starts from a clean peak.
- Parameters: Underlying (optional), Option Type (optional), Direction (optional), Spread Type (optional)
- Range: >= 0 (percentage points of P&L)
- Example condition:
Option Position Max Drawdown(AVGO) > 25 (aggregate option P&L is more than 25 percentage points below its observed peak)
Option Days to Expiration
Returns the minimum or maximum days to expiration across option spreads matching the filter.
- Parameters: Min/Max, Underlying (optional), Option Type (optional), Direction (optional), Spread Type (optional)
- Range: 0 to 365+
- Example condition:
Min DTE < 7 (Closest option position expires within 7 days — consider closing)
Option Days Held
Returns the minimum or maximum days since entry across option spreads matching the filter.
- Parameters: Min/Max, Underlying (optional), Option Type (optional), Direction (optional), Spread Type (optional)
- Range: 0 to ∞
- Example condition:
Max Days Held > 30 (Oldest position held for over 30 days)
Option Collateral
Returns the total collateral locked across option spreads matching the filter.
- Parameters: Underlying (optional), Option Type (optional), Direction (optional), Spread Type (optional)
- Range: 0 to ∞ (dollars)
- Example condition:
Option Collateral < 5000 (Less than $5,000 locked in option collateral)
Option Spread Count
Returns the number of distinct economic open multi-leg option spreads matching the filter criteria, deduplicating equal economic spread keys. Does not count standalone single-leg option positions.
- Parameters: Underlying (optional), Option Type (optional), Direction (optional), Spread Type (optional)
- Range: 0 to ∞
- Example condition:
Option Spread Count < 5 (Have fewer than 5 open option spreads)
Option Spread Entry Price
Returns the net price per share paid or collected to open the option spreads matching the filter: positive for a net debit, negative for a net credit. Several matching spreads average by contracts. Has no value when no matching spread is open. Use it as an option limit amount to price one spread off another spread's fill; wrap a credit spread's price in Absolute Value first, because a limit must be positive.
- Parameters: Underlying (optional), Option Type (optional), Direction (optional), Spread Type (optional)
- Range: -∞ to ∞ (dollars per share)
- Example condition:
Minimum net credit = Option Spread Entry Price (SPX · long · call · vertical) + 0.50 (Sell the next spread for the held debit spread's fill plus $0.50)
Option Unrealized P&L
Returns the total unrealized P&L in dollars across option spreads matching the filter.
- Parameters: Underlying (optional), Option Type (optional), Direction (optional), Spread Type (optional)
- Range: -∞ to ∞ (dollars)
- Example condition:
Option Unrealized P&L(AAPL) > 500 (AAPL option positions are up over $500)
Option Gross Exposure %
Sum of absolute option leg marks divided by portfolio value (percent). Matches gross deployment audits. Unfiltered portfolio-wide only.
- Parameters: None
- Range: 0% to ∞
- Example condition:
Option gross exposure % < 40 (block new entries when gross option marks exceed 40% of portfolio value)
Option Realized P&L
Returns the net realized P&L in dollars from CLOSED option positions matching the filter, long and short alike. Losing closes count as negative. Measures closes only and subtracts nothing for premium already spent. Lookback Days limits it to closes within that many days of the evaluation date; leave it empty for the whole life of the book.
- Parameters: Underlying (optional), Option Type (optional), Direction (optional), Spread Type (optional), Lookback Days (optional)
- Range: -∞ to ∞ (dollars)
- Example condition:
Option Realized P&L(IBIT, put, short) > 0 (closed IBIT short puts have made money overall)
Option Realized Premium
Returns realized option premium still available to spend: net realized P&L from closed short option positions, minus premium already spent by opens sized with Percent of Realized Premium. Proceeds from closing long options are not added back. This is the balance that allocation sizes against. It goes negative when closed shorts lost money, and a negative balance funds nothing. Lookback Days limits it to activity within that many days of the evaluation date; leave it empty for the whole life of the book.
- Parameters: Underlying (optional), Lookback Days (optional)
- Range: -∞ to ∞ (dollars)
- Example condition:
Option Realized Premium(IBIT) > 500 (at least $500 of banked IBIT premium is available to fund long options)
Tip: Filtered by underlying only, never by option type: put premium funding calls is the point, and a put-only balance would ignore the call debits. Check it against Option Realized P&L, which measures the same closes without the spending.
Tip: Compound and math indicators can be nested. For example, you can compute the SMA of (Price minus SMA), or the Rate of Change of a Trailing Sum. The composability is what makes NexusTrade's indicator system so powerful.