Step One In Building An Intraday Trading System

If you have been reading System Trader Success for a while you’re probably familiar with how I develop trading systems. The very first step is to come up with a simple idea to act as the seed or core of your trading system. I call this your key concept. This key concept is a simple observation of market behavior. This observation does not need to be complex at all. In fact, they are often very simple.

For example, here is a key concept: most opening gaps on the S&P market close if the gaps are less than 4 points. This key concept is very simple, and testable. It is from such observation that I’ll often start to build a trading system from.

In this article I want to show you a tool I use to help test key ideas on an intraday chart. Building trading systems on intraday charts (day-trading systems) are some of the more difficult systems to develop when compared to daily charts. First, you must deal with more market noise but even more dangerous are slippage and commissions. Why? Your potential profit per trade is small on a day trading system thus, both commissions and slippage take a bigger bite out of your profits (as a percentage of your P&L). This produce drag on the performance of your system much like a strong headwind slows your advance. In short, it’s more difficult!

The Key Concept

For this example let’s create a simple trend following strategy for the Euro currency futures (EC) market on a 5-minute chart. We’ll use the extreme readings on the RSI indicator as our signal. Because we are using RSI as a trend indicator that means we are looking to enter the market when RSI gives us an extreme reading. That is, go-long at the oversold region and go-short at the lower region.

  • Buy when nine period RSI value above 80
  • Sell Short when nine period RSI value below 20

This might be a little different than how most people would use RSI. Most of the time, it seems anyway, you would fade the extremes. However when it comes to the markets, unconventional can be beneficial. As for the extreme values, those are un-optimized numbers. I just picked them off the top of my head in hopes of looking for a strong swing in ether direction. Also, I picked a value of nine for the RSI look-back period because I wanted it to be more sensitive than the default 14 that is often used. (The value of nine really has no significance. It was not optimized and I could have very well picked seven or ten. I just simply picked it.)

Below is the EasyLanguage code for the key concept.

MyRSI = RSI( Close, RSILookBack );
If ( MyRSI < ShortZone ) Then
begin
GoShort = true;
GoLong = false;
End
Else If ( MyRSI > BuyZone ) Then
Begin
GoShort = false;
GoLong = true;
End;
If ( MP = 0 ) Then Begin
If ( GoShort and BullTrend ) Then Sellshort ("RSI Short") next bar market
Else If ( GoLong and BearTrend ) Then Buy("RSI Buy") next bar at market;
End;

If you code this basic concept up and test it from 08:30 to 15:00 (central) on the EC market what do you think you’ll get? That’s right, a losing concept with an ugly equity curve.

ec_trend_all_sessions_eq_graph

Clearly, we don’t want to trade our system at any time during the U.S. day session. We want to focus when EC is most likely to show strong trending characteristics. If the price of EC is strong enough to push the RSI value above 80 we want price to continue climbing. So, what market session is best suited for this RSI trend system? Or are all market sessions hopeless for this simple trading concept? Let’s find out.

The Session Test

When designing a day trading system one of the first steps I want to perform is to test which market session will likely produce the best results. We are all aware that different sessions exist for any given market. For example, when dealing with the S&P E-mini we have a pre-market session, the morning session, lunch time session, and an afternoon session. Sometimes you can see distinct characteristics within each session.

So, when I’m developing a trading system for day trading I don’t want to blindly trade during every session. I want to be more targeted in my approach. There will most likely be a particular session or two where my key concept will do better than other sessions. In order to test our key idea vs. different sessions I needed to create an EasyLanguage function that can isolate these sessions and execute the key concept individually over those session only.

This is where my “Session Testing” code comes into play. Session Testing is an EasyLanguge function that I wrote to help me in this task of testing various intraday sessions. Using TradeStation’s optimizer I can test my idea across different combinations of sessions and discover how the key concept holds up across each session. Here are the basic sessions:

  1. “Pre-Market” Between 05:30 and 08:30
  2. “Open” Between 08:30 and 10:30
  3. “Morning”
  4. “Lunch” Between 10:30 and 12:30
  5. “Afternoon” Between 12:30 and 15:00
  6. “Close” Between 14:30 and 15:15
  7. “Post-Market” Between 15:00 and 18:00
  8. “Night” Between 18:00 and 05:30
From this list of basic sessions I created several more “sessions” based upon combinations of the above.
  1. “Pre-Market” + “Open”
  2. “Pre-Market” + “Open” + “Morning”
  3. “Open” + “Morning”
  4. “Open” + “Morning” + “Lunch”
  5. “Lunch” + “Afternoon”
  6. “Lunch” + “Afternoon” + “Close”
  7. “Daily Session”
  8. “Night” + “Pre-Market”
  9. “Morning” + “Afternoon”

The 17 different sessions I came up with may not please everyone. Perhaps you have a different idea on how to break the different sessions up and with the code provided you can simply change them to your liking. For example, if you are interested in the European markets and trade those times, you can create your own sessions based around the European markets.

Session Test Function

The session testing function is really simple. You place it within your strategy and pass into the function the session number you wish to test. Below is an example of testing session 1 – what I’m calling pre-market.

TradeFlag = SessionTest( 1 );

The variable TradeFlag will be set to a Boolean value based upon if the current time is pre-market (true) or not (false). Now we can use TradeFlag as a switch to enable/disable our trading as demonstrated below.

If ( TradeFlag ) Then
Begin
// Trade Logic goes Here
End;

What’s going on inside of the function? It’s rather simple as it’s nothing more than a bunch of if-then statements testing the current time. Below is a code snip-it to give you an idea of what it looks like.

If ( SessionToTest = 1 ) And ( Time >= PREMARKET ) And ( Time < THE_OPEN ) Then TradeFlag = true
Else If ( SessionToTest = 2 ) And ( Time >= THE_OPEN ) And ( Time < MORNING ) Then TradeFlag = true
If ( SessionToTest = 3 ) And ( Time >= MORNING ) And ( Time < LUNCH ) Then TradeFlag = true
Else If ( SessionToTest = 4 ) And ( Time >= LUNCH ) And ( Time < AFTERNOON ) Then TradeFlag = true

Here is our code with the session test function applied.

If ( TradeFlag ) Then
Begin
MyRSI = RSI( Close, RSILookBack );
If ( MyRSI < ShortZone ) Then
begin
GoShort = true;
GoLong = false;
End
Else If ( MyRSI > BuyZone ) Then
Begin
GoShort = false;
GoLong = true;
End;
If ( MP = 0 ) Then Begin
If ( GoShort and BullTrend ) Then Sellshort ("RSI Short") next bar market
Else If ( GoLong and BearTrend ) Then Buy("RSI Buy") next bar at market;
End;
End;

Testing All Sessions

Next let’s see what happens when I run TradeStation’s optimizer over each of the sessions. In doing so TradeStation will systematically execute my key concept strategy over each market session and record the trading results. This can be done by simply creating an input value to act as the session number to test. Then you simply optimize over the values 1-17.

After all the sessions have been analyzed I can generate a bar graph representing the P&L for each session. Below is the Net Profit graph which depicts the total net profit from our testing. By the way, we were testing this strategy from January 1, 2003 to December 31, 2011. This time-span covers both bull and bear markets. It’s important to test your key concept over a wide range of market conditions. Slippage and commissions are not factor into these results.

ec_trend_session_optimize

In this case we can see session input value number 12 produces the best net profit. This input value is actually a combination of Open, Morning, and Lucnh sessions. It’s during these times EC market apparently demonstrates strong trending characteristics that we might be able to take advantage of with our key concept.

Let’s now isolate the session input value to 12 and execute our key concept on this specific time. For this test I will deduct $18.50 per round trip for slippage and commissions. Below is the equity graph of our key concept along with some performance numbers.

ec_trend_baseline_eq_curve

There is no optimization here. The code simply trades based off un-optimized RSI signals and the results look promising. Below is the Trade Summary Report.

ec_trend_baseline_report

Please note I have no stops or targets within my test strategy. Instead the strategy simply enters a trade if the proper condition is met and the trade is exited only at the close of the session. That’s it. Remember, I’m not testing a trading strategy. I’m testing a key concept vs. different market sessions. Our goal is to locate the best possible market sessions for my key concept. In this case, which session holds the strongest trending characteristic? Once a session(s) has been identified only then will I continue to develop a complete strategy (containing stops, targets, and other rules) tailored to the top session(s).

Conclusion

There you have it. This type of RSI trend following concept should be developed for the Open, Morning, and Lunch sessions. This makes sense. The big volume and big trends often appear during the U.S. day session. This is also corroborated from a previous Best Times To Day Trade where I explored the hourly range of the Euro Currency market. In that study we can see the hours between 08:00 and 11:00 (Central) have the highest price movement of the EC market.

I would like to point out again, this is not a trading system. What we did in this article is validate our key concept. The code presented in this article does not have stops, a regime filter, volatility filters, profit targets, or any number of other checks and balances we might see in a true trading system. In fact, take a look at the average profit per trade. It’s $15 after slippage and commissions which is too low in my opinion. I would like to see this closer to $50 per trade or higher.

Download

Session Test ELD (TradeStation)
SessionTest Workspace (TradeStation)
Session Test Function (text file)
Session Test Strategy Example

About the Author Jeff Swanson

Jeff is the founder of System Trader Success – a website and mission to empowering the retail trader with the proper knowledge and tools to become a profitable trader the world of quantitative/automated trading.

follow me on: