The Formula Editor is the graphical interface for Generic Trader's formula framework. It is opened from the f(x) control in the Desktop toolbar and can be used to inspect built-in formulas or create formulas of your own.
Formula libraries
- System formulas — platform-supplied market data, calculations, state/event functions, position/account information, technical indicators, option analytics, and utilities
- My formulas — formulas you create and save
Examples of available formula categories
- Market data: Bid, Ask, Last, BidSize, AskSize, Quotes, RecentPrice
- Session data: DailyOpen, DailyHigh, DailyLow, DailySettle, Open Interest
- Position/account: Position and TradeableAccount
- State/event logic: Accumulate, Changes, ChangesTo, CROSSES_UP, HighestSince, LowestSince, SnapshotNum, SumSince
- Price utilities: ClosestPrice, ClosestMult, AtLeast, AtMost
- Indicators: SMA, EMA, RSI, MACD, ATR, VWAP, Bollinger Bands, Stochastic, Donchian Channel, and many others
- Options analytics: implied volatility, Greeks, volatility-surface and related values
Building a custom formula
Select + Create Formula, assign a clear function name, define any parameters, and use + Functionality to assemble the formula from platform functions. Available parameter types include Symbol, Boolean, String, Number, and indicator types. Building through the Formula Editor is preferable to guessing internal syntax.
Compound results
Some functions return multiple values. SubRef, SubRefNum, and SubRefStr select a named sub-value from a compound result. ClosestPrice is particularly useful when a calculated order price must be rounded to a valid contract tick.
Strategy integration
When Formulas is enabled in a strategy, fields such as price, quantity, side, symbol, and other parameters can use formula-derived values. Start with the simplest native strategy that meets the requirement, add formula logic incrementally, and verify the resulting working orders in demo.
Formula Editor operating model
- Use System formulas when an existing function already provides the value you need; use My formulas for saved custom logic.
- Common live-data references include Bid, Ask, Last, RecentPrice, and compound Quotes data.
- State/event functions include crossing/change detection, accumulation, snapshots, high/low tracking since an event, and restart behavior.
- Some functions return compound results; SubRef, SubRefNum, and SubRefStr are used to select component values.
- Use ClosestPrice or equivalent tick-conforming logic when a formula produces an order price.
- When Formulas are enabled in strategy fields, formula-derived values can drive properties such as price, quantity, side, or symbol where the strategy exposes those fields.
Function families
- Market data: Bid, Ask, Last, BidSize, AskSize, Quotes, RecentPrice
- Session/bar data: DailyOpen, DailyHigh, DailyLow, DailySettle, Open Interest and bar-derived values
- Position/account: Position and TradeableAccount
- State/event: Accumulate, Changes, ChangesTo, HighestSince, LowestSince, SnapshotNum, SumSince, crossing functions, StartTime and RestartTime
- Price utilities: ClosestPrice, ClosestMult, AtLeast and AtMost
- Technical analysis: SMA, EMA, RSI, MACD, ATR, VWAP, Bollinger Bands, Stochastic, Donchian Channel and many others
- Options analytics: implied volatility, Greeks, volatility-surface and related functions