Fundamental Algorithmic Trading Concepts

Understanding the key principles of algorithmic trading and automated trading systems will help you develop more effective and profitable trading strategies.

What is an Algorithmic Trading Strategy?

An algorithmic trading strategy is a systematic set of rules that determine which securities to trade and precisely when to trade them. Unlike a one-time automated trade, a full algorithmic trading strategy runs on multiple securities and specifies both the entry conditions to open new positions and the exit conditions to close them. These automated trading rules can be based on technical indicators, price patterns, fundamental data, or other mathematical models. Common types of algorithmic trading strategies include trend-following algorithms, mean-reversion systems, and momentum-based trading strategies. Investfly's algorithmic trading platform enables traders of all experience levels to create sophisticated automated stock trading strategies without requiring advanced programming knowledge.

Core Components of an Algorithmic Trading Strategy

Every effective automated trading strategy includes these essential components:

Core Components of Algorithmic Trading Strategies

Defining Your Algorithmic Trading Universe

The stock market comprises thousands of tradable securities, including penny stocks, large-cap stocks, technology companies, and retail corporations. Running an algorithmic trading strategy across all these stocks is impractical and unlikely to yield consistent results. For successful automated trading, it's essential to narrow down your focus to a specific universe of securities that align with your strategy's objectives.

Investfly offers three methods to define the scope of your algorithmic trading strategy:

  1. Predefined Lists: Utilize our curated collections of securities such as S&P 500, Dow Jones Industrials, or Nasdaq 100 for your automated trading system
  2. Custom List: Create a personalized watchlist of specific stock symbols for your algorithmic trading strategy (e.g., AAPL, AMZN, MSFT, TSLA)
  3. Dynamic Filter: Define advanced filtering criteria using expressions based on fundamental or technical indicators for your automated trading system (e.g., MarketCap > 100B && Volume > 1000000)

Think of your algorithmic trading universe as the critical first instruction that determines which securities your automated trading system will analyze and potentially trade.

Predefined Market Indices

Standard market benchmarks for broad algorithmic trading coverage

Custom Security Lists

Targeted selection of securities for focused algorithmic trading

Dynamic Filtering Rules

Criteria-based selection for sophisticated automated trading systems

Entry Conditions: When Your Algorithm Opens Trades

Entry conditions are the heart of your algorithmic trading strategy, determining when to execute trades for the securities identified in your trading universe. For effective automated trading, it's crucial to use time-sensitive technical indicators like price movements, moving averages (SMA/EMA), momentum indicators (RSI, MACD), and volume patterns. Fundamental metrics such as earnings data or P/E ratios are generally not ideal for entry conditions in algorithmic trading because they don't fluctuate frequently enough to generate timely trading signals. However, these fundamental metrics can be valuable for defining your initial trading universe in your algorithmic trading strategy.

Entry conditions are crafted as logical expressions using our expression builder. You will incorporate fundamental and technical indicators, price, volume, numeric values, and mathematical operators to construct these logical expressions. For a deeper understanding of how to create effective expressions in the best automated stock trading platform, please refer to our Expression Overview.

Pro Tip: Focus on using technical indicators for entry conditions as they respond to market movements in real-time, while fundamental indicators work better for defining your universe of tradable stocks.

Trade Signal Generation

As described in the expression overview section, a trade signal is generated for any security when the logical expression for that security transitions from a false to a true state. Since the scope may include multiple securities, trade signals will be continuously generated for many of them. There is no guarantee on the order in which the trade signals are generated for different securities, even if they match the criteria at exactly the same time.

It's helpful to imagine trade signals coming in as a random continuous stream in response to the random continuous stream of quotes we receive from the market. This non-deterministic (i.e., random) behavior occurs for two main reasons:

  1. Price quotes received from the market arrive in a random order of securities. Although they are timestamped, multiple quotes with the same timestamp will appear in a random order.
  2. The evaluation of indicators and expressions is performed in a highly parallel manner. This parallel computation introduces a non-deterministic nature to the system. If we were to process these sequentially instead of in parallel, the system would be too slow to handle all market quotes in real time.
Trade Signal Generator

The non-deterministic nature of algorithmic trading means that even if you deploy identical automated trading strategies across different trading accounts, they might trade different stocks and yield varying outcomes. The only certainty is that all your trading rules, including entry and exit conditions, are consistently applied. If your entry and exit conditions are effective, your trading strategy should generate positive returns despite this non-deterministic behavior. If a strategy only shows favorable results in one scenario, it may be due to chance. This randomness can actually benefit you by providing additional validation that your strategy is robust and effective.

Important: An automated trading strategy is inherently non-deterministic, leading to different outcomes even with the same strategy. This is normal and can actually help validate the robustness of your approach.

Portfolio Allocation

As previously mentioned, your trading account will receive a continuous, randomized stream of trade signals (BUY or SELL) generated by your algorithmic trading software. These signals are guaranteed to meet your entry conditions based on the latest price data. Your portfolio will be in various states—differing in buying power, cash balance, margin requirements, and the set of stocks in open positions—as these trade signals are processed. You must decide how to manage your portfolio when a trade signal is received. Should you open a position for every trade signal?

The decision is not straightforward. Suppose you have a $1000 cash balance and receive a trade signal. Should you invest the entire $1000 in that stock, or allocate only $500 and reserve the remaining $500 for future trade signals? Or perhaps invest just $200? This decision involves balancing the number of unique stocks you wish to hold in your open positions against the amount you want to invest in each stock. Investing too much in one stock reduces the number of open positions, while investing less allows for more open positions.

Allocation Strategies

To simplify this task, Investfly allows you to pick two simple approaches:

Invest Fixed Cash Amount

This strategy involves setting a fixed dollar amount, such as $2000, to invest each time a trade signal is generated by your algorithmic trading software. Investfly, recognized as one of the best automated stock trading platforms, will continue to allocate $2000 for each trade signal until your cash reserves are depleted.

Once funds are exhausted, further trade signals will be ignored until cash is replenished. A potential drawback of this method is that as your portfolio's value fluctuates due to profits or losses, the initially set amount may become outdated and require adjustment.

For instance, if you begin with $10,000 and allocate $2000 per stock, expecting to maintain 5 open positions, a significant profit could increase your cash to $100,000. In such a scenario, you should consider updating your investment amount to $20,000 per stock to align with your increased account value.

Maintain Fixed Number of Open Positions

This approach allows you to specify the number of unique stocks you want in your open positions. The algorithmic trading strategy will automatically adjust the investment amount based on your portfolio value.

For instance, if you start with $10,000 and specify 5 unique stocks, the algorithmic trading software will initially invest $2,000 in each stock ($10,000 / 5). If your portfolio grows to $100,000, the algo trading software will adjust to invest $20,000 in each stock ($100,000 / 5).

This method is recommended for most users as it ensures a balanced and adaptive investment strategy, leveraging the best automated stock trading platform and best algorithmic stock trading software available.

Pro Tip: For most traders, especially beginners, the "Maintain Fixed Number of Open Positions" approach is recommended as it automatically adjusts your position sizing as your account grows or shrinks.

Exit Conditions

Establishing clear exit conditions is crucial for any automated trading strategy. These conditions determine when your open positions should be closed. Investfly, recognized as one of the best automated stock trading platforms, supports standard exit conditions such as target profit, target loss, and trailing loss.

Standard Exit Conditions

  • Target Profit - Close when reaching a specific profit percentage
  • Target Loss - Close when reaching a specific loss percentage
  • Trailing Loss - Dynamic stop-loss that adjusts with price movement

Advanced Exit Conditions

  • Timeout Condition - Close after a specified timeout period (e.g., 3 days, 20 minutes, etc.)
  • Custom Close Condition - Similar to entry conditions, you can specify a logical expression to define a close condition

By utilizing these exit conditions, you can enhance the effectiveness of your algo trading strategy, ensuring that your trades are executed precisely according to your predefined rules. Investfly's algorithmic trading software provides the tools you need to optimize your trading strategy, making it one of the best algorithmic stock trading software options available.

Important: Never enter a trade without a clear exit plan. Setting proper exit conditions is as important as, if not more important than, entry conditions for successful trading.

Next Steps

These are the major components of a trading strategy. However, there are more details that we will cover in the Create Trading Strategy guide. Understanding these automation concepts will help you build more effective trading strategies and make better use of Investfly's algorithmic trading platform.

Ready to Get Started?

Start automating your trading strategies today with our free 14-day trial.

Start Free Trial

No credit card required.