February 1


Testing A Simple Momentum Strategy

By Jeff Swanson

February 1, 2021

A few weeks back, I sent my subscribers an email highlighting a momentum strategy idea found on Jonathan Kinlay's website. Within the original article, you'll find the EasyLanguage code for the strategy.

I loaded the code, with its default inputs, into my TradeStation platform and got this equity curve.

It's not very pretty. I had one EasyLanguage Mastery reader email me to say, "That equity curve means the strategy is crap."

I think this comment is missing the point.

What we have here is an idea - not a complete trading system. What was presented was a momentum concept that could become the heart of a trading system. I call the proposed momentum strategy a Key Idea, which just might become a trading system after some work. 

To have a trading system we may have to optimize the inputs, add filters and test different stops. Then we might have a trading system.

It's a good idea to take Key Ideas that you find on the internet and explore them to see if you can extract something useful.

What would I do with this Key Idea? Let's have a look.

The first thing I did to explore this Key Idea's potential is to test the performance on other major index markets I like to trade. Here is the equity curve for NASDAQ, DOW, and E-mini S&P. I'm deducting $5 for commissions and two ticks of slippage per roundtrip trade.


JK Momentum Default YM



Optimizing Inputs

The equity graphs above are a good sign. Why? All the equity curves remain positive across different (similar) markets. However, keep in mind, the stock index markets have a long side bias. That means it's relatively easy to create a good looking equity curve on the long side. Especially when we don't have stops in place, which is the condition we have here.

I'm going to pick the DOW (@YM) market moving forward. Why? No real reason other than the DOW performance appears to be in the middle of the other two.

Next, let's optimize the inputs. I will use the TradeStation optimization feature and exclude the last 40% of price data for our out-of-sample data segment. The first parameters to optimize will be the ones provided with the strategy.

Inputs to Optimize:

  1. ndaysHigh (1-10 steps of 1)
  2. IBSlag (1-5 steps of 1)
  3. IBSTrigger (.1-.9 steps of .05)

I also added a $2,000 catastrophic stop loss value to the strategy.

The optimization of these inputs produced 850 combinations. The first thing I did was organize my results by TradeStation Index across all data. All data means both in-sample and out-of-sample data.

How Robust is the Key Idea?

One of the first things I did was organize the optimization by net profit in descending order. The conclusion is all 850 combinations were profitable, which hints that this Key Idea is robust. That is, there are many different combinations of values that produce positive results. If we only had some combinations making a positive net profit, we could say the Key Ideas is less robust. If only a few of the combinations producing positive net profit, we could say the Key Idea is not robust and would likely abandon our Key Idea.

All Net Profit

The y-axis is net profit. The x-axis is all 850 combination. Every combination is positive.


Next, I reviewed the nDaysHigh input. I noticed it had many 1 or 10 values near the top.

TradeStation optimization results

Many nDaysHigh with a value of 10 or 1.

To get a better look at the nDaysHighI I organized by nDaysHigh and compared it with the average profit per trade. You can see that the higher nDaysHigh value produces more profit per trade. The lower values have an average profit per trade near $100. I like to see higher values when trading on daily bars.

nDays High vs Profit Per Trade

The higher the nDaysHigh values (left most on X-axis) produce higher average profit per trade (y-axis)

Based on the information above I picked ten as the lookback for NDaysHigh.

I then optimized the other two values:

  1. IBSLag
  2. IBSTrigger

I organized the optimization report by TradeStation Index. Many of the combinations looked good. It came down to me picking what I thought was a good looking equity curve. I decided upon a IBSLag of two and IBSTrigger of 75.

So, now we have the following optimized values:

  • ndaysHigh (10)
  • IBSlag (2)
  • IBSTrigger (.75)

Below is an equity graph of the Key Idea with the optimized values.

You'll notice that we reserved the last 40% of the price data out-of-sample. Thus, TradeStation did not use that data to optimize. However, we used the out-of-sample performance in conjuction with the in-sample data to help make optimization decisions. The idea here is we want to pick values that produced decent return in both in in-sample and out-of-sample results.


Looking at the equity graph, you can see a vast improvement in our starting equity curve. During this optimization, many different optimizations looked good, which is a positive sign that this strategy may continue to perform going into the future.

On the negative side, I did take the optimized values and applied them to the other related markets (@ES and @NQ). However, the results were not tradable on those markets. The strategies did remain positive, which is good, but I would have liked them to perform better. Does this mean the @YM strategy is doomed?

Not at all.

However, I would perform other vlidation tests such as a Monte Carlo test, Confidence Interval testing, Variance testing, and Noise test to boost my confidence in this strategy. The real test will always be the performance on the upcoming unseen data in 2021 and beyond.

With the other markets (@ES and @NQ), a different set of inputs may work better. Adding filters may produce better results. But don't stop there. What about other markets? We looked at @YM, but that's only one example of what this Key Concept may be capable of producing. Will you find something workable? I don't know. But we come to my main thrust of this article, don't be so quick to dismiss an idea without careful testing. You just might be throwing away a great trading system.

Jeff Swanson

About the author

Jeff has built and traded automated trading systems for the futures markets since 2008. He is the creator of the online courses System Development Master Class and Alpha Compass. Jeff is also the founder of EasyLanguage Mastery - a website and mission to empower the EasyLanguage trader with the proper knowledge and tools to become a profitable trader.

  • Hey thanks for writing the article. I had a couple of questions:
    1.Could you explain the IBSlag and IBStrigger a bit to make their purpose more clear.
    2. If you are using a catastrophic stop loss, what are you using for your exit criteria?
    3. Is your catastrophic stop loss just coded in using a the setstoploss() function?

  • {"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}

    Learn To Code & Build Strategies
    Using EasyLanguage.