Automation Concepts


What is a automated trading strategy

An automated trading strategy is a set of rules that determine which stocks to trade and when to trade them. Unlike a one-time automated trade, an automated trading strategy runs on multiple securities and specifies both the entry conditions to open new positions and the exit conditions to close them. These rules can be based on fundamental and technical indicators, price movements, or other mathematical models. There are various types of algorithmic trading strategies, such as trend-following strategies and contrarian strategies. Investfly's platform is recognized as one of the best automated stock trading platforms and best algorithmic stock trading software available, supporting a wide range of algo trading strategies.

Components of Trading Strategy

Automated trading strategy will always have following components:

trade history
Automation Scope

The stock market comprises a vast array of stocks, including penny stocks, large-cap stocks, tech stocks, and retail stocks. Running an automated trading strategy or algorithmic trading strategy across all these stocks is impractical and unlikely to yield consistent results. To optimize your trading strategy using Investfly, one of the best automated stock trading platforms and best algorithmic stock trading software available, it is essential to narrow down your focus. Investfly offers three methods to define the scope of your algo trading:

  1. Predefined Lists: You can use our predefined list of stocks such as SP500, DOW_JONES_INDUSTRIALS

  2. Custom List: You can provide your own custom list of stock symbols separate by comma ( e.g AAPL, WMT, TSLA)

  3. Dynamic Filter: You can provide a expression based on fundamental indicators (e.g MarketCap > 100B)

You can think of automation scope as an instruction to determine which stocks to trade.

Open Trade Condition (Entry Condition)

Entry conditions determine when to execute trades for the stocks identified in your trading strategy. Timing is crucial in automated trading and algorithmic trading, so it's essential to use time-sensitive indicators like Price, SMA, and RSI. For instance, fundamental metrics such as Net Earnings are not ideal for entry conditions in algo trading because they do not fluctuate frequently. However, Net Earnings can be useful for defining the Automation Scope 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.

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 history

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.

An automated trading strategy is inherently non-deterministic, leading to different outcomes even with the same strategy.

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.

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. This approach ensures your trading strategy remains effective and adaptable within the realm of algo trading.

  • 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.

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. Additionally, our algorithmic trading software offers:

  1. Timeout Condition - The position is closed after a specified timeout period (e.g., 3 days, 20 minutes, etc.).
  2. 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.

Overall, these are the major components of the trading strategy. However, there are more details that we will cover in Create Trading Strategy