Step One In Building An Intraday Trading System

September 26, 2016 5:00 am7 commentsViews: 5379

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
GoShort = true;
GoLong = false;
Else If ( MyRSI > BuyZone ) Then
GoShort = false;
GoLong = true;
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;

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.


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
// Trade Logic goes Here

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
MyRSI = RSI( Close, RSILookBack );
If ( MyRSI < ShortZone ) Then
GoShort = true;
GoLong = false;
Else If ( MyRSI > BuyZone ) Then
GoShort = false;
GoLong = true;
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;

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.


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.


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.


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).


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.


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

Jeff is the founder of System Trader Success – an inBox magazine dedicated to sharing great ideas and concepts from the world of automated trading systems. Read More Google

Facebook Twitter 



  • Thanks Jeff,
    An automated /6e intraday trend system makes good sense to me.
    I hope you continue the thread… perhaps testing some Aurora methods as well?


  • Good stuff really enjoyed it. I have a question though. Once you run this and find the session/sessions where the system does best. Do you then go back to the baseline system to keep developing? Or just continue to use this session time for building. I know in your ebook you return to baseline after adding filters etc.

    • Thanks Derek. The concept presented is the “key concept”. I tested the key concept upon various sessions to see which was most effective. After applying the key concept to a best-fit session, that would be our baseline system. From this point onward I would continue to develop the system against the baseline, which is the key concept applied to our targeted session. I would not investigate other sessions. Let me know if this is not clear.

  • Jeff I am trying to run a simple Study on ES to test the buy time in the morning and then close at the end of the day to see if there is any sort of an edge. I modified your function and set the code up as a strategy. Cant seem to get this to work what so ever. The optimization engine goes through the time increments improperly and tests times like 990 which is not a real time. Any thoughts on this? I also don’t get any trades generated.

    THE_OPEN (0930),
    THE_CLOSE (1600);

    // define ALL your variables for storage.
    Var: jMinofDate(0),TimeVal(0),MinOfDate(0);

    jMinOfDate = Intportion(MinOfDate) ;

    TimeVal = fracportion(computerdatetime) ;

    MinOfDate = TimeVal*1440 ;

    // The open
    If ( jMinofDate >= THE_OPEN ) And ( jMinofDate < THE_CLOSE ) Then
    Buy next bar market;

    • If you would like to test different entry and exit times I would take advantage of TradeStation’s built-in support for Time. I’ll assume you are working with minute charts.


      if ( Time = OpenTime ) then buy next bar at market;
      If ( Time = CloseTime ) then sell next bar at market;

      I just typed this from memory and have not compiled it. However this should get close to what you want. In the example code, you can test various entry and exit times.

  • Thanks for sharing this process. I really enjoy your blog!

    In your EasyLanguage code you refer to BearTrend and BullTrend. I assume that these are booleans set elsewhere in the code…? Or maybe built-in EasyLanguage functions? How are they calculated?

    • Sorry about the confusion. It appears the download code does not have those Boolean values. I was most likely testing these Boolean values and they made it into the article but not into the download code. Those are just booleans. I’ll often use those as a longer-term filter. Often Bulltrend is true when price is above its 200-day moving average.

Leave a Reply

Time limit is exhausted. Please reload CAPTCHA.


Download these four simple steps to help ensure you make money on the live market!