Documentation
Strategy Reference
Astral strategies are structured, rule-based specifications generated and revised through chat. The code view is the inspectable representation used by backtesting and deployment workflows; review it before saving or operating a strategy.
Core structure
Assets and bar size
Derived series and indicators
Signals and conditions
Rules and orders
Price data and common functions
Strategies can reference open, high, low, close, and volume for configured assets. Supported calculations are SMA, EMA, RSI, ATR, MACD components, Bollinger Bands, stochastic values, rolling minimum/maximum, standard deviation, z-score, lag, percent change, rate of change, difference, logarithm, exponential, absolute value, square root, clamping, crossover helpers, bars-since and value-when event memory, pivot highs/lows, and time-of-day/weekday functions.
Strategy expressions have no VWAP, ADX, Supertrend, Ichimoku, rolling-sum or if/else function. VWAP is available as a built-in chart indicator, but not inside strategy or alert conditions. Astral can often build an equivalent from the supported functions, such as a rolling volume-weighted average over a fixed number of bars, and should tell you when it does.
Function availability and signatures are validated by the current strategy schema. If generated code fails validation, ask Astral to correct it rather than manually guessing at an unsupported signature.
Time-of-day filters
Hour, minute and weekday functions read each bar's time in New York time (America/New_York, including daylight saving), whatever timezone you have in mind. For a window given in UTC, Astral converts it to New York time: UTC minus 4 hours during US daylight time (mid-March to early November), minus 5 hours otherwise. Because the expression stays on New York clock time, a UTC window moves by one hour when daylight saving starts or ends. Scheduled rules are different: they take an explicit timezone, including UTC.
Stop floors, target filters and time stops
These common exits are supported without custom code:
- A stop with a minimum distance, such as a 1.5 ATR stop that is never closer than 0.2% of the entry price.
- A minimum-target filter, such as only entering when three ATRs are at least 0.4% of the price.
- A time stop, such as exiting 20 bars after the entry signal. The count starts from the most recent bar on which the entry signal was true, not from the fill.
Actions, sizing, and risk
The strategy builder is long-only: buy orders open or add to a long position and sell orders reduce or close it. Short entries and short/cover orders are not available (see order directions). Position sizing can use a percentage of equity, fixed dollars, or fixed shares. Rules may include take-profit, stop-loss, or trailing-stop instructions.
Live broker support is narrower than backtest coverage. Connected execution is subject to broker, account, asset, timeframe, order, and rollout restrictions. Forex and metal pairs such as XAUUSD can be backtested, charted, alerted on and deployed with Astral Paper or Alerts, but no connected broker can execute them; see Gold and forex strategies. A backtest accepting a rule does not mean every connected broker can execute it.
Specification fields
assetssymbol[]requiredThe instruments evaluated by the strategy. Confirm each symbol and asset class before running a backtest.
bar_sizeintervalrequiredThe evaluation interval used for indicators and conditions. Historical coverage and connected deployment support vary by interval.
rulesrule[]requiredThe entry, exit, schedule, and risk conditions that produce simulated or deployed actions.
position_sizeequity | dollars | sharesThe sizing instruction used when a rule creates an order. Review maximum exposure and broker compatibility separately.
Alternative and event data
Astral can use supported alternative datasets for research and strategy rules, including categories such as corporate filings and events, analyst data, market movers, macro data, financial data, and public-official transaction disclosures. Coverage, fields, timestamps, and historical depth vary by dataset.
Event availability must be interpreted at its publication time. Avoid writing or evaluating a backtest as if delayed or later-corrected data had been known earlier.
Validation checklist
- Confirm every asset and its intended asset class.
- Confirm the bar size and historical period.
- Read each entry and exit condition.
- Check how multiple conditions are combined.
- Review size, capital, and maximum exposure assumptions.
- Review stop, target, and trailing behavior.
- Check that live deployment restrictions are compatible before selecting a broker mode.