It’s been a couple of years since I reviewed this potential trading idea of a Euro currency futures scalping strategy. Over the series of articles, which are listed below, I’ve been combing filter to demonstrate how I add different filters to a system based on market conditions.
With regards to testing different filters, you’ll notice that I always go back to the baseline system when testing a new filter to help reduce over-fitting the system to the historical data. It is on the baseline system where it will determine if a given rule is worthy of consideration within the final trading system.
First, let’s go back to our second article where we discovered that our 1% envelope was far from an optimal value and far from an outlier- which is good. We also discovered that as we increased the size of our envelope each trade generated more profit per trade at the expense of generating fewer trades. I’ve concluded to leave our 1% value as it is but I’m going to add this as an input parameter to the next version of the system (available below). The reason why I’m doing this is for when I use TradeStation’s Walk Forward Optimizer down the road, I would want to use this parameter as one of the values to optimize.
Next, we added out timing rules which demonstrated the “quiet hours” as defined by my Central timezone dramatically improved results. Finally in the last article, we determined to remove the volatility extremes enhanced performance. All these filters make some type of logical sense. The market tends to be more choppy during the quiet hours and avoiding high volatility times reduces losing trades.
But there seems to be a problem as no trades appear to be taken.
It was pointed out to me that if you download the current version of the Euro Currency Futures Scalping Strategy and TradeStation WorkSpace no trades are taken. I narrowed the problem down to the volatility filter. In short our filter was disabling all trades because none fell within our desired volatility range. That rage was 60 < X <240.
The Euro range varies, as measured by our trading model code, has ranges well above that. Often values of 900, 1,000, or even 2,000. I’m not currently aware of why the scale apparently changed but, it did. The end result is no trades were being taken. Thus, we need to test the volatility filter again.
Before we do that I want to just review the environmental settings and the baseline results.
Below is the baseline results starting with the equity curve followed by a performance report.
Now let’s get back to testing the volatility filter.
To accomplish our volatility test I need to first capture the volatility on the daily chart. Remember, we are trading on a 5-minute chart so how do we do this? Well, in TradeStation there are built-in EasyLanguage functions which can grab the daily price elements such as open, high, low, and close from the daily timeframe. However, I’m going to show a technique that requires adding the daily price data into our existing 5-minute chart. I’m doing this because this is a valuable skill – inserting different timeframes into a single chart. Knowing how to do this allows you to build trading systems that can access various timeframes within a single chart. This will allow you to generate signals on a daily chart and trade on a 5-minute chart, for example. To learn how to insert another timeframe into a single chart, please read the article, “Access Two Timeframes In EasyLanguage“.
The following code is executed when the Euro session ends. It simply computes the closing day’s range and then computes the 12-day average of the daily ranges. This average value will be our volatility score which will determine if we take trades or not.
If ( Time = SessionEndTime(1,1) ) Then
ocRange = ( HighD(0) - lowD(0) ) * Pricescale;
ocRangeAvg = Average( ocRange, 12 );
volFilter = ocRangeAvg > ivol and ocRangeAvg <= ivol+200;
We then set a boolean flag, volFilter, based upon a specific volatility range. That is, if the volatility is between a specific range of values, we set our flag indicating it’s OK (true) to take trades in the current market environment.
Using TradeStation’s optimization feature I’m going to execute the trading system over the historical data 20 times. For each iteration the volatility filter will be altered to produce a specific 200 “point” range where trades will be taken. The first iteration will test the volatility range between 200-400, then next between 400-600, and so on. This will give us an idea if volatility plays a part in the success of the trading model.
Please note, I’m applying the volatility filter to the baseline trading model – not the trading model with the time filter. I want to independently test the volatility filter to see how it alone affects the performance. At this time, I don’t want to stack filters on top of each other. Below are the results of the volatility study. The x-axis contains the volatility range as measured by our calculation explained above. The y-axis contains the net profit in dollars.
This is a bit choppy. There is no clear winning range. Generally speaking the most profitable bars all fall within the range of 600-3,000 yet, within that range there are three of the largest losing bars as well. I went ahead and selected that range, and allowed the strategy to execute. The results are below.
In the end, this does not appear to be much of a change. I can’t justify keeping this additional filter. Moving on, I did notice something interesting when looking at the length of time between winning trades and losing trades.
By reviewing the performance report of the baseline I noticed that many of the losing trades were trades that had long hold times. Winning trades were often profitable within a few bars. You can see that by looking at the performance report below.
Winning trades required holding for about five bars on average. On the other hand, losing trades were held around 24 bars on average. Perhaps we can add a time limit on all our open trades. Since winning trades tend to have a much shorter holding period maybe we can exit a trade after X number of bars. This might reduce some profits but may also reduce drawdown. It’s definitely worth testing.
I created a new input called maxHoldTime which will be the number of bars to hold an open trade before closing it out. For example, if maxHoldTime is three, this means once a trade is opened it will only be held for three bars (15-minute). If it’s still an open trade after that period, it will be closed. I use TradeStation’s optimization feature to iterate between 2-20 bars. Below are the results. The x-axis represents the maximum bars to hold a trade while the y-axis contains the net profit in dollars.
Well, that does not appear to help. Even at the optimal hold time of 11 bars, we make far less profit and the average profit per trade goes down to $8.16. I really thought I was on to something here but, it looks like another dead end.
In closing this is where we stand with our Euro currency futures scalping strategy. We only have a time-based filter after determining that the newly tested volatility filter is not improving the baseline results. If you recall, the time-based filter limits trading to what I call the “quiet hours”. For more information on this filter, see Testing A Euro Currency Futures Scalping Strategy, Part 2.
Below are the results of our current trading model on the in-sample data.
In the next article I’m going to continue to tackle this trading model to see if I can improve the results at all. After that, it’s time to test this on the out-of-sample data and see how it holds up.
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.