Most methods for placing stops are based on either money management principles or technical analysis. Using Bayesian Inference is an alternative solution that lets you update your stops periodically to account for new price data. This assures that you always have a mathematically optimal stop set.

**How Bayesian Stops Work**

Bayesian Inference allows you to make a prediction about an uncertain future event and then adjust the probability of that prediction happening as more data is introduced. Applied to trading, Bayesian Inference allow us to project an expected positive outcome of a position as we establish it, and then adjust our expectations as time passes and more price data is introduced.

In a perfect world, every position we establish would move in a straight line from our entry point to our target profit point, increasing the same amount each day. Obviously, this doesn’t happen.

If we break down that ideal daily increase, we can use Bayesian Inference to determine the probability of getting to our original target based on where a position actually is relative to its ideal position. We can use that information to mathematically determine when our position has strayed too far from its expected path.

**How Bayesian Stops Are Calculated**

The first step in calculating where to place your Bayesian stops is to determine your initial position, target price, and expected time frame.

As a system trader, **I don’t like the idea of forecasting prices**. In order to apply this idea to system trading, I replaced the idea of “forecasting” with “projecting backtesting results.” This means that we are using fact based, tested numbers for our projections, not pulling numbers out of the clouds.

Once we have those numbers, we can calculate our ideal path with respect to whatever timeframe we are trading. This is done by dividing the projected profit by the time frame. We will also need to estimate the price range that will compose the middle 50% of our prior probability bell curve.

After the first time period passes and we receive our first data point, we can plug that into our Bayesian probability formula to calculate the mean of the posterior probability distribution.

The Bayesian formula looks like this:

**Posterior Probability = ( Probability of E given H * Prior Probability) / Marginal Likelihood**

While breaking down this formula in depth can be an enjoyable way to spent a weekend for a stats nerd like myself, you could also google “bayesian stop excel spreadsheet” and download a spreadsheet that will do all of the complicated math for you.

When all of the complex math is behind us, we just need to make sure that the mean of the posterior probability distribution stays above the ideal path that we projected. Our stop is the point where the mean posterior probability distribution drops below the ideal path. At that point, our trade is mathematically too far removed from the projected path to recover.

**Example Using The 10/100 SPY System**

Since I just wrote about the backtesting results of the 10/100 SPY Long Only System, let’s use that as an example.

The system last gave a buy signal on December 7, 2012. The price on that day (adjusted) was 140.78.

Backtesting results have shown that the 10/100 system has an average profit of 3.2% and an average trade length of 12 weeks. Using that data, we can expect the system to increase 4.51 over 12 weeks, or .38 / week.

By pulling the historic price data, we can put together the following chart:

As you can see, in each of the first four weeks of this trade, the mean of the posterior distribution was higher than the ideal path we projected. This held true even after the third week when the position was showing a loss. As we all know, this trade ended up being extremely successful.

**Advantages & Disadvantages For System Traders**

As you can see, using Bayesian Inference to set stops could be very beneficial to a systems trader. It gives us the ability to take the results of our historical backtesting and project those results forward.

It also gives us the ability to establish trailing stops that will always be adjusted to the mathematically optimal position based on what the market is actually doing.

On the other hand, this method implements some extremely complicated statistical analysis. This goes against the simplicity that is the root of most trading system approaches.

There is also a strong possibility that anyone implementing this method will not give enough respect to the fat tail, or black swan, events that actually happen far more often than a standard distribution says they should. Therefore, this could end up being an overly risky method.

Scott says

“As a system trader, I don’t like the idea of forecasting prices”

Please elaborate!

Andrew Selby says

Forecasting can easily be confused with predicting, and no one likes to admit that their predictions were wrong.

I probably should have used the word predicting there instead.