Beta Free early access Get started →

Condition Engine

The Condition Engine is ForgeAlpha's rule execution system. Every strategy — whether reverse-engineered from trade history or built from scratch — runs through this engine.

Building Conditions

Each condition compares two values. A value can reference:

  • Constants — fixed numbers (e.g., 30, 70, 0.01)
  • Price — current market price
  • Indicators — any of the 70+ built-in technical indicators
  • Position data — current position count, floating P&L, entry price, volume
  • Account data — equity, balance, assigned capital
  • Time — hour, minute, day of week, month

Comparison Operators

Standard comparisons (greater than, less than, equal) plus crossover detection — ideal for indicator crossover strategies like RSI crossing above 30.

Logic Groups

Conditions can be combined with AND/OR logic and nested to create complex rules. For example: "Buy when RSI is below 30 AND price is below the 200-period moving average."

Entry Rules

An entry rule defines when to open a position:

  • Direction — BUY, SELL, or signal-based (separate buy/sell conditions)
  • Conditions — the rule logic that must be satisfied
  • Lot sizing — how to calculate position size
  • Cooldown — minimum time between entries to prevent over-trading
  • Position limits — maximum concurrent positions per rule

Exit Rules

An exit rule defines when to close positions:

  • Conditions — when these are true, the exit action fires
  • Actions — close all, close oldest, close newest, or close a fraction of each position

Lot Sizing Modes

  • Fixed — constant lot size for every trade
  • Risk-based — risk a percentage of equity per trade
  • Equity percentage — position size as a percentage of current equity
  • Martingale — multiply lot size after losses (use with extreme caution)

Indicators

70+ built-in indicators, each with configurable period:

  • Moving Averages — SMA, EMA, WMA, DEMA, TEMA, HMA
  • Momentum — RSI, MACD, Stochastic, CCI, Williams %R, ROC, Awesome Oscillator, Stochastic RSI, and more
  • Volatility — ATR, Bollinger Bands, Keltner Channel, Donchian Channel, Chandelier Exit
  • Trend — ADX, DMI, Parabolic SAR, Supertrend, Aroon, Ichimoku Cloud, Linear Regression Slope
  • Volume — OBV, VWAP, MFI, CMF, Force Index, Accumulation/Distribution
  • Price & Pivot — Pivot Points, Median/Typical/Weighted Price, Range High/Low/Width

Trailing Stops

Trailing stops can be attached to any entry rule with three modes: ATR-based, percentage-based, or fixed distance.

Grid Configuration

For grid-style strategies, configure step spacing using fixed price distance, percentage of price, or ATR-based dynamic spacing. A max levels setting prevents runaway grid expansion.