Home / System Trading

System Trading

Abnormally Overbought Is Not Bearish

Often the market will trade in one direction until it reaches an overbought or oversold state. Professional traders tend to fade an overbought/oversold market while rookies will buy/sell in the direction of the short-term trend.

More rare are the times when the market exceeds a standard overbought/oversold state and trades itself into abnormality. When this happens, the standard measures of overbought/oversold tend to fail. Traders can get hurt in an abnormal market if they keep fading it.

By at least one measure, we find the current market in an abnormal state. And this is why I was surprised to see Bespoke’s article that seemed to suggest that a sharp pullback was near. Granted, I’m not a premium subscriber so I was not able to read the entire article.

When measuring for abnormality on the S&P 500 (especially in terms of mean-reversion), I use Bollinger Bands built around a 50 day average with the top band 2 standard deviations above the mean. Oddly enough, these are the same settings Bespoke is using. I use an asymmetrical setting for the bottom band.

Here is how I use this measure: If the S&P 500 closes above the top band, it forces any open shorts to be closed. No new shorts are opened as long as it continues to trade above the top band. This is a binary approach. One could also reduce position-size for shorts as the S&P 500 gets closer to the upper band, with size becoming zero as it crosses the upper band.

Why do I do this? Let me demonstrate…

Buy Rule: Buy the close when SPY closes above the upper Bollinger Band (50,2).

Sell Rule: Hold this trade for X days, selling at the close.

All SPY history was used. All trades are frictionless.

The Results:

The left axis is the Avg. % Profit/Loss and the right axis is the % of Winners.

  • Holding 1 day made 88 trades. Holding the maximum 50 days made 37 trades.
  • There is some mean-reversion that happens after a close above the upper band. It peaks around day 6. However, the average trade barely goes into the negative.
  • The average trade peaks ~8 weeks later at ~2% gain.
  • The mean-reversion is shown most clearly in the % of Winners, which falls beneath 50% around day 6.
  • The % of Winners peaks several times near 70%, with its highest peak of ~72% arriving nearly 8 weeks after the entry.


This is not a setup that will make one rich going long. It is, however, a setup that may keep one from going broke while shorting an abnormally overbought market. While a pullback is likely over the next week, it is not likely to be very deep. System traders are urged to develop their own measures of abnormality.

MySimpleQuant gave a very similar treatment to this issue yesterday…Check out his results.

Comments »

Short Term Mean Reversion Still Working

The equity curve shows the results of buying the SPY first close beneath the 2 day moving average (dma) and then closing the long position on the first close above the 2dma. It also sells short the first close above the 2dma and covers the short on the first close beneath the 2dma. In short, it is in the market all the time, trading around the 2dma.

The system uses 10K starting equity, and compounds gains. No stop losses were abused in the making of this system.

Results do not include commissions or slippage, and adding commissions of $7.00/trade lowers the win rate to 62.2% and drops the annual return to 31.80%, reducing net profit by almost 9K.

The point is not to consider this is a viable system, but instead to observe and ponder the anomalies that come and go. I have been wondering for some time now how long it will be before this pattern changes.

If nothing else, when such a simple system works so well, for as long as this one has, I think that certainly the hardest part of trading is mastering the psychology. For example, I doubt even one person reading this has been trading a very short term moving average, religiously, despite the fact that the success of short-term mean reversion has been discussed by many bloggers.

I also wonder, if the same system was backtested during the previous (few) periods in market history where a very short term mean reversion system worked, and some ratios were developed to describe performance, with special attention applied to the ratios when it was outperforming versus ratios as it begin to fail, if a similar set of ratios would also exist for the current data.

Ultimately, the holy grail may be a simple system-health tool, able to be normalized across diverse trading systems, which would turn a system off before a meltdown. If such a tool were to exist, any new anomaly which lasted long enough to collect sufficient system-health data, could be traded.

Its fun to think about, anyway.

Comments »

Probability of a Pullback Very High

I have two different systems, using two different entry methods, that are both signaling that there should be some weakness ahead over the next several days.

Granted the Bamboo is one of the systems, and over the last 23 trades has only been right 47% of the time. However, over the past 90 trades, since November 15, 2007, it has been right 78% of the time.

The other system, which trades less frequently than the Bamboo, is also calling for a reversal. Since November 15, 2007 it has closed 44 trades and has been right 84% of the time. Over the last 20 closed trades, the system has been right 80% of the time.

The methodolgy behind these systems has been tested on other indexes and maintains the general win/loss percentage across longer time frames. Because the two systems referenced in this post trade the leveraged ETFs, some of which are new, testing over longer time frames is difficult.

Two other systems, the VIX Stretch and the CCI System are close to signaling short entries. Another up day on Monday will likely trigger the VIX stretch short entry. A down day on Monday will likely trigger a CCI short entry.

Yet another system, tested back to 1994 on the SPY, is already short. It has a 60% win rate on short trades.

Truly, last week was very bullish. Many traders have noted that the two 90% up volume days in one week suggest real strength. I will stick to the probabilities. I feel very confident that a reversal is imminent and am positioned for it. My confidence should probably be faded… We’ll see what happens this week.

Comments »

First Attempt at Pivot-Based System

Carsten’s post about a simple pivot-based trading system was intriguing to me mainly because I have never tried to code such a system. I guessed that coding a proof-of-concept of the system would be pretty easy, and it was.

Here is the code for Tradestation:

ATRLength( 10 ), // I used Average True Range as a substitute for Carsten’s “volatility.”
Length( 10 );

ATR( 0 ),
S1( 0 ),
R1( 0 ),
PP ( 0 );

ATR = AvgTrueRange( ATRLength ) ;
PP = close[1];
S1 = PP – ATR;
R1 = PP + ATR;
If close <= S1 then buy next bar at market;
If close >= R1 then sell short next bar at market;

If currentbar > 1 and marketposition = 1 and close = highest(close, 3) then sell (“LX”) next bar at market;
If currentbar > 1 and marketposition = -1 and close = lowest(close, 3) then buytocover (“SX”) next bar at market;

Here are the results and the equity curve. I assumed 10K starting equity, purchasing only one contract per trade, with no compounding of gains.

Not bad for a first pass. The equity curve is not nearly as nice as Carsten’s version, but again, this was more for practice than anything else.

Below are some recent trades:


I know very little about pivot points, how to calculate them, how to trade them, etc. I need to do much more reading on the subject.

I also know very little about trading S&P E-minis and need to complete more study on trading them as well.

This system can obviously be improved. Right now it suffered some large drawdowns and was underwater for well over 100 trades.

I’m hoping the collective wisdom of the community here can help produce an improved V1.1

Comments »

More On the Pivot-Based Trading System

Turns out that BZB Trader also saw Carsten’s work on the pivot-based trading system.

BZB writes: “Supporting my on-going research into the value of pivots for forecasting market direction, Cucca recently sent me a link to one of Henry Carstens pivot based trading systems. Cucca also posted the code for a little MeClellan based system (in comments section of his blog) that produces some impressive results.

Henry’s pivot aproach is worth a look and I’ll probably be deconstructing the system later in the week as I explore more pivot based mean regression systems. Henry doesn’t explain exactly how “volatility” is defined, so I’ll just jump in and offers some suggestions.

Today’s offering is a variation of my earlier SD signal line study and simply looks at the value of the PP buffered by a lookback at a Len1 moving average of the PP and converted to a zero line value by dividing the resultant by the stadard [sic] deviation of the range.

Later this week I’ll look at the same theme using the R1-S1 pivot range as well as several other permutations.”

Read the whole article here, including the Tradestation Code: Mean Reversion Pivots

BZB also submitted another piece on this topic here: Pivot Range Reversion

Comments »

How To Build a Simple Pivot-based Trading System

I know many of you are becoming more interested in a trading a system, especially after what the markets have been doing over the past 1.5 years.

Henry Carstens over at Vertical Solutions is a phenomenal resource for systems traders. He recently published this simple pivot-based trading system. I like it because it demonstrates how traders can take a system that they trade discretionarily, use language to quantify the setup and exit, and voila! Describing the setup in terms that can be quantified is crucial, and any traders looking to build a system should spend some time describing their set ups in this way.


A pivot based trading system defines a focus of trading action, the ‘pivot point’ and places support and resistance lines around that point where trades can are to be entered and, perhaps, exited.

Calculation of the pivot point can be quite intricate but using yesterday’s close is a simple place to start.

For support and resistance there are again a dizzingy array of choices, but the volatility over the last 10 days is another easy place to begin. So…

  • Support is: pivot – volatility(10), and
  • Resistance is: pivot + volatility(10)

The entry rule for pivot systems is simple:

  • Buy at support, and
  • Sell at resistance

The exit rule was a bit tougher, but this seems reasonable and works:

  • Exit longs at the highest close of the last 3 days, and
  • Exit shorts at the lowest close of the last 3 days

Results for the sp e-mini contract, daily bars, 01/01/98 – 02/24/09:

  • 200/285, 70%, avg 7.0 pts, sd 26.0 pts, t 4.4

The system is profitable in all years since 1998, it trades both long and short (important for adaptability to market changes), and is statistically valid (t score).

All it lacks are stops. Which are a problem…but may only mean that pivot points are better indicator foundations than trading system foundations. Note also how well the simple choice worked at each decision point in designing the system.

Please click over to Vertical Solutions to see the equity curve for this system.

Comments »

Forgive Me, For I Have Sinned

I have over-ridden one of my systems three times in two days. I really feel like I need to confess. This behavior cannot be tolerated.

As much as I try to ignore the noise, it is very hard.

The economy, employment, etc., are not the market. While I am extremely concerned about our country and the welfare (not that kind) of my fellow citizens, my angst should not be expressed through my trading.

When I want to express how concerned I am about our country and the economy, I think that my first reaction is to buy or sell something. In essence, I think that I’m taking a situation in which I find myself pretty much powerless to do anything to fix it, and through trading, I’m giving myself the illusion of doing something about it.

I hope that makes sense. For a systems trader, it is crucial to not over-ride the system. I’m trying to understand why I have over the last two days.

Comments »