What is a Strategy?
A strategy in FORJ is a set of logical rules and behaviors that define how and when your automated system reacts to market conditions. You design strategies visually in SMITH, FORJ's strategy editor.
Each strategy is represented as a set of states, transitions, and conditions that together describe its decision-making process.
At a high level, a Strategy answers three main questions:
-
Where am I now?
(Which state is the strategy currently in—like Idle, Scanning, or In Position?) -
What just happened?
(An event occurs—like a new market candle) -
What should I do next?
(Should I stay in this state, or transition to another state, and perform specific actions?)
Key Building Blocks
States
Each state represents a distinct phase of your strategy’s behavior.
For example:
Idle— Waiting for entry conditions.Scanning— Monitoring the market for a trigger.InPosition— Deciding whether or not to take a Trade.
Transitions
Transitions define how the strategy moves from one state to another when certain conditions are met.
Each transition:
- Listens for a specific event (e.g., a new candle).
- Evaluates one or more conditions (rules like RSI < 30).
- Executes actions if the transition occurs (e.g., signal a trade, update variables).
Context
The context defines where and how your strategy operates. It includes:
- Symbol — the instrument your strategy listens to (e.g.,
EURUSD). - Candle Length — the timeframe for market updates (e.g.,
5m,1h). - Direction — whether the strategy trades the Bullish (Buy) or Bearish (Sell) side.
- SL/TP Pips — default Stop Loss and Take Profit values for trade actions.
- Custom Variables — user-defined variables that persist across state transitions. Use these to track counters, store prices, accumulate values, or hold any state you need your conditions and actions to reference later.
- Indicators — subscribe to technical indicators (SMA, EMA, RSI, etc.) whose values are available in every condition and action evaluation.
Every valid strategy must have its context fully configured before it can be saved. See Configure Context for a detailed walkthrough.
Events, Conditions & Actions
- Events trigger evaluation (for example, a New Candle event every time a candle closes).
- Conditions are true/false checks that determine whether a transition is allowed.
- Actions are the effects executed when transitions occur.
SMITH — The Strategy Editor
SMITH is the visual editor where you design and understand strategies at a glance — no coding required. You can:
- Drag and drop states to organize your logic visually.
- Connect transitions to define relationships.
- Zoom and pan freely to explore complex logic.
- Always see what’s missing via the Checklist of required configurations.
The Creation Checklist
Every strategy must satisfy these items before it can be saved:
- ✅ Context Configured
- ✅ At Least Two States Configured
- ✅ Initial State Configured
- ✅ All States Have Transitions
Once complete, the Create Strategy button becomes available.