Daily Stock Analysis

Using patterns generated through the Pattern Searching software we have launched a new website aimed at providing daily Stock Analysis. This website will serve as a way of validating how well the patterns work going forward in an easy to manage and track way. Currently only a few patterns are used in the analysis. However, soon many more patterns will be added. We will eventually post some of those patterns here on this website as well.

Please check it out at: www.mystockanalysis.com


Share

RSI Pattern Strategy — EOD Exits

Intro

For this pattern search we are using the same inputs as RSI Pattern Strategy. However, the search algorithm was configured to search for patterns capable of predicting market direction from the time of the signal to the end of the trading session. To help mitigate large losses, the strategy exits if a position moves more than 50 ticks (disaster stop) against us or the session ends. No other exits were utilized. This type of exit strategy is not well suite for actual trading. Instead its intended to find patterns that establish the remaining day’s general direction.

The in-sample testing period consists of 6/1/2001 – 1/1/2011 on 3 minute ES bars.

Pattern Inputs

AddParam(RSI(3,1)[0],”RSI3 “);
AddParam(RSI(7,1)[0],”RSI7 “);
AddParam(RSI(14,1)[0],”RSI14 “);
AddParam(RSI(21,1)[0],”RSI21 “);
AddParam(RSI(30,1)[0],”RSI30 “);
AddParam(RSI(45,1)[0],”RSI45 “);
AddParam(RSI(60,1)[0],”RSI60 “);
AddParam(ADX(3)[0],”ADX3 “);
AddParam(ADX(21)[0],”ADX21 “);
AddParam(ADX(45)[0],”ADX45 “);
AddParam(RSI(ATR(5),3,1)[0],”RSIATR5 “);
AddParam(RSI(ATR(14),3,1)[0],”RSIATR14 “);
AddParam(RSI(Volume,3,1)[0],”RSIVOLUME3 “);

Observations

While many patterns generated were very profitable against a wide range of instruments, none were “great”. I believe these inputs are not well suited for this type of exit strategy. Below are the results from the top performing pattern.

Strategy In-sample Results

Profit: $31,962
PF: 1.32
Trades: 789
Win %: 57.79
Expectancy: +$40.41 per contract

Summary

Finding patterns that produce good results when the position is held until the end of the trading session can be very useful. These patterns can later be used to create a “bias” about the remaining trading session. Other patterns can then be used to pinpoint entries/exits utilizing these biases as guidelines for direction.

Before you can use the pattern below, you must install the pattern reading software (if you do not already have it installed). Follow the instructions here: DLL Installation

Download Pattern


Share

DLL Install Simplified

We have greatly simplified the process for using the TheStrategicTraderDLL. You no longer have to copy the DLL into the NinjaTrader folder or worry about restarting NinjaTrader after installing. We have also modified the way patterns are stored. You no longer have to download a separate pattern file. Everything needed to run the strategy is now imported automatically.

To use the DLL:
Run Setup.exe
Import a strategy using the DLL (RSi Strategy 1)

More patterns will be uploaded shortly.

Note:
If you are using Google Chrome, it may say the setup.exe “may be malicious” when you download. This is due to the fact that the setup.exe is not digitally signed. We are working on resolving this issue.


Share

RSI Pattern Strategy

Intro

This is the first strategy built entirely using patterns discovered from the tstPattern Searching software. The strategy is set to exit after being in the trade for 5 bars. Obviously, 5 bars is not an ideal exit. However, it provides a uniform baseline to build with room to improve in the future. The pattern consists almost entirely of RSI based inputs.

The in-sample testing period consists of 6/1/2001 – 1/1/2011 on 5 minute ES bars.

Pattern Inputs

AddParam(RSI(3,1)[0],”RSI3 “);
AddParam(RSI(7,1)[0],”RSI7 “);
AddParam(RSI(14,1)[0],”RSI14 “);
AddParam(RSI(21,1)[0],”RSI21 “);
AddParam(RSI(30,1)[0],”RSI30 “);
AddParam(RSI(45,1)[0],”RSI45 “);
AddParam(RSI(60,1)[0],”RSI60 “);
AddParam(ADX(3)[0],”ADX3 “);
AddParam(ADX(21)[0],”ADX21 “);
AddParam(ADX(45)[0],”ADX45 “);
AddParam(RSI(ATR(5),3,1)[0],”RSIATR5 “);
AddParam(RSI(ATR(14),3,1)[0],”RSIATR14 “);
AddParam(RSI(Volume,3,1)[0],”RSIVOLUME3 “);

Observations

When we ran the pattern searching software against our testing file a total of 220 patterns exceeding statistical significance were generated. Shown here is the top pattern discovered. Keep in mind, because this is only one pattern, the number of trades is a bit low. Because of this we also validate the pattern against the Dow Mini (YM). This allows us to feel more confident that the pattern is not simply curve fit to the ES data.

Strategy In-sample Results

Profit: $26,192
PF: 2.14
Trades: 650
Win %: 62.26
Expectancy: +$41.40 per contract

Strategy Out of Sample Results (1/1/2011 – 12/1/2011)

Profit:$5,062
PF: 2.19
Trades: 97
Win %: 67.01
Expectancy: +$52.19

Strategy On YM

Profit: +$22,770
PF: 1.70
Trades: 827
Win %: 59.61
Expectancy: +$27.53

Summary

This new method for generating strategies has a lot of promise, but a lot of work left to do. We have built the main pattern reading software into a DLL so that we can distribute it with the strategy. Although we have built this blog to share with the world our techniques, there still exists IP that we do not wish to share completely. Before you can use the pattern below, you must install the pattern reading software. Follow the instructions here: DLL Installation

Download Strategy


Share

Intro to Pattern Searching

What is this software?

Going forward we will be using custom pattern searching software for creating new strategies. The software searches through thousands of potential patterns and only saves the patterns that exceed statistical thresholds. The method for finding strategies is very similar to standard neural networks except with a few custom twists.

How is a pattern found?

We feed raw indicator values and the resulting output into a “training” file. The software then constructs neural networks that “learn” the profitable patterns. For example, we may wish to find a pattern that identifies a high likelihood of being profitable 5 bars into the future. For this training file we would write the delta between today’s bar and 5 bars into the future with the corresponding raw indicator values for each entry.

The software then traverses the training file and determines the best patterns for reaching the desired outcome.

Statistical Thresholds

When searching for patterns in an automated fashion, we have to be careful not to include a pattern just because of random luck. To filter out patterns that are the result of luck, we require the pattern to exceed values on win% and/or trade expectancy. At the start of each training cycle the software traverses the training file and determines the average win% and trade expectancy for various trading frequencies as well as the corresponding standard deviation.

Using this information the software identifies which thresholds need to be exceeded to be statistically significant.


Share

Simple Profitable Strategy: Abandoned

This post was suppose to be a follow up to part 1. However, while filtering down trades utilizing my pattern searching software I had an epiphany of sorts. Using various technical indicators directly is just a waste of time. Its true that some indicators have more value than others, but the process of searching for an edge the way I have been is too slow and clumsy. Instead, using pattern searching software I can determine which indicators work and identify tradeable patterns much quicker.

As part of this discovery, I found that the same patterns I was using to filter out losing trades could instead be used as entry conditions. In a matter of minutes I had created a strategy using only newly discovered patterns that drastically outperformed the simplistic strategy outlined in part 1.

Armed with this knowledge, I plan to take this blog in an entirely new direction. Instead of focusing on if indicator does x, then do y, I will feed raw indicator values into the pattern searching software and let it figure out the underlying relationships. Then use these patterns to build new strategies.


Share

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