The Strategic Trader
Detailed Strategy Evaluation

Back in the saddle

I have been away from trading for a while now. Too long really. With two young kids and a new business, its been difficult to keep up with investing. However,I can not lose sight of my long term financial goals. Going forward this blog will document my success and failures as I work towards reaching $1 million dollars in liquid assets.

In addition to documenting my trades, I will continue to provide insights into various trading strategies. I am a firm believer that technical analysis can produce an edge. However, this is only one part of the equation. Figuring out how to apply a “small” edge and profit from it is the difficult part. This is an area I have really focused on recently and look forward to putting into practice.

Simple Profitable Strategy: Part 1 (Design)

In this article series we are going to take what we have learned from RSI, MACD, Bollinger Bands, and Aroon Oscillator to build a simple yet profitable strategy. For validation, the strategy testing period will exclude 1/1/2000-6/1/2001 and 1/1/2011 – present. This will allow us to perform sanity checks in later phases to avoid curve fitting.

The goal is to build a strategy that is still profitable after taking out both slippage and commissions. Since most of our articles to date have dealt with the 5 minute time frame on ES, we will continue using those parameters.

The Setup:

In order to build a strategy, we have to have a place to start. For this strategy, we will start by combining the best aspects of each of the trading methods we have tested thus far. Starting with the most recent Aroon Oscillator method.  We identified AroonOscillator(8) crossing below -80 as possessing a slight edge, so we will put a stick in the ground here.

Initial Results (Pre commission/Slippage):

Profit: +$54,987
PF: 1.20
Max DD: -$4,662
Sharp: .58
Trades: 6925
Win %: 58.51%
Average Trade: +$7.94

 

This is a good start, but far from profitable once commissions and slippage are applied.

Before we move on to filtering out trades or tweaking the exits we need to add more potential “entry conditions”. In this step we go back through all the indicators that showed a slight edge and see if an optimized parameter combination for it improves overall performance.

The main purpose of this phase is to get as many entries as possible while still remaining over our “statically significant” thresholds. Each individual entry criteria does not need to remain above the threshold, but as a whole when used in an if/or combination the strategy needs to at least exceed on percent profitable or pure profit.

  1. Additional Aroon Oscillator Parameter Combinations
    • No additional combinations improved results significantly. AroonOscillator(27) <-99 helped, but not enough to justify inclusion
  2. Cross below Bollinger Lower Band
    • Bollinger(2.5,7) was added to the strategy
  3. MACD cross below signal line
    • MACD(2,12,4) was added to the strategy
  4. RSI Hidden Divergence
    • RSI Hidden Divergence 29,10,4 was added to the strategy
  5. RSI Hidden Divergence
    • RSI Hidden Divergence 14,22,6 was added to the strategy
  6. RSI Hidden Divergence
    • RSI Hidden Divergence 18,6,2 was added to the strategy
  7. Aroon Hidden Divergence
    • Aroon Hidden Divergence 12,17,4 was added to the strategy

Results:

Profit: +$81,925
PF: 1.15
Max DD: -$4,700
Sharp: .59
Trades: 13600
Win %: 57.32%
Average Trade: +$6.02

trading strategy development

Summary:

Several key metrics decreased from the initial entry condition, but this is to be expected. Now we have a basic set of entry conditions providing over 13,000 trades. In the next several articles we will look at different ways of filtering out the non-performing trades, and implement an exit that makes more sense than a static 5 bar exit.

Eventually we will incorporate advanced concepts such as data mining and neural networks to improve the final product.

 


Share

Trading Methods Using Aroon Oscillator

The Aroon Oscillator is commonly used as a trend following indicator. Meaning buy when trending up, sale when trending down. In this article we will look at the following strategies for trading the Aroon Oscillator:

  1. Buy when aroon oscillator crosses above 0
  2. Buy when aroon oscillator crosses above some value x
  3. Buy when aroon oscillator crosses below 0
  4. Buy when aroon oscillator crosses below some value x

Strategy #1: Buy when aroon oscillator crosses above 0

Almost all parameters result in negative expectancy

Strategy #2: Buy when aroon crosses above some value x

This strategy performs fairly well, as long as x is < 0.  No parameter combination was able to exceed our target thresholds. However, a few came pretty close. The closest one would be AroonOscillator(40) crosses above -99

aroon oscillator strategy 1

 

Strategy #3: Buy when aroon oscillator crosses below 0

Performs better than when crossing above 0, but is not enough of an edge to use in a strategy.

Strategy #4: Buy when aroon oscillator crosses below x

There were several parameter combinations that exceeded both profit and winning % after 5 bars. The best combination was when aroonoscillator(8) crossed below -80

aroon oscillator strategy 2

 

Summary:

Using the aroon oscillator to trade “with the trend”, does not look like a viable strategy. However, buying when aroon oscillator crosses below certain values can yield a small edge. May be useful in filtering out bad trades as we start to build out a strategy.

Source Code:

Download Source



Share

Trading Methods Using Bollinger Bands

Bollinger bands consist of 3 lines. A moving average in the middle, an upper band (avg + x standard deviations), and a lower band (avg – x standard deviations). Commonly the upper band is thought of as overbought territory and the lower band oversold. In this article we will explore several uses of Bollinger bands:

  1. Buying when the price crosses below the lower band
  2. Buying when the price crosses above the upper band
  3. Buying when the price crosses back above the lower band
  4. Buying when the price crosses back below the upper band

Test #1: Buy on cross below lower band

This method tested out well. There were a few parameter combinations that narrowly exceeded our profit and percent profitable targets set for 5 bar exits. The best parameter combination was 1.5 standard deviations and 4 for the lookback period. Here is the equity curve achieved:

Test 2: Buy on cross of upper band

This method did not yield a single profitable result.

Test 3: Buy when price crosses back above lower band

This method is similar to test #1 except we wait for confirmation of price turning around by crossing back above the lower band. Common sense would dictate this strategy should perform well. However, the actual results were closer to Test #2 than Test #1.

Test 4: Buy when price crosses back below the upper band

This strategy was unable to exceed our preset thresholds. Attached is the equity curve for the best parameter combination: 2.5 std, 24 period

Summary:

We discovered that buying on oversold bollinger band conditions can be a viable strategy. However, more work is needed to fully exploit this potential edge.

Source Code:

Download Source



Share

MACD Part 2: Signal Cross (Long Only)

In this article we will explore the viability of trading the 5 minute ES when the MACD crosses the signal line. The signal line is nothing more than a moving average of the MACD values. To start with, we will test a very common strategy (going long when the current MACD  value crosses above the signal line).


Strategy #1
For the first test, we will enter any trade when the MACD crosses above the signal line.

Results: Exit at 5 Bars
A common theme is starting to emerge. Buying on up moves is generally a losing strategy. Buying when MACD crosses above its signal line and then holding for 5 bars is a pretty bad idea. Not a single optimized parameter set was able to turn a profit in this scenario. Winning percentages were decent, but not above the threshold required to be meaningful.


Strategy #2
Buy when the MACD crosses above the signal line and MACD above the zero line

Results: Exit at 5 Bars
Although we are still buying on an up move, the fact that we are above the zero line appears to make a difference. Based on previous testing results related to the zero line, I did not expect the strategy to do well. However, there were quite a few combinations of parameters that were profitable.  The 4,2,2 parameter combination was even able to (slightly) exceed our percent profitable threshold, but fell short of the overall profit goal.


Strategy #3
Buy when the MACD crosses above the signal line and MACD below the zero line

Results: Exit at 5 Bars
Not surprisingly based on the results from Strategy #2 and Strategy #1, this strategy does not perform very well.


Strategy #4
Buy when the MACD crosses below the signal line

Results: Exit at 5 Bars
Some profitable combinations, but no where near significant.


Strategy #5
Buy when the MACD crosses below the signal line and MACD below zero

Results: Exit at 5 Bars
Once again, we come very close to passing our thresholds on percentage and profit, but fall short.


Strategy #6
Buy when the MACD crosses below the signal line and MACD above zero

Results: Exit at 5 Bars
As logic would dictate, because Test #5 performed well, Test#6 did not do so great.

Summary
MACD signal line crosses mostly reinforce the theme that buying after an up move is a losing strategy. However, strategy 2 had an unexpected result. If you buy on signal line crosses and the MACD is above zero, the strategy performs well. In future tests we will need to examine this behavior more closely.

Source Code:

Download Source

Related Posts:



Share

Data mining for strategies

For the past several months, I have been busy working on software to aide in “data mining” the market. With the hope of eventually finding repeatable patterns. The basic premise is to devise software capable of finding patterns that provide an exploitable edge. Because I have been spending all my free time working on this software, I have been falling behind on the pursuits outlined within this journal.

I am hoping to get back into the swing of things, and eventually incorporate the software I have been working on as a way of further discovering what works and what does not work. The software is great at finding an “edge containing pattern” if one exists in the provided data set. However, the most challenging aspect is figuring out what data to provide and the basic constructs of the pattern you are interesting in.

That is why its important to continue down the path that I started within this journal. To most effectively find patterns within the market, you have to have a way of weeding out some of the useless indicators and ideals. Without performing this degree of pre-filtering, the software can not run fast enough to sift through all of the data.

As this software becomes more polished, I will release a version here in this journal as well as utilize it in further weeding out the garbage indicators. For example, by focusing on a single indicator and feeding it into the software, you can “fairly” quickly see if any edge is possible. If the software is not able to extract any repeatable patterns (resulting in an edge), then that indicator is most likely useless in your trading. Unfortunately, the software is not quite polished enough for prime time. In the mean time, I will continue to test indicators the way I previously approached the issue while slowly migrating towards utilizing this data mining software. Eventually replacing most of my analysis of indicators with results found through the data mining software approach.


Share

MACD Part 1: Zero Line (Long Only)

In this series we will test the MACD (Moving Average Convergence Divergence) indicator. Like our other indicator series we will test the results against our 5-minute base line results found here: Long Baseline, Short Baseline, and Risk/Reward Baseline

MACD is commonly used to enter trades based on its position relative to the Zero Line. Our first test will enter long whenever MACD is above the zero line.

Results: Exit at 5 Bars
These results turned out very similar to what we saw with RSI when above 50. Very few combinations were even positive with no results coming close to demonstrating a tradeable edge.

Results: Exit Using 1:2 Risk/Reward Ratio
Not a single combination resulted in a net profit. Clearly it is not wise to buy when MACD is above the Zero Line.

Now we will test the MACD below the Zero Line. Based on the above results, we expect being below the Zero Line to outperform.

Results: Exit at 5 Bars
No combination was able to surpass our targets for total profit. However, a large number of combinations surpassed our percent profitable threshold. This indicates a potential edge, however the edge is likely too small to surpass trading costs such as commission. May be useful as a filter to filter out losing trades.

Best Combination: Fast = 2, Slow =4 Smooth =4

Results: Exit Using 1:2 Risk/Reward Ratio
No combination came close to our thresholds. This combined with the failure to reach profit thresholds using 5 bar exit, further underscores this strategy as containing a very weak if any edge.

Summary
There may be a slight edge when entering trades while below the Zero Line. However, by itself it is not tradeable. In future articles we will look at ways of using this filter to improve our overall edge.

Source Code:

Download Source

Related Posts:



Share

Exit Strategy Part 1

Entries are important, but exits are where you make your money. A strategy can not be complete without fine tuning both sides. In this article series I will explore various exit strategies to determine which are effective and which are not. The end goal is to create an exit strategy that makes a random entry strategy profitable.

To succeed the exit strategy must remain profitable over 100 continuous runs with an average profit factor over 1.2. The random entry strategy will target 5,000 trades over the testing period. This is a rather lofty goal. In fact, it may not even be possible. However, we can learn a lot about various exit strategies and dynamics by attempting it.

Time Based Exits
This is a very simple concept. Exit after x number of bars have passed. We use this method often while evaluating entries because it provides a good reference point.

Results:
As we already knew, this method fails to make a random entry strategy profitable. The best results were only able to achieve 44 of 100 runs profitable and -$2,000 average profit.


Trailing Stops – Ticks
I will use NinjaTrader’s SetTrailStop() method set to CalculationMode.Ticks.

Results:

No combination produced a single profitable run.


Close > Close 1 Bar Ago
The strategy will exit if Close > Close 1 Bar Ago.

Results:

This was a a big surprise. The strategy was actually profitable on 88 of 100 runs with an average profit of +$8,823.  PF = 1.05, WIN % 68


Close < Close 1 Bar Ago
The strategy will exit if Close < Close 1 Bar Ago.

Results:

Only profitable in 5 runs


Close < Low 1 Bar Ago
The strategy will exit if Close < Low 1 Bar Ago.

Results:

15/100 Runs


Close > High 1 Bar Ago
The strategy will exit if Close > High 1 Bar Ago.

Results:

Profitable in 92/100 runs. Average Profit +$15,931 PF = 1.07 Win % 68


RSI(30) > threshold
The strategy will exit when RSI is above a certain threshold. When testing RSI we determined there was an edge to short when RSI went above a threshold. Therefore, we can assume it may be a good time to exit long positions.

Results:

As expected the strategy performed well. Profitable in 82 runs. Average Profit +$10,131 PF = 1.04 Win % 71

Summary:

So far we have only looked at very simple exit logic and already see that reaching our goal may be possible. Future articles will be one article per exit strategy as we begin to tackle much more complex exit strategies.

Related Posts:



Share

RSI Part 9: Risk/Reward

Before temporarily moving away from RSI, I want to evaluate each method one more time using the risk/reward test discussed in this article: Risk/Reward Testing

Crossing Above a Threshold:
Surprisingly many parameter combinations performed very well. Unfortunately, no combinations were able to exceed our desired targets.

Crossing Below a Threshold:
This method performed horrible based on this metric. This is what I thought might happen, and the reason I wanted to perform this test. Buying when oversold is a high percentage play if your nimble. But from a risk/reward standpoint its a hard strategy to trade.

Normal Divergence:
This method still did not contain any tradeable edge. Performs very poorly.

Hidden Divergence:
No combination was able to exceed our lofty targets, however several combinations missed by only fractions of a percent. This further underscores the fact that RSI Hidden Divergence contains a tradeable edge.

Related Posts:



Share

Testing setup: Risk/Reward

I believe any tradeable edge should find trades that quickly become profitable. However, there are many ways to make money. We should also evaluate a strategy based on its risk/reward profile. A strategy may not be profitable 3 or 5 bars into the future like we have been testing, but may still signify a turning point with low risk. Before evaluating strategies based on risk/reward we have to establish a baseline to eliminate bias in our data set.

In this article, we will once again be running random simulations. We will use a 1:2 risk:reward ratio. Entries will be random based on the target number of trades (500,1500,5000). The strategy will set a profit target 3 *ATR(14) above the closing price and a stop loss 1.5 * ATR(14) below the closing price. The strategy will exit when the first target is hit or end of the day. Whichever comes first. After 100 random simulations we will then average all of the results and produce targets like we did in this article: Testing Setup

Baseline Results for 5,000 trades (Long):

Percent Profitable: 34.18%
Expected Return:  -$29,377
Target Percent: 36.86%
Target Return: +$38,493

Baseline Results for 1,500 trades (Long):

Percent Profitable: 34.37%
Expected Return:  -$8,587
Target Percent: 40.79%
Target Return: +$36,331

Baseline Results for 500 trades (Long):

Percent Profitable: 34.73%
Expected Return:  -$1,886
Target Percent: 45.54%
Target Return: +$26,455

Now we will perform the same simulations to determine the bias for short trades. We are still using a 1:2 risk/reward ratio.

Baseline Results for 5,000 trades (Short):

Percent Profitable: 32.23%
Expected Return:  -$34,763
Target Percent: 34.8%
Target Return: +$33,439

Baseline Results for 1,500 trades (Short):

Percent Profitable: 31.98%
Expected Return:  -$11,147
Target Percent: 37.69%
Target Return: +$32,599

Baseline Results for 500 trades (Short):

Percent Profitable: 31.58%
Expected Return:  -$4,478
Target Percent: 40.94%
Target Return: +$21,362

Based on these results it is very clear that using a 1:2 risk/reward ratio requires a great entry. I believe the random entries fared so poorly due to all of the noise in the markets. This should serve as a good indicator when comparing edges.

Source Code:

Download Source

Related Posts:



Share

Archives

Designed by Get Paid Online and coded by Australian Survey Sites and Cashcrate.