Skip to main content

Trade Plans

A Trade Plan is a reusable blueprint that defines the parameters of a trade signal — instrument type, direction, risk settings, and exit criteria. Trade Plans are referenced by the Execute Trade predefined action step. When the action fires during a transition, FORJ resolves the plan's values and logs a trade event.

Trade Plans do not place orders or interact with any brokerage. They define what your strategy records when it identifies a trade opportunity. What you do with that signal is entirely up to you — act on it manually, forward it via webhook, or use it for backtesting analysis.

Creating a Trade Plan

  1. In SMITH, click the gear icon to open the Strategy Toolbar.
  2. Select Manage Trade Plans.
  3. Click New Trade Plan and give it a descriptive name (e.g., Scalp_Long_EURUSD, Swing_Short).

A strategy can have multiple trade plans — for example, one for tight scalp entries and another for wide swing entries. Different Execute Trade actions can reference different plans.

Trade Plan configuration

Instrument & risk

FieldDescription
Instrument typeforex, equity, futures, or crypto
Risk unitpips, ticks, dollars, or percentage — defaults by instrument type
Unit sizeThe numeric value of one risk unit (e.g., 0.0001 for forex pips). Can be a static value or a dynamic operand sourced from context, event, or indicators

The risk unit determines how SL/TP distances are measured. Default risk units by instrument type:

InstrumentDefault risk unit
Forexpips
Equitydollars
Futuresticks
Cryptopercentage

Direction & order type

FieldOptions
Directionlong or short
Order typemarket, limit, stop, or stop limit

Entry price

Whether you need to configure an entry price depends on your order type:

Order typeEntry price behavior
MarketUses the close price of the incoming candle event. No entry price field is shown
LimitYou specify a Limit Price operand — the price at which the limit order would fill
StopYou specify a Stop Price operand — the price at which the stop order would trigger
Stop LimitYou specify both a Limit Price and a Stop Price operand

For non-market order types, the price input accepts any standard operand source:

  • Static — a fixed number (e.g., 1.0850)
  • Context — a variable from your strategy context
  • Event — a field from the incoming event payload. When you choose Event, you select a data stream and an event field path (e.g., close, high, low)
  • Indicators — an indicator output value

Stop loss & take profit

Each side (SL and TP) has an enable toggle:

  • Disabled (default): No price is set for that side. The trade event is logged without an SL or TP price — the strategy records the entry signal but does not define a risk boundary on that side.
  • Enabled: The sub-form expands and you configure the mode, value, and optional modifier described below. The resolved price is included in the trade event and used by Track Open Position to evaluate exit criteria.

When enabled, you choose a mode that controls how the price is calculated:

ModeDescription
DistanceA distance from entry measured in risk units (e.g., 20 pips). Placed on the loss or profit side based on direction
AbsoluteAn exact price operand. Can be static, context-sourced, event-sourced, or indicator-sourced
R:R ratioA ratio relative to the other side. For example, 2:1 means the TP distance is twice the SL distance. Only one side can use R:R — the other side serves as the anchor

Each side supports an optional modifier (add, subtract, multiply, divide) applied after the initial value is resolved — useful for fine-tuning by a buffer amount.

How SL/TP resolution works at runtime:

When the Execute Trade action fires, FORJ resolves each side's value based on its mode:

  • Distance: entry ± (value × unitSize), direction-aware (long SL is below entry, short SL is above)
  • Absolute: resolves the operand directly to a price
  • R:R ratio: computes the distance of the anchor side, multiplies by the ratio, and places the result on the opposite side of entry

If one side uses R:R, the other side is resolved first and used as the anchor. FORJ prevents both sides from using R:R simultaneously.

Position size

An optional operand for position sizing (lots, shares, or contracts). Like other operands, it can be a static value or sourced from context, event, or indicators. The resolved value is included in the logged trade event for your reference — for example, to forward via webhook to an external system that handles actual order placement.

Symbol

An optional operand for the trading symbol. If not set, FORJ falls back to the symbol from the data stream that triggered the event.

Using a Trade Plan in an action

  1. Open the Actions Manager and create or edit an action.
  2. Add a Predefined Action → Execute Trade step.
  3. Select which Trade Plan the step references.

When the transition fires and this action executes, FORJ:

  1. Resolves all operands in the plan against the current event payload and context
  2. Computes SL/TP prices based on the configured modes
  3. Logs a trade event with the resolved parameters
  4. Updates context: trade_was_executed_on_last_state_change is set to true, last_trade_executed records the timestamp

The logged trade event includes: entry price, direction, SL price, TP price, symbol, timestamp, trade plan name, and position size.

Track Open Position

Enable Track Open Position in a trade plan's exit configuration to have the strategy monitor the position's lifecycle after entry. When enabled, the strategy evaluates exit criteria on each incoming event and logs an exit event when conditions are met.

Exit modes

ModeBehavior
SL/TPExits when price breaches the SL or TP price levels
ConditionExits when a guard condition you define evaluates to true
TimerExits after a duration elapses. Optionally filtered: only when in profit, only when in loss
SL/TP + ConditionWhichever triggers first
SL/TP + TimerWhichever triggers first

When an exit triggers, the strategy logs a trade exit event with the exit reason (sl_hit, tp_hit, condition, timer), exit price, P&L, and duration.

How position tracking works

When Execute Trade fires with Track Open Position enabled:

  1. The strategy records an open position internally, capturing the entry price, direction, SL/TP levels, and exit mode from the trade plan
  2. On each subsequent incoming event, the strategy evaluates all open positions against their exit criteria
  3. When exit criteria are met, the position is closed — a trade exit event is logged with the exit reason, exit price, P&L, and duration

Each open position is linked to its exit event by a unique lifecycle ID, so you can trace the full lifecycle of a trade from entry to exit.

Trade lifecycle events

The strategy emits system events at key moments in the trade lifecycle. These events are recorded alongside your strategy's other activity (transitions, guards, actions) and can trigger alert definitions:

Event nameWhen it fires
Trade Executed (ACK)When an Execute Trade action runs and logs a trade event
Trade Plan Exit (SL/TP)When a tracked position exits due to SL/TP breach or condition
Trade Plan TimerWhen a tracked position exits due to timer expiry

These events carry the trade plan ID in their payload, so alerts scoped to a specific trade plan only fire for that plan's lifecycle events.

Alerts for trade signals

Alert definitions let you receive notifications when trade lifecycle moments occur. There are two primary approaches:

Event trigger — trade lifecycle events

Create an alert definition with the Event trigger type and select one of the trade lifecycle events listed above. This fires whenever that event type occurs — for example, "notify me on every Trade Executed (ACK)" or "notify me on every Trade Plan Exit." You can optionally scope the alert to a specific trade plan by selecting it in the trigger configuration.

Action trigger — specific trade actions

Create an alert definition with the Action trigger type and reference a specific action in your strategy — for example, your Enter_Long action. This fires only when that particular action executes, providing targeted notifications with full context about which transition triggered it.

What data does an alert carry?

Alert notifications include contextual data from the moment the alert fired. For trade-related alerts, this includes:

  • Resolved trade parameters: SL price, TP price, symbol, entry price, direction, order type, trade plan name, and execution timestamp
  • State context: which state the strategy transitioned from and to
  • Event payload: the candle data (OHLCV) and indicator values at the time of the alert
  • Alert metadata: severity, definition name, description, workspace and strategy IDs

For webhook channels, you can build custom message templates that interpolate these values using {{expression}} syntax. Trade-specific fields are available under cause.predefinedConfig:

Template variableValue
{{cause.predefinedConfig.sl_price}}Resolved stop loss price
{{cause.predefinedConfig.tp_price}}Resolved take profit price
{{cause.predefinedConfig.symbol}}Trading symbol
{{cause.predefinedConfig.timestamp}}Execution timestamp (ms)
{{cause.predefinedConfig.entryPrice}}Entry price
{{cause.predefinedConfig.direction}}long or short
{{cause.predefinedConfig.tradePlanId}}Trade plan ID
{{cause.predefinedConfig.tradePlanName}}Trade plan name

Additional envelope fields like {{cause.fromState}}, {{cause.toState}}, {{event.payload.close}}, and {{event.payload.indicators.byStream.stream_eurusd_1m.byIndicator.wic_rsi_14.value}} are also available. For the complete list of available fields, filters, and template syntax, see Webhook Payloads.

Signal-only pattern with Do Nothing actions

For pure signal generation — where you want notifications without any operational effect — you can use a creative pattern:

  1. Create an action with a Do Nothing step
  2. Attach an alert definition to the action
  3. Wire a transition to fire this action when your exit (or entry) conditions are met

The Do Nothing step performs no operation, but the attached alert notifies you via in-app notification, email, SMS, or webhook. This is useful for exit signals where you want to decide how to act rather than having the strategy log an exit event automatically.

Any action step can carry an alert definition, turning it into a notification trigger — even when the step itself has no operational effect.