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.
The First Attempt
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.
From Data to Decision
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
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.
Here is one real condition, shown two ways.
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.
The Output
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.
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
Check Your Understanding
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?
Question 2
What is the difference between a condition and an action? Give a one-sentence definition of each.
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.comOpen a Public.com brokerage account, connect it to NexusTrade, and get 3 months of Premium free. · Or take the full course →
No comments yet.