← All Articles
Circuit board logic pathways converging into a decision node — conditions and actions

Algorithmic Trading Fundamentals · Module 3 of 6

Conditions and actions: how data becomes a trade.

You have the indicators. Now you need to turn them into decisions. A condition is a rule that evaluates to true or false. An action is what fires when it does. Together, they are the executable logic of every algorithmic trading strategy.

Austin Starks Austin Starks ✦ Founder, NexusTrade ✦ April 2026 ✦ 10 min read

The first time I built a trading platform, I failed.

I called it NextTrade. On paper, it did everything: a backtester, a genetic optimizer, a conditions engine. In practice, it was a toy project whose only real use case was an interesting interview answer.

It was practically unusable. Every trading condition was a TypeScript class. Want to check if QQQ had dropped 1 standard deviation below its 5-day mean? Write the class. Want to combine it with a buying power check? Write another one, then wire them together. Want something more complex? Modify the source code and pray.

So I did what you do when you build something that doesn't work: I open sourced it, stepped away, and took a long break.

Then I built it correctly the second time.

The name was simple. I needed something that came after NextTrade. NexusTrade is what NextTrade was trying to be.

This module is about conditions. The concept hasn't changed since I first wrote that AbstractCondition class. What's changed is who can write one.


A condition is a comparison that resolves to true or false. That's it.

Watch · How to Use Indicators to Build Conditions — Turning Data into Trading Signals

The AbstractCondition class in NextTrade was just a dressed-up version of the same idea I was trying to express in plain English every time I looked at a chart: is this thing true right now? That's all a condition ever is.

An indicator gives you a number. The market doesn't care what you do with it. A condition is the rule you write around that number, a comparison that resolves to either true or false and tells your strategy whether to act.

"A condition is a comparison between two indicators that evaluates to true or false."

For example:

  • SPY's current price > SPY's 50-day moving average → True or False
  • NVIDIA's revenue this year > NVIDIA's revenue last year → True or False
  • Apple's PE ratio < the S&P 500 average PE ratio → True or False
ANATOMY OF A CONDITION INDICATOR A SPY Price current value: $482.30 > greater than INDICATOR B 50-Day SMA current value: $475.10 RESULT TRUE
Every condition is just two indicators, one comparison operator, and a true/false output.

Watch · Trading Conditions Explained — The Second Building Block of Algo Trading

Combining conditions with AND / OR logic

The real power of conditions comes when you combine them. Just like in plain English, you can require multiple things to be true at once — or allow any one of several things to trigger your rule.

AND LOGIC (strict) Position return ≥ 0% Days held ≥ 5 AND Both must be TRUE to sell Profitable AND held long enough OR LOGIC (permissive) Position return ≥ 10% Days held ≥ 30 OR Either triggers the sell Very profitable OR held too long
AND logic requires every condition to be true. OR logic requires at least one. Most real strategies use both.

Here is one real condition, shown two ways.

POSITION RETURN ≥ 0% Entry Buy +return CONDITION: TRUE
Current price above entry — condition is TRUE.
NexusTrade condition builder: SPY position is profitable (up from purchase price), when positions are 0% profitable
The same condition in NexusTrade

Key insight

Indicators give you numbers. Conditions give you decisions. The entire logic of your trading strategy — every buy signal, every sell trigger — is built from chains of conditions evaluated against indicators. Nothing more complicated than that.

You can build this exact condition in NexusTrade right now. Connect a Public.com brokerage account to unlock 3 months of Premium free — or follow the course for the structured path.


Actions: this is where your strategy actually does something.

Watch · Trading Actions Explained — Buy, Sell, Rebalance & Notifications

Actions are the only part of a trading strategy that touch real money. Everything else — indicators, conditions, all of it — is analysis. Actions are execution. When a condition evaluates to true, an action fires.

Buy

Buy order

Purchase a defined amount of a stock — by dollar amount, percentage of portfolio, or percentage of buying power. Can be market order (immediate) or limit order (at a specific price).

Sell

Sell order

Exit a position — sell 100% to close, sell a partial amount, or set a stop-loss or take-profit level. Triggered by a condition evaluating to true.

Rebalance

Portfolio rebalance

Restore your portfolio to a target allocation without manually calculating what to buy or sell. The strategy computes the drift, then acts. For example: hold equal weight across 7 stocks, rebalancing every 14 days.

Notify

Alert / notification

Fire an alert without taking any market action. Useful for monitoring strategies you want to confirm manually before executing, or for tracking conditions you care about.

NexusTrade strategy: Invest equally in the Magnificent Seven tech leaders, rebalancing every 14 days
A complete strategy in NexusTrade — a REBALANCE action fires when the condition "days since last buy order exceeds 14" is true. Condition, action, and universe configured in one place.

Key insight

Indicators give you numbers. Conditions give you decisions. Actions execute those decisions in the market. Put them together and you have a complete strategy. Module 4 shows you how to build one from scratch.


Part of the free course

Algorithmic Trading Fundamentals

6 modules · No code required · Connect Public.com for 3 months Premium free

Two questions before you build your first strategy.

Question 1

You want to build a condition that buys a stock only when it meets ALL of these criteria: RSI below 35, revenue growing YoY, and price above its 200-day SMA. What logical operator do you use, and why?

Answer: AND. All three conditions must be true simultaneously for the trigger to fire. Using OR would fire whenever any single condition is true, which is too permissive. AND logic is stricter — it only triggers when every condition in the chain evaluates to true.

Question 2

What is the difference between a condition and an action? Give a one-sentence definition of each.

Answer: A condition is a comparison between two indicators that evaluates to true or false. An action is what your strategy does in the market when a condition evaluates to true. Conditions are the logic; actions are the execution.

Build your first condition on NexusTrade

Type "buy SPY when RSI drops below 30" and Aurora builds the condition, attaches the action, and has it ready to backtest. What took a TypeScript class in NextTrade takes one sentence in NexusTrade.

Get 3 Months Premium Free — via Public.com

Open a Public.com brokerage account, connect it to NexusTrade, and get 3 months of Premium free.  ·  Or take the full course →

Discussion

Sign in or create a free account to join the discussion.

No comments yet.