Close Navigation
Trading Mid-Frequency and RV Like a Pro (Part 2): How to Scale Trades

Trading Mid-Frequency and RV Like a Pro (Part 2): How to Scale Trades

Posted August 20, 2025 at 11:29 am

Dr. Nick Firoozye
Algo Trading Ltd on WBS Training

Read Part I of this series to discover common use cases for mean reversion: Trading Mid-Frequency and RV like a Pro (Part 1): Identifying Mean-Reversion with Statistical Tests.

Introduction

Mean reversion trading can be as simple as forecasting the level (or spread) we want to trade, and allocating relative to the forecast, i.e., in the simple case of an AR(1) model (or Ornstein-Uhlenbeck process), we have a model such as


where  is the price level (or spread) at time  and , is the backward differences,  is the long-term mean,   is the autoregressive coefficient, and  is a white noise error term (although we may have other terms in the model, such as a trend, or a seasonal, or some AR terms to capture the short-run dynamics).

In such a model, if we recast it as

where , we can see that the model is mean-reverting if , and it mean reverts to the long-run level , with the speed of mean reversion.

With this model we can forecast the level as:

where  and   are the estimated coefficients from the model, (i.e., they are just found via the OLS regression of  on ). As we mentioned, we could have also considered adding more AR terms, or a trend or a seasonal component.

No matter how complex the model, it is possible to forecast one (as we have done above) or more periods ahead, by recursively applying the model or “bootstrapping” the forecast. We note however that forecast quality often deteriorates as we forecast further ahead.

Optimal Trading Strategies

In all of our discussions, we will assume that returns  are just the PnL of the underlying asset. We could have assumed that they were log-returns, returns, etc. It matters most in how we describe or scale our holdings since in the end whatever strategy we come up with should have PnL denominated in USD.

 We define a strategy as a set of rules that determines how we allocate at time t given our forecast of the level (or spread) for time t + 1. A (self-financing)strategy will have a PnL at time T of:

where, the strategy returns at time are given by the holdings at time multiplied by the return at time t + 1, i.e.,

The holdings at time t should depend on our expectations at time t of expected returns over the following period(s). (In more exact terminology, we would say they are adapted to the filtration at time t, which is the information available at time t). Given that we let our returns be just PnL, our holdings are denominated in USD notional, and if we scale them by the point-value of the given asset, we can think of them as the number of units of the asset we hold at time t.

Optimal Mean Reversion Trading with no costs

One standard (and economically justifiable) method for forming a strategy, given the forecasts, is known as mean-variance optimization (MVO). In the simplest case, we assume that we want to maximize the utility of our holdings, which is a function of the expected return and the risk (variance) of the returns.:

Where:

  • holding at time t,
  •  is the expected return for the next period,
  •  is the variance of the return for the next period or the risk, and
  •  is the risk aversion coefficient (a higher value means more risk averse). Solutions are easily found by taking Euler conditions, where we use plug-in estimators of our coefficients, leading to the standard:

In the single-asset case the solution is not very interesting, but in the multi-asset case, it leads to portfolio allocation, used throughout the fund management industry, and is especially good for motivating the benefits of diversification. As we shall see, this framework is also one of the only ones which balances between risk and return, net of costs.


Optimal Mean Reversion Trading with an AR(1) Process and Fixed Costs

One standard method for trading given forecasts and fixed transaction costs is to apply a single-period Mean-Variance Optimization (MVO) framework and explicitly incorporates fixed transaction costs or slippage costs (i.e., assuming we can trade at the top of book – executing at the best bid or best ask without moving the market). We should note that we will use the term “transaction costs” to be synonymous with “slippage costs” in this post. In many contexts, transaction costs refer to fixed costs (custodial fees, brokerage fees, commissions, etc), while slippage costs refer to the difference between the expected price and the actual price at which a trade is executed, often due to market impact. We will instead use the term “transaction costs” to refer to both fixed and slippage costs, as they both impact the optimal trading strategy.

Asset Price Dynamics: AR(1) Process

As we have mentioned above, we model the change in the asset price, pt, using a first-order autoregressive (AR(1)) process, which captures mean reversion:


Where pt: The price of the asset at time t.

One-Period Ahead Return & Risk

Given the price at time t, the conditional expected return and variance for the next period (t + 1) are:

  • Expected Return: We define the return in this instance to be the price-change, i.e.,  and so 
  • Variance of Return

Optimal Allocation with Transaction Costs

The strategy involves defining a no-trade zone around the frictionless optimal allocation. A trade is executed only when the current holding falls outside this zone. Let  be the holding before a potential trade at time , and let  be the fixed transaction cost per unit traded (i.e., ). The investor’s risk aversion is given by . The utility function to be maximized at each time step is:

Where:

  • : The new position (allocation) at time t
  • : The position held just before trading at time t
  •  : The absolute value of the change in position, representing the trades in that period.
  • : The fixed transaction cost per unit traded. Maximizing this utility with respect to  leads to the first-order condition we describe below. We note that in the case of no transaction costs, the optimal allocation would be , which is the standard MVO based holdings.

Boundary Formulas

Optimal trading with fixed costs leads to trading up to a no-trade zone around the frictionless (i.e., no transaction cost) optimal allocation. If the current holding is outside this zone, a trade is executed to bring the holding back into the zone. If the current holding is already within the zone, no trade is executed.

The no-trade zone is an interval  defined by a lower (buy) boundary and an upper (sell) boundary.

  • Lower Boundary (Buy Threshold) :

  • Upper Boundary (Sell Threshold) :

The width of this no-trade zone is constant: .

Effectively, we will not trade unless the changed expected return is great enough to cover the transaction costs.

Complete Trading Rules

The optimal allocation, , is determined by the following rules:

  1. If the current holding is below the zone (): The expected benefit of increasing the position outweighs the cost. ActionBUY to bring the holding up to the lower boundary . 
  2. If the current holding is above the zone ( ): The expected benefit of decreasing the position outweighs the cost. ActionSELL to bring the holding down to the upper boundary. 
  3. If the current holding is within the zone ( ): The expected benefit of a trade is insufficient to cover the cost. ActionDO NOT TRADE

Complete Trading Rules in Python

We can encapsulate the above rules in a simple set of formulas using the clip function (e.g., in Pandas) given that   or in code we have it as

L_p_t = (beta * (p_t - mu) - c) / (gamma * sigma**2)
U_p_t = (beta * (p_t - mu) + c) / (gamma * sigma**2)
h_t = np.clip(h_t-, L_p_t, U_p_t)

Optimal Trading with Market Impact Costs

For anything but the smallest trade size it is unrealistic to assume that we can trade at the top of book without moving the market. In practice, larger trades will impact the market price, leading to non-linear transaction costs. This section discusses how to adapt the MVO framework to account for market impact costs, which are typically convex in nature. Consequently, we wish to extend the single-period Mean-Variance Optimization (MVO) framework to include non-linear transaction costs, specifically market impact. Unlike fixed costs which lead to a “no-trade” zone, convex market impact costs result in a strategy of continuous and smooth trading. (the continuous trading is also known as “partial adjustment” or “gradual trading” and is sometimes a reason why some traders will not use these models).

1. The General Utility Function.

We augment the standard MVO utility by subtracting a cost term that is a function of the trade size. Let:

  • : The new position (allocation) at time .
  • : The position held just before trading at time .
  • : the turnover or the size of the trade.
  • : A parameter representing the strength of the market impact. Higher   implies higher trading costs.
  • : The power of the cost function (e.g., 3/2 or 2 or ).

The general utility function, , to be maximized at each time step is:

The convexity of the cost function for  ensures that the marginal cost of trading increases with trade size, which incentivises smaller, more frequent trades over large, abrupt ones. Most commonly  is set to  (or close to that by most market participants) while economists tend to like the power of  because it can be grounded in the Kyle Model (as well as leading to closed-form solutions). These lead to different optimal trading strategies.

2. Case 1: Market Impact with |turnover|3/2 (Square-Root Impact Law)

As mentioned above, this model is frequently used in academic literature and is supported by empirical analysis of trade data, often referred to as the “square-root impact law.”

Utility Function

Characterizing the Optimal Solution

To find the optimal holding , we take the derivative of the utility function with respect to  and set it to zero. This results in a non-linear equation:


Strategy and Intuition:

  • No Closed-Form Solution: Due to the non-linearity, there is no simple, explicit formula for . The optimal allocation must be found at each step using a numerical root-finding algorithm.
  • Partial Adjustment: The optimal strategy is to always trade towards the frictionless target (), but never to reach it in a single step (unless ). You only close a fraction of the gap.
  • No “No-Trade” Zone: A trade is almost always optimal, however small. The only time no trade occurs is if the prior holding  happens to be exactly at the new optimal level.
  • Solutions can be found using numerical methods in 1d. In higher dimensions, convex optimization methods can be used (see for example, CVXPY or CVXPortfolio in Python, or CVXgen in C++, as well as many paid convex optimisation packages).

3. Case 2: Market Impact with |turnover|2 (Kyle-like Model)

This model is popular in economic theory due to its mathematical tractability, which allows for a clean, closed-form solution, as well as its theoretical grounding in the Kyle model of market microstructure (which assume noise traders and informed traders, and the resulting impact of trades on the market price, see references). Most market participants will use the square-root impact law.

Utility Function

Characterizing the Optimal Solution

The quadratic nature of the cost function makes the first-order condition a linear equation in , which is easily solved.

Solving for  yields, plugging in the expected return:

Strategy and Intuition:

This solution has a very elegant and intuitive structure. If we define the frictionless target holding as , we can rewrite the solution as:

.

  • Weighted Average: The optimal holding  is a simple weighted average of the ideal frictionless target  and the previous holding .
  • Trading Speed: The fraction of the gap between the current holding and the target that is closed in each period is constant and equal to
  • . This term can be interpreted as the “speed of trading.”
  • Impact of Costs: As market impact costs  increase, the weight shifts towards the previous holding , leading to slower trading. If , the formula collapses to , as expected.

Conclusion
In this post, we have discussed how to trade mean-reversion strategies after identifying the level or spread to trade. We have covered two main approaches: one with fixed transaction costs and another with market impact costs. The fixed costs approach leads to a no-trade zone, which has some practical benefit since most strategies are killed by over-trading, while the market impact approach results in continuous trading strategies. The latter can be modeled with either a |turnover|3/2 or |turnover|2 cost structure, each leading to different optimal trading behaviors. The choice of model depends on the specific characteristics of the asset being traded and the trader’s preferences regarding risk and transaction costs. In practice, traders often use a combination of these models, adjusting parameters based on empirical data and market conditions to optimize their trading strategies.

New research continues to explore more complex models and multi-period trading strategies, although in practice, most traders will use a single-period model, perhaps with adjustments for the specific asset class and the alpha decay of their given strategy.

Further results
We have also discussed the optimal trading strategies in the context of mean-reversion trading, including the use of fixed costs and market impact costs. Continued work in optimal trading rules, incorporating both transaction costs and multi-period optimizations (see, for example Boyd et al and Garleanu-Pedersen). While stops are known to be value-destroying (see Kaminski-Lo), they can be used to limit losses in practice, especially in the context of mean-reversion strategies, and optimal stop-loss and take-profit levels can be derived from the mean-reversion model (see de Prado & Lipton).

Meanwhile practical trading rules can also incorporate parameter uncertainty, and the possibility of model breakdown. In the next post, we will discuss model breakdown, and how to detect it using statistical tests, as well as how to adapt trading strategies to account for model breakdown.

References

Allocation with Fixed Costs

Market Impact Costs & Optimal Execution

Multiperiod Trading Strategies

Mean-Reverting Trading Strategies and Stop-Losses / Take-Profits

Recommended Courses

  • Fundamentals of Algorithmic Trading, on the WBS/Quantshub Platform. This introductory course describes the Algo Trading Sector and common roles for quants, before discussing the overall trading framework with a case study on crypto.
  • Algorithmic Trading Certificate(ATC): A Practitioner’s Guide For a much more detailed course (in total 12 weeks), the Algorithmic Trading Certificate, which is available on the WBS Platform, covers the topic in much more detail, including the statistical tests, the trading strategies, and the implementation details, amongst so much more. It is available both as a self-paced course, and a hybrid course with live sessions.

I am working on a book on Algorithmic Trading, together with Dr Brian Healy, which will cover the topic in much more detail, including the statistical tests, the trading strategies, and the implementation in far more detail.

Trading Mid-Frequency and RV like a Pro (Part 1): Identifying Mean-Reversion with Statistical Tests

Copyright © 2025 Dr. Nick Firoozye; All rights reserved.

Powered by Jekyll & Hamilton

A blog about quantitative finance, machine learning, and algorithmic trading, with naive forays into philosophy, science and programming.

Join The Conversation

For specific platform feedback and suggestions, please submit it directly to our team using these instructions.

If you have an account-specific question or concern, please reach out to Client Services.

We encourage you to look through our FAQs before posting. Your question may already be covered!

Leave a Reply

Disclosure: Interactive Brokers Third Party

Information posted on IBKR Campus that is provided by third-parties does NOT constitute a recommendation that you should contract for the services of that third party. Third-party participants who contribute to IBKR Campus are independent of Interactive Brokers and Interactive Brokers does not make any representations or warranties concerning the services offered, their past or future performance, or the accuracy of the information provided by the third party. Past performance is no guarantee of future results.

This material is from Algo Trading Ltd on WBS Training and is being posted with its permission. The views expressed in this material are solely those of the author and/or Algo Trading Ltd on WBS Training and Interactive Brokers is not endorsing or recommending any investment or trading discussed in the material. This material is not and should not be construed as an offer to buy or sell any security. It should not be construed as research or investment advice or a recommendation to buy, sell or hold any security or commodity. This material does not and is not intended to take into account the particular financial conditions, investment objectives or requirements of individual customers. Before acting on this material, you should consider whether it is suitable for your particular circumstances and, as necessary, seek professional advice.

IBKR Campus Newsletters

This website uses cookies to collect usage information in order to offer a better browsing experience. By browsing this site or by clicking on the "ACCEPT COOKIES" button you accept our Cookie Policy.