← All Articles
Blueprint desk with technical precision gears assembling a trading strategy

Algorithmic Trading Fundamentals · Module 4 of 6

Build your first algorithmic trading strategy in three steps.

You have indicators. You have conditions. Now it's time to attach actions and build a complete rule you can inspect before testing or deploying it.

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

Start with a real strategy, then inspect its rules

NexusTrade QuickTest results for Magnificent Seven rebalancing strategy: +27.6% total return, Sharpe 1.07, Sortino 1.59, Max Drawdown -17.3%
Magnificent Seven rebalancing strategy — QuickTest results: +27.6% total return, Sharpe 1.07, Sortino 1.59, Max Drawdown -17.3%.

I spent two years trying strategies that didn't work.

RSI crossovers. 50-day SMA breakouts. Dollar-cost averaging into positions I had no real thesis for. Some of it made money. Most of it didn't. And the strategies that did work were usually the dangerous kind: leveraged plays that looked brilliant until the one time they didn't.

The Magnificent Seven rebalancing strategy was the first one I could actually defend.

The thesis was real. In 2021, I took my first intro to deep learning course. I understood, before it was obvious, what AI was going to become. NVIDIA, Google, Microsoft, Meta, Amazon, Apple, Tesla. These weren't just stocks. They were the infrastructure of the next era. Equal weight. Rebalance monthly. Stay in.

When I ran the backtest, it confirmed what I already believed. The returns were there. The Sharpe ratio held up. The drawdowns were manageable. Conviction backed by data. That was something I hadn't felt with any strategy before.

That conviction became a strategy. And this module is about how that transformation happens: from a belief you carry in your head to a set of rules that runs without you.

Most traders have ideas. Few have rules. An idea is "I want to buy quality stocks when they're oversold." A rule is "if RSI is below 35 AND revenue grew more than 10% year-over-year AND price is below the 50-day SMA, then buy 5% of available cash." The difference between those two things is the difference between hoping and trading.

When the draft returns, check the seven resolved assets and equal targets, the monthly condition and Rebalance action. Then choose explicit common test dates and inspect the resulting orders and remaining cash. The screenshot above reports 27.6% return, Sharpe 1.07, Sortino 1.59 and 17.3% maximum drawdown for the original QuickTest; its complete dated run receipt is not printed here.

The diagrams and optional code below explain how conditions and actions represent a rule. You can build through the request and review the resolved configuration before learning that representation.

STRATEGY CONDITION tree of indicators And price < SMA(50) Base RSI(14) < 35 Base revenueYoY > 0.10 Base evaluates TRUE → action fires lhs indicator rhs indicator or value ACTION one per strategy type: "Buy" targetAsset: "AAPL" amount.type: "percent of buying power" amount.value: 5
A strategy is one condition and one action. The condition is a tree: an And node with Base conditions at the leaves, each comparing two indicators.

Optional: condition trees and conceptual code

A trading strategy is just a set of rules. That's it. That's the whole secret.

After three modules of building blocks, we've arrived at the answer to the most important question: what is a trading strategy?

Watch · What is a Trading Strategy? — Putting It All Together

"A trading strategy is a set of rules for when you buy and sell stocks. It is composed of indicators, which create conditions, which execute actions."

The following objects explain the condition/action structure. They are conceptual fragments, not an SDK export. Names such as revenueYoY and sectorAvgPE need actual definitions and resolved indicators; the sector comparison’s population and date convention must be specified before it can become a complete rule.

Strategy 1 — "Oversold Quality Stocks"

IStrategy

{
  action: {
    type: "Buy",           // ActionEnum.BUY
    targetAsset: "AAPL",
    amount: {
      type: "percent of buying power",  // AllocationEnum.PERCENT_OF_BUYING_POWER
      value: 5
    }
  },
  condition: {
    type: "And",           // ConditionEnum.AndCondition
    conditions: [
      { type: "Base", lhs: "price",      comparison: "<",  rhs: "SMA(50)"       },
      { type: "Base", lhs: "RSI(14)",    comparison: "<",  rhs: 35              },
      { type: "Base", lhs: "revenueYoY", comparison: ">",  rhs: 0.10            },
      { type: "Base", lhs: "peRatio",    comparison: "<",  rhs: "sectorAvgPE"   }
    ]
  }
}

This conceptual example combines two indicator categories: a technical condition (price below SMA, RSI oversold), a fundamental condition (revenue growing, PE reasonable), and one buy action. Each strategy has exactly one action. If you want an exit rule, that's a separate strategy.

Strategy 2 — "Take Profit / Stop Loss"

IStrategy

{
  action: {
    type: "Sell",          // ActionEnum.SELL
    targetAsset: "AAPL",
    amount: {
      type: "percent of current positions",  // AllocationEnum.PERCENT_OF_CURRENT_POSITIONS
      value: 100
    }
  },
  condition: {
    type: "Or",            // ConditionEnum.OrCondition
    conditions: [
      { type: "Base", lhs: "positionReturn", comparison: ">=", rhs: 0.20  },
      { type: "Base", lhs: "positionReturn", comparison: "<=", rhs: -0.10 }
    ]
  }
}

Two strategies. One portfolio. Each has exactly one condition and one action. Both run automatically every day. That's all it takes.

Key insight

The complexity of a professional trading strategy doesn't come from mysterious math. It comes from combining many simple conditions with precise logic. Every rule is readable. Every rule is testable. That's what makes algorithmic trading auditable in a way gut-feel trading never is.

Want to try assembling one of these? Connect a Public.com brokerage account and get 3 months of NexusTrade Premium free — the brokerage offer is a later step after reviewing the draft, test and paper behavior. The request above starts the example without that detour. The full course covers this module in an interactive video format.


Part of the free course

Algorithmic Trading Fundamentals

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

→

Two questions before we test your strategy.

Question 1

You believe NVIDIA will outperform when it's trading below its 50-day average and revenue growth is accelerating. How do you turn that into an algorithmic trading strategy?

Answer: The conviction maps directly to the strategy structure. The condition is an And node with two Base conditions: price < SMA(50) and revenueYoY > threshold. When both evaluate true, a Buy action fires, specifying the asset (NVDA), allocation type (percent of buying power), and amount. Your conviction becomes a set of rules. The rules run without you.

Question 2

A friend says their "strategy" is to buy when a stock feels oversold and sell when they've made enough. What's wrong with this, and why can't it be backtested?

Answer: There's no strategy here. Only a conviction. "Feels oversold" isn't a condition. "Made enough" isn't an action. Neither can be expressed as lhs indicator [comparator] rhs indicator. They can't be evaluated systematically, can't fire automatically, and can't be tested against historical data. Backtesting requires precise rules. Gut feelings don't compile.

Build your first strategy on NexusTrade

Return to the prepared equal-weight draft and inspect its resolved assets, monthly condition and Rebalance action before requesting a test. The brokerage offer below remains an optional later step.

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 →

Put your research to work

Create a free account to research a company, build a strategy with Aurora, or inspect a historical backtest. Choose the task you want to try.

or

Free to browse. No credit card required.

Discussion

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

No comments yet.