February 12


Adapting to Volatility: Strategic Position Sizing for Algorithmic Traders

By Jeff Swanson

February 12, 2024

EasyLanguage, ES, position sizing, stock index futures

In this article lets see if we can get more profit from our strategy without putting too much at risk!

Let’s start with a thought experiment.

Say we have two traders who are each given identical trading systems to execute on the S&P 500 futures market (@ES).  Because both systems are identical copies of an automated trading system, both trading systems generate the same buy/sell signals, use identical stop loss and trailing stop parameters.

These two traders are also going to start trading on the same day, with the same starting account size.  In essence let’s pretend we have two traders that have identical trading circumstances. Let's give these two traders 12 months to trade.  At the end of the trading period, we would expect them to have the same account balance, right?

But at the end of the trading period, reality has made fools of us. One trader generated more net profit. How can this be?

Reviewing the trading results for both traders you can see both traders took the same signals. Both traders have the same win/loss ratio and even the same number of stop-out trades. But there is one difference.

One trader used a simple mathematical formula to determine how many shares to buy and thus, his account grew at a faster rate.

Normalizing Your Risk Per Trade

Position sizing is a critical component of both systematic and discretionary trading, addressing the pivotal question: How many shares or contracts should I purchase? Far too often, the answer is derived from nothing more than a well-informed guess. A common misstep among traders is to size their trades without considering risk, potentially undermining their results, their trading systems, and, in some cases, their careers as algorithmic traders!

By anchoring your trade size to a risk metric, you adopt a defensive stance against the unpredictability of the market. Risk management should be paramount for any trader aiming for long-term success. Therefore, employing a risk-based metric to mathematically size your trades is not just recommended; it's essential. Despite this, the common practice involves using a fixed number of shares or allocating a fixed dollar amount per trade. Let's pause to consider the implications.

Imagine your trading system signals a new buy opportunity. You could, theoretically, risk your entire cash balance on this single signal. A win might double your money swiftly, but a loss could deplete your account entirely. It's evident that staking your whole account on one trade is a gamble far too risky for any prudent investor. This extreme example illustrates a fundamental truth: risking your entire trading capital on a single trade is recklessly imprudent.

So, what's the prudent amount to wager? Maybe 90% of your account? Or perhaps you decide on purchasing 100 shares. Many system developers overlook how trade size influences the risk-reward dynamic of a trade.

As the risk increases, so does the potential reward. Yet, overextend your risk, and a few losing trades could decimate your account. Theoretically, there's an optimal balance between risk and reward specific to each trading system.

Your mission is to identify a nearly optimal level that aligns with your comfort as a trader. While delving into the intricacies of finding an optimal position sizing strategy for a specific trading system is beyond the scope of this discussion, I will illustrate the difference between employing a risk-based position sizing algorithm and simply buying a fixed number of shares—the latter being a common practice that neglects risk metrics, thereby failing to adjust trade sizes according to market conditions.

Does a risk-based approach truly offer an advantage? Let's delve into the evidence.

Our Day Trading Algorithm

We will be using a simple intraday breakout model called, Better Breakout. This strategy was first discussed back in 2012 with the article, Better Breakout Trading Model. Please review that article for the strategy rules. The code is available for all EasyLanguage Mastery subscribers.

Let's load the strategy on a S&P Futures (@ES) chart.

  • Historical data going back to 1/1/2004.
  • Trades are executed on a 5-minute bar
  • All trades are closed at the end of the day
  • A dynamic stop loss based upon the volatility of the market. See the code for details.
  • All trades are long only.
  • We assumed a starting capital of $100,000. 
  • $30 for slippage and commissions deducted for each round trip.

Below is an example of the strategy trading on the daily chart of @ES over the past couple of months. We can see the trade entering early at 9:00 AM central on a big gap up from the previous day. The trade closed at 15:00 PM the same day.

Fixed Contract Position Sizing

The fixed-share method is a non-risk-based method. In this case we simply buy the same number of contracts (1) for each signal. I use this technique all the time when developing a strategy. But it's probably not the best way to trade something live.

Contracts = 1

Percent Risk Position Sizing

The percent-risk method is a strategy grounded in risk management. In this approach, we allocate a fixed percentage of our equity—2% in this example—to risk on each trading signal. The choice of 2% is guided by a widely accepted principle in trading that suggests risking anywhere from 0.5% to 2% of your account balance on any single trade. This strategy aims to mitigate the impact of a series of losses, preventing them from significantly damaging your trading account. We then use this predetermined risk percentage to calculate the specific dollar amount you're willing to risk on an individual trade.


Contracts  = (2% of Account Equity) / ( Stop Loss Per Contract)
Contracts  = (2% * $50,000)/ $500
Contracts = $1,000 / $500
Contracts = 2

In the example provided, we have the methodology to calculate the number of contracts to purchase while maintaining a consistent risk level of 2% of the account size per trade. As mentioned, the stop-loss value for the 'Better Breakout' strategy adjusts based on recent market volatility, as detailed in the original article.

This adaptive approach means that if market volatility increases, our stop-loss threshold will widen. Consequently, to adhere to our 2% risk per trade guideline, we might find ourselves buying fewer contracts. Conversely, in periods of reduced volatility, our stop-loss tightens, allowing us to purchase more contracts without breaching the 2% risk rule.

The essence of this strategy is that we never risk more than 2% of our account on a single trade. This flexibility enables us to adjust the number of contracts traded in response to the volatility of the market, effectively normalizing our risk exposure relative to market conditions.

But what implications does this have for our trading outcomes?

Performance Comparison


Percent Risk

Net Profit



Profit Factor



Total Traders



Avg.Trade Net Profit



Annual Rate of Return



Max Drawdown (Intraday)



NP vs DD



In our analysis, we observed a slight increase in profits while maintaining the same number of trades, without escalating our maximum intraday drawdown. Although our profit factor has decreased marginally, our earnings per trade have improved. Additionally, the ratio of Net Profit (NP) to Drawdown (DD) has also seen an uptick.

It's important to note that in our Percent Risk model, we are not reinvesting profits. We started trading with an account balance of $50,000, which remains constant for the purpose of calculating position sizes. Why adopt this approach? The goal was to evaluate the impact of scaling trades based on market volatility and to compare its performance with that of the Fixed Model. Incorporating profits into our calculations would undoubtedly enhance our returns further. However, I preferred to avoid complicating the analysis with additional variables. This decision was made to provide a clearer comparison and to focus solely on the influence of the position sizing model.

What Else To Test?

The 2% risk value often cited is essentially an educated estimate. While it's a sensible starting point, this figure is also subject to optimization. Generally, it's prudent to keep this risk percentage low, as risking too much on a single trade is universally acknowledged as unwise.

The objective of our test was to adjust the number of contracts to standardize our risk at a 2% threshold, thereby normalizing risk across all trades. This approach has demonstrably benefitted the average trade net profit, indicating that optimizing profits while keeping risk per trade constant is a viable strategy. The results suggest that our methodology has been successful.

Many traders default to methods that do not consider risk, or they arbitrarily decide on the number of shares to trade. Such approaches may not yield the best outcomes for your trading system. After your strategy has been thoroughly vetted and is set to go live, evaluating a position sizing technique to determine its potential to enhance your system's performance is advisable.

Although this discussion doesn't delve deeply into position sizing and its utility in trading enhancement, it aims to underscore the significant influence that a well-considered position sizing model can exert on your trading system.

Jeff Swanson

About the author

Jeff has built and traded automated trading systems for the futures markets since 2008. He is the creator of the online courses System Development Master Class and Alpha Compass. Jeff is also the founder of EasyLanguage Mastery - a website and mission to empower the EasyLanguage trader with the proper knowledge and tools to become a profitable trader.

    • I generally stay away from the Kelly formula because it’s often too aggressive. But it would be kind of interesting worth testing. I’ll put it on the to-do list and update the article. Thanks for the email!

  • {"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}

    Learn To Code & Build Strategies
    Using EasyLanguage.