Most algo traders are always on the lookout for new ideas to test and evaluate. I’m no exception.
How about 15 price patterns that might form the basis of a good trading strategy?
Without further ado, here they are (along with some general warnings and tips about using them)…
Pattern 1 – Directional Bars and Pullback Momentum
General Description
This pattern has 2 components. First, for long trades, it looks for more recent up bars (close minus open greater than 0) than down bars. Second, it looks for a short term pullback. When both of these are found, there is a long signal. Vice versa for a short signal.
Rules – Plain English
1. Count the number of “up” closes (close minus open greater than 0) over the last “BCount” bars.
2. Count the number of “down” closes (close minus open less than 0) over the last “BCount” bars.
3. If the number of up closes is greater than the number of down closes, and the current close is less than the close “pullback” bars ago, then go long at next open. (“Pullback” is simply the number of bars you look back to do the calculation with. It is a variable, you can set it to whatever you like.)
4. Do opposite for short trades.
5. Exit after X bars after entry, unless a reversal signal occurs first.
Code – Tradestation
input:
BCOunt(1), PullBack(1), ExitBars(1);
if CountIf(close-open>0,BCOunt)>countif(close-open<0,BCount)
and close<close[pullback]
then buy next bar at market;
if CountIf(close-open>0,BCOunt)<countif(close-open<0,BCount)
and close>close[pullback]
then sellshort next bar at market;
If Barssinceentry>=ExitBars then Begin
sell next bar at market;
buy to cover next bar at market;
end;
Sample (Non Optimized) Results
Other Markets To Try
This pattern works really well on Daily Silver bars. But, I have found it to work on these other markets (daily bars):
SF – Swiss Franc
US – 30 Year Bonds
GC – Gold
ES – mini S&P
LC – Live Cattle
NQ – mini Nasdaq
General Tip #1 – No Stops
To see what the entry alone could do, I tested all 15 of these patterns with a simple exit: exit after a certain number of bars, regardless of open profit or loss. This is a pretty good exit by exit (legendary trader John Henry is said to favor this type of exit).
Of course, for any strategy you build, you might want to include stop losses and/or profit targets. This could DRAMATICALLY change the results you get.
Pattern 2 – Higher Highs, Lower Lows and Pullback Momentum
General Description
This pattern has 2 components. First, for long trades, it looks for more recent higher high bars (high above previous high) than lower low bars. Second, it looks for a short term pullback. When both of these are found, there is a long signal. Vice versa for a short signal.
Code – Plain English
1. Count the number of higher highs (current high greater than previous high) over the last “BCount” bars.
2. Count the number of lower lows (current low less than previous low) over the last “BCount” bars.
3. If the number of higher highs is greater than the number of lower lows, and the current close is less than the close “pullback” bars ago, then go long at next open.
4. Do opposite for short trades.
5. Exit after X bars after entry, unless a reversal signal occurs first.
Code – Tradestation
input:
BCOunt(1), PullBack(1), ExitBars(1);
if CountIf(high-high[1]>0,BCOunt)>countif(low-low[1]<0,BCount)
and close<close[pullback]
then buy next bar at market;
if CountIf(high-high[1]>0,BCOunt)<countif(low-low[1]<0,BCount)
and close>close[pullback]
then sellshort next bar at market;
If Barssinceentry>=ExitBars then Begin
sell next bar at market;
buy to cover next bar at market;
end;
Sample (Non Optimized) Results
Other Markets To Try
This pattern works pretty well on 360 minute Feeder Cattle bars. But, I have found it to work on these other markets (360 minute bars):
LH – Lean Hogs
NE1 – New Zealand Dollar
SI – Silver
AD – Australian Dollar
OJ – Orange Juice
General Tip #2 – Work In Multiple Markets?
You’ll notice that out of the 40 or so futures markets out there, I have listed this pattern (and the other 14 patterns) as only working well in certain markets. This is because NO PATTERN WORKS WELL EVERYWHERE. You’ve probably seen people touting “this indicator/pattern/strategy works in all markets, all time periods, blah blah blah.” I think that is a load of BS, meant to snare people into thinking they have found the Holy Grail.
Why should a pattern that works in Coffee work for Gold? The markets are completely different and many of the participants in the market are different. There is no reason why patterns should work well in every market.
That said, it is nice when a pattern works in multiple markets, but I do not consider it a “must.”
Pattern #3 – Consecutive Up/Down With Momentum
General Description
This is a bit similar to the first two patterns, but has a unique twist. It simply looks for a number of consecutive up closes or down closesas a COUNTERTREND INDICATOR. Once a threshold number of up or down closes is reached, the strategy will trade in the opposite direction of recent momentum. So for short trades, “BCount” up closes coupled with positive momentum leads to a short trade. Vice versa for a short trade.
Code – Plain English
1. If the current close is greater than the previous close, increment UCounter by 1, otherwise set UCounter to 0.
2. If the current close is less than the previous close, increment DCounter by 1, otherwise set DCounter to 0.
3. If UCounter is greater than BCount, and the current close is greater than the close “PCount” bars ago, then go short at next open.
4. Do opposite for long trades, using DCounter.
5. Exit after X bars after entry, unless a reversal signal occurs first.
Code – Tradestation
inputs:
BCOunt(1), PCOunt(1),ExitBars(1);
variables:
UCounter( 0 ),DCounter(0);
if close > close[1] then
UCounter = UCounter + 1
else
UCounter = 0;
if close < close[1] then
DCounter = DCounter + 1
else
DCounter = 0;
if UCounter>=BCount and close>close[Pcount] then sellshort next bar at market;
if DCounter>=BCount and close<close[Pcount] then buy next bar at market;
If Barssinceentry>=ExitBars then Begin
sell next bar at market;
buy to cover next bar at market;
end;
Sample (Non Optimized) Results
Other Markets To Try
This pattern works pretty well on 240 minute 5 Year Treasury Notes bars. But, I have found it to work on these other markets (240 minute bars):
ES – mini S&P
NE1 – New Zealand Dollar
AD – Australian Dollar
NQ – mini Nasdaq
HG – Copper
US – 30 Year Bond
SM – Soybean Meal
LC – Live Cattle
FC – Feeder Cattle
General Tip #3 – Check Different Bar Sizes
Just like there is no “one size fits all” for patterns working on every market, the same holds true with different bar sizes. Some patterns work only on daily bars, some will work on multiple bars. Just as with the market selected, you have to test different bar sizes and see.
While I’d be suspicious of a pattern that looked great on 90 minute bars, but fell apart on 89 minute and 91 minute bars, I would not be too concerned with a good 90 minute, but poor 30 minute and 120 minute results.
Of course, you might see this as really important, which is fine. Just remember it will be much tougher to find a good pattern that works on many different bar sizes.
Pattern #4 – Reverse Consecutive Up/Down With Momentum
General Description
This is very similar to pattern #3, but has a unique twist. It simply looks for a number of consecutive up closes or down closes, but goes with the trend. Once a threshold number of up or down closes is reached , the strategy will trade in the direction of recent momentum (but as the exact opposite of pattern #3). So for long trades, “BCount” up closes coupled with positive momentum leads to a long trade. Vice versa for a short trade.
Code – Plain English
1. If the current close is greater than the previous close, increment UCounter by 1, otherwise set UCounter to 0.
2. If the current close is less than the previous close, increment DCounter by 1, otherwise set DCounter to 0.
3. If UCounter is greater than BCount, and the current close is greater than the close “PCount” bars ago, then go long at next open.
4. Do opposite for short trades, using DCounter.
5. Exit after X bars after entry, unless a reversal signal occurs first.
Code – Tradestation
inputs:
BCOunt(1), PCOunt(1),ExitBars(1);
variables:
UCounter( 0 ),DCounter(0);
if close > close[1] then
UCounter = UCounter + 1
else
UCounter = 0;
if close < close[1] then
DCounter = DCounter + 1
else
DCounter = 0;
if UCounter>=BCount and close>close[Pcount] then buy next bar at market;
if DCounter>=BCount and close<close[Pcount] then sellshort next bar at market;
If Barssinceentry>=ExitBars then Begin
sell next bar at market;
buy to cover next bar at market;
end;
Sample (Non Optimized) Results
Other Markets To Try
This pattern works pretty well on 240 minute Crude Oil bars. But, I have found it to work on these other markets (240 minute bars):
KC - Coffee
W - Wheat
RB – Unleaded Gas
CC - Cocoa
PL - Platinum
NG – Natural Gas
GC - Gold
General Tip #4 – Include Trading Costs
One way trading charlatans try to fool people is by showing equity curves without slippage and commissions. What a joke! They will claim that everyone’s slippage and commissions will be different, so it is not appropriate to show any at all. That is BS!
To properly evaluate a strategy – whether it is one you create or it is one you buy or lease – INSIST upon getting results with slippage and commissions included.
Of course, most people underestimate the amount of slippage they need to include. I’ve even heard people claim they get no slippage on market orders. Again, complete BS.
In my workshop and in our Strategy Factory Club, I reveal the proper amount of slippage to use for all the futures markets. These numbers are based on both real world trading results and extensive number crunching (hundreds of thousands of data points).
The key here is to make sure you include slippage and commission – ALWAYS!
Pattern #5 – Momentum With Doji
General Description
By this point, I’m sure you realize a trend here (no pun intended). Momentum is a good indicator of price movement. I think of it this way: If you are in Nebraska, and want to travel by train east to New York, you should not hop on a train travelling west to Los Angeles, hoping it will turn around. If you are in Europe, if you are in Germany and want to go east to Russia, don’t hop on a train headed west to France.
Hopefully you get the point. It is usually better to jump on a trade if it has been moving your direction.
This pattern includes a doji bar with the momentum. Doji bars typically indicate indecision, so this might be a good entry at a pause before the trend resumes.
Code – Plain English
1. Calculate if the current bar is a doji (Threshold of BCount percent).
2. If current bar is a doji, go long if the momentum over the last PCount bars is up.
3. If current bar is a doji, go short if the momentum over the last PCount bars is down.
4. Exit after X bars after entry, unless a reversal signal occurs first.
Code – Tradestation
inputs: BCOunt(1),PCOunt(1),ExitBars(1);
if close>close[Pcount] and C_Doji(BCount)=1 then buy next bar at market;
if close<close[Pcount] and C_Doji(BCount)=1 then sellshort next bar at market;
If Barssinceentry>=ExitBars then Begin
sell next bar at market;
buy to cover next bar at market;
end;
Sample (Non Optimized) Results
Other Markets To Try
This pattern works pretty well on Daily Lean Hogs bars. But, I have found it to work on these other markets (Daily bars):
CL – Crude Oil
HO – Heating Oil
HG – Copper
YM – mini Dow
FC – Feeder Cattle
General Tip #5 – Lots More Testing to Do
Finding out if an entry is valid is certainly an important step. But it is one step of many in developing a trading strategy. I created 8 steps in the Strategy Factory development process, and all 8 are important. Skip just one step, and your chances of success drop.
So, treat the patterns I show here as a beginning, not an ending. You really need to properly test and evaluate each of these before committing actual money to them.
Pattern #6 – Reverse Momentum With Doji
General Description
Some markets work better when you trade against the trend (so forget for a minute what I said in Pattern #5!).
Code – Plain English
1. Calculate if the current bar is a doji (Threshold of BCount percent).
2. If current bar is a doji, go SHORT if the momentum over the last PCount bars is up.
3. If current bar is a doji, go LONG if the momentum over the last PCount bars is down.
4. Exit after X bars after entry, unless a reversal signal occurs first.
Code – Tradestation
inputs: BCOunt(1),PCOunt(1),ExitBars(1);
if close>close[Pcount] and C_Doji(BCount)=1 then sellshort next bar at market;
if close<close[Pcount] and C_Doji(BCount)=1 then buy next bar at market;
If Barssinceentry>=ExitBars then Begin
sell next bar at market;
buy to cover next bar at market;
end;
Sample (Non Optimized) Results
Other Markets To Try
This pattern works pretty well on Daily Nikkei Index bars. But, I have found it to work on these other markets (Daily bars):
SF – Swiss Franc
BP – British Pound
CT – Cotton
ES – mini S&P
EMD – mini Midcap
KC – Coffee
NG – Natural Gas
CC – Cocoa
JY – Japanese Yen
RTY – mini Russell
General Tip #6 – No Guarantees
I’m sure some of you will test these patterns with some exits and end up with…NOTHING worth trading! Sometimes adding stops, targets or any other trailing exit you can think about will absolutely destroy the usefulness of the pattern. Or maybe you use support and resistance to exit – you’ll find approach incompatible with many patterns.
The point is good patterns are nice, but they are just one part of an overall trading strategy. The interaction between entries and exits can be huge.
Don’t forget that.
Pattern #7 – Support and Resistance
General Description
This pattern plays off of simple support and resistance measures.
Code – Plain English
1. Calculate 3 Support and Resistance measures:
PP = (High + Low + Close) / 3.;
R1 = (2 * PP)-Low;
S1 = (2 * PP)-High;
R2 = PP + (High-Low);
S2 = PP-(High-Low);
R3 = High + 2*(PP-Low);
S3 = Low-2*(High-PP);
2. If PCount=1:
If close is greater than the previous R1 value, then buy next bar at market.
If close is less than the previous S1 value, then sellshort next bar at market.
3. If PCount=2:
If close is greater than the previous R2 value, then buy next bar at market.
If close is less than the previous S2 value, then sellshort next bar at market.
4. If PCount=3:
If close is greater than the previous R3 value, then buy next bar at market.
If close is less than the previous S3 value, then sellshort next bar at market.
5. Exit after X bars after entry, unless a reversal signal occurs first.
Code – Tradestation
inputs:
BCOunt(1), PCOunt(1),ExitBars(1);
var: PP(0),R1(0),R2(0),R3(0),S1(0),S2(0),S3(0);
PP = (High + Low + Close) / 3.;
R1 = (2 * PP)-Low;
S1 = (2 * PP)-High;
R2 = PP + (High-Low);
S2 = PP-(High-Low);
R3 = High + 2*(PP-Low);
S3 = Low-2*(High-PP);
if PCount=1 Then Begin
if close>R1[1] then buy next bar at market;
if close<S1[1] then sellshort next bar at market;
//print(close," ",R1[1]," ",s1[1]);
end;
if PCount=2 Then Begin
if close>R2[1] then buy next bar at market;
if close<S2[1] then sellshort next bar at market;
end;
if PCount=3 Then Begin
if close>R3[1] then buy next bar at market;
if close<S3[1] then sellshort next bar at market;
end;
If Barssinceentry>=ExitBars then Begin
sell next bar at market;
buy to cover next bar at market;
end;
Sample (Non Optimized) Results
Other Markets To Try
This pattern works pretty well on Daily mini Dow bars. But, I have found it to work on these other markets (Daily bars):
CD – Canadian Dollar
RB – Unleaded Gas
ES – mini S&P
NQ – mini Nasdaq
US – 30 Year Bond
GC – Gold
BO – Soybean Oil
JY – Japanese Yen
KC – Coffee
KW – Kansas City Wheat
General Tip #7 – Don’t Forget Risk
I bet 8 out of 10 new traders just think about profit. I know I did! But profit is only half the battle to good trading. Risk is super important, too. Usually, this is measured by drawdown. Think of a savings account in a bank. The account slowly but surely increases in value over time. No drawdowns, and really no risk (forgetting for a minute currency risks, default risks, inflation, etc.)
If only trading strategies were like that! Unfortunately, drawdown is a major part of trading.
So, when evaluating and trading strategy, remember to take a look at the risk involved. Focusing on that, and not the profit, is a great step to becoming a successful trader.
Pattern #8 – Support and Resistance, Reversed
General Description
This pattern plays off of simple support and resistance measures, just the opposite of #7.
Code – Plain English
1. Calculate 3 Support and Resistance measures:
PP = (High + Low + Close) / 3.;
R1 = (2 * PP)-Low;
S1 = (2 * PP)-High;
R2 = PP + (High-Low);
S2 = PP-(High-Low);
R3 = High + 2*(PP-Low);
S3 = Low-2*(High-PP);
2. If PCount=1:
If close is greater than the previous R1 value, then sellshort next bar at market.
If close is less than the previous S1 value, then buy next bar at market.
3. If PCount=2:
If close is greater than the previous R2 value, then sellshort next bar at market.
If close is less than the previous S2 value, then buy next bar at market.
4. If PCount=3:
If close is greater than the previous R3 value, then sellshort next bar at market.
If close is less than the previous S3 value, then buy next bar at market.
5. Exit after X bars after entry, unless a reversal signal occurs first.
Code – Tradestation
inputs:
BCOunt(1), PCOunt(1),ExitBars(1);
var: PP(0),R1(0),R2(0),R3(0),S1(0),S2(0),S3(0);
PP = (High + Low + Close) / 3.;
R1 = (2 * PP)-Low;
S1 = (2 * PP)-High;
R2 = PP + (High-Low);
S2 = PP-(High-Low);
R3 = High + 2*(PP-Low);
S3 = Low-2*(High-PP);
if PCount=1 Then Begin
if close>R1[1] then sellshort next bar at market;
if close<S1[1] then buy next bar at market;
//print(close," ",R1[1]," ",s1[1]);
end;
if PCount=2 Then Begin
if close>R2[1] then sellshort next bar at market;
if close<S2[1] then buy next bar at market;
end;
if PCount=3 Then Begin
if close>R3[1] then sellshort next bar at market;
if close<S3[1] then buy next bar at market;
end;
If Barssinceentry>=ExitBars then Begin
sell next bar at market;
buy to cover next bar at market;
end;
Sample (Non Optimized) Results
Other Markets To Try
This pattern works pretty well on Daily Natural Gas bars. But, I have found it to work on these other markets (Daily bars):
SI – Silver
NK – Nikkei
HG - Copper
EC – Euro
C – Corn
SM – Soybean Meal
PL – Platinum
W - Wheat
General Tip #8 – More Optimizing Is NOT Better
A lot of traders think that optimization is “tuning.” The more tuning you do, the better the strategy matches current market conditions, and the better the strategy will work going forward.
Don’t fall for this. More optimizing is almost always BAD. Try to optimize as little as possible.
‘Nuf said.
Pattern #9 – Bullish and Bearish Engulfing
General Description
Discretionary chart traders love candlesticks, since they are an easy to spot visual pattern. But the neat thing is that algo traders can also use them, once the pattern is programmed. This entry uses Bullish Engulfing and Bearish Engulfing patterns for entry.
Code – Plain English
1. Go Long at open of next bar when a Bullish Engulfing Bar occurs. Use “BCount” for the candlestick observation length.
2. Go Short at open of next bar when a Bearish Engulfing Bar occurs. Use “BCount” for the candlestick observation length.
3. Exit after X bars after entry, unless a reversal signal occurs first.
Code – Tradestation
input: BCOunt(1),PCOunt(1),ExitBars(1);
variables: oBullishEngulfing( 0 ), oBearishEngulfing( 0 ) ;
Value1 = C_BullEng_BearEng( BCount, oBullishEngulfing, oBearishEngulfing ) ;
if oBullishEngulfing = 1 then begin
Buy("BullEng") next bar at Market; end
else if oBearishEngulfing = 1 then begin
Sell Short("BearEng") Next Bar at Market; end ;
If Barssinceentry>=ExitBars then Begin
sell next bar at market;
buy to cover next bar at market;
end;
Sample (Non Optimized) Results
Other Markets To Try
This pattern works pretty well on 480 Minute Copper bars. But, I have found it to work on these other markets (480 Minute bars):
KC – Coffee
DX – Dollar Index
US – 30 Year Bonds
CD – Canadian Dollars
LC – Live Cattle
NK – Nikkei Index
General Tip #9 – Remember, These Patterns Are Not Full Strategies
Whenever I reveal good entries or patterns, there are always a few people who decide to just take my work and immediately start trading it. That is crazy!
Remember, the 15 patterns presented here are the START of an algo trading strategy, not the finished product. These patterns will get you on the right path, but there is a lot more work to do before you start trading live.
I always envision strategy building as a factory. Ideas and patterns are the raw material to feed the factory. The “machines” in the factory are simply the tests you run to develop, improve and verify the strategy. In this way, the factory churns out strategies, or junk for the scrap heap.
To keep the factory running, you need lots of raw material. That is what these 15 patterns are. But it is up to you to get them working!
Pattern #10 – Bullish and Bearish Harami
General Description
Another good candlestick pattern is the bullish and bearish harami. This entry uses Bullish Harami and Bearish Harami patterns for entry.
Code – Plain English
1. Go Long at open of next bar when a Bullish Harami Bar occurs. Use “BCount” for the candlestick observation length.
2. Go Short at open of next bar when a Bearish Harami Bar occurs. Use “BCount” for the candlestick observation length.
3. Exit after X bars after entry, unless a reversal signal occurs first.
Code – Tradestation
input: BCOunt(1),PCOunt(1),ExitBars(1);
variables: oBullishHarami( 0 ), oBearishHarami( 0 ) ;
Value1 = C_BullHar_BearHar( BCount, oBullishHarami, oBearishHarami ) ;
if oBullishHarami = 1 then begin
Buy("BullHamari") next bar at Market; end
else if oBearishHarami = 1 then begin
Sell Short("BearHamari") next bar at Market; end ;
If Barssinceentry>=ExitBars then Begin
sell next bar at market;
buy to cover next bar at market;
end;
Sample (Non Optimized) Results
Other Markets To Try
This pattern works pretty well on 360 Minute Euro Currency bars. But, I have found it to work on these other markets (360 Minute bars):
ES – mini S&P
S – Soybeans
FC – Feeder Cattle
SM – Soybean Meal
AD – Australian Dollar
LC – Live Cattle
PL – Platinum
NQ – mini Nasdaq
General Tip #10 – Don’t Forget Out Of Sample Testing
I have a strategy development process that works for me (and my students), but if you decide to create your own strategy development process, remember this: MAKE SURE YOU HAVE OUT OF SAMPLE RESULTS!
I use walkforward testing and real time evaluation to get my out of sample results, and they work pretty well. Now, you might decide to do something different, and if it works, more power to you.
The key is to do more than just optimized testing.
Bonus Tip
A lot of you have asked me how I uncovered all these patterns. I actually used one step in my Strategy Factory process, along with special software called MultiOpt, which is currently available only to my Strategy Factory students. It is great software for automating the Strategy Factory - once you understand the fundamentals that I teach you (that is important!).
Here is a short video of the first 7 patterns - check it out!
Pattern #11 – Hammer and Hanging Man
General Description
Continuing the recent candlestick patterns, here are a couple more, the Hammer and Hanging Man. This entry uses Bullish Hammer and Bearish Hanging Man patterns for entry.
Code – Plain English
1. Look for Hammer pattern, with Length “BCount” and Factor (for body size) “PCount.”
2. Look for Hanging Man pattern, with Length “BCount” and Factor (for body size) “PCount.”
3. Go Long with Hammer, or go Short with Hanging Man.
4. Exit after X bars after entry, unless a reversal signal occurs first.
Code – Tradestation
inputs:
BCOunt(1),PCOunt(1),ExitBars(1);
variables: oHammer( 0 ), oHangingMan( 0 ) ;
Value1 = C_Hammer_HangingMan( BCount, PCount, oHammer, oHangingMan ) ;
if oHammer = 1 then
begin
Buy("Hammer") Next Bar at Market;
end
else if oHangingMan = 1 then
begin
Sell Short("HangingMan") Next Bar at Market;
end ;
If Barssinceentry>=ExitBars then Begin
sell next bar at market;
buy to cover next bar at market;
end;
Sample (Non Optimized) Results
Other Markets To Try
This pattern works pretty well on 240 Minute Japanese Yen bars (although not so good recently!). But, I have found it to work on these other markets (240 Minute bars):
NE1 – New Zealand Dollar
LC – Live Cattle
HG – Copper
NQ – mini Nasdaq
KC – Coffee
FC – Feeder Cattle
RB – Unleaded Gas
S - Soybeans
General Tip #11 – Millions Of Iterations Is Not Good!
Many people have the mistaken notion that the more optimization you do, the better off the strategy. This is partly true.
More iterations and more optimization:
1. Will produce a better backtest
BUT
2. Will also produce worse results in the future
So, if you want a great looking backtest, optimize as much as you can. But if you want a strategy that works well in real time (in the future), less optimization is MUCH better!
Pattern #12 – Outside Inside With Momentum
General Description
Outside bars (where the high is greater than previous high and low is lower than previous low) and Inside bars (where the high is less than previous high and low is greater than previous low) are both indecision bars. These can make for good patterns.
Code – Plain English
1. Look for the current bar to be an Outside Bar.
2. Look for the previous bar to be an Inside Bar.
3. If #1 and #2 are met, if recent momentum is positive, go long. If momentum is negative, go short.
4. Exit after X bars after entry, unless a reversal signal occurs first.
Code – Tradestation
inputs: BCOunt(1),ExitBars(1);
if (high[1]<high[2] and low[1]>low[2]) and (high>high[1] and low<low[1]) then Begin
if close>close[Bcount] then buy next bar at market;
if close<close[Bcount] then sellshort next bar at market;
end;
If Barssinceentry>=ExitBars then Begin
sell next bar at market;
buy to cover next bar at market;
end;
Sample (Non Optimized) Results
Other Markets To Try
This pattern works pretty well on Daily Mexican Peso bars. But, I have found it to work on these other markets (Daily bars):
CL – Crude Oil
YM – Mini Dow
ES – Mini S&P
AD – Australian Dollar
EC – Euro
EMD – mini Midcap
NG – Natural Gas
US – 30 Year Bond
BO – Soybean Oil
General Tip #12 – Indicators And Patterns BOTH Work Well
There are algo traders who think that only indicators – moving averages, RSI, ADX, Bollinger Bands, etc. – work with algo strategies. That is not true.
Patterns can work just as well for algo strategies, and many times they work even better than indicators.
The key, as you’ve heard me say many a time, is to test and see!
Pattern #13 – Inside Outside With Momentum
General Description
With pattern #12, the outside by occurred first, followed by inside bar. Now, let’s try the opposite order.
Code – Plain English
1. Look for the current bar to be an Inside Bar.
2. Look for the previous bar to be an Outside Bar.
3. If #1 and #2 are met, if recent momentum is positive, go long. If momentum is negative, go short.
4. Exit after X bars after entry, unless a reversal signal occurs first.
Code – Tradestation
inputs: BCOunt(1),ExitBars(1);
if (high[0]<high[1] and low[0]>low[1]) and (high[1]>high[2] and low[1]<low[2]) then Begin
if close>close[Bcount] then buy next bar at market;
if close<close[Bcount] then sellshort next bar at market;
end;
If Barssinceentry>=ExitBars then Begin
sell next bar at market;
buy to cover next bar at market;
end;
Sample (Non Optimized) Results
Other Markets To Try
This pattern works pretty well on Daily Heating Oil bars. But, I have found it to work on these other markets (Daily bars):
CD – Canadian Dollar
EC – Euro
NK – Nikkei
US – 30 Year Bond
C – Corn
RR – Rough Rice
OJ – Orange Juice
DX – Dollar Index
SI - Silver
General Tip #13 – Don’t Forget Exits!
While these 15 patterns are all entries, don’t neglect the other part of the trading equation – the exits. Exits can be just as important, if not more important, than the entries. Bad exits can decimate an otherwise good entry.
Plus, some exits work better with certain types of entries. You just have to try and see what works. But just remember that exits can have a significant impact. Don’t neglect them.
Pattern #14 – Inside or Outside With Momentum
General Description
An inside/outside bar variation with momentum.
Code – Plain English
1. Look for the current bar to be an Inside Bar OR
2. Look for the previous bar to be an Outside Bar OR
3. Look for the bar 2 bars ago to be an Inside Bar
4. If #1, #2 or #3 are met, if recent momentum is positive, go long. If momentum is negative, go short.
5. Exit after X bars after entry, unless a reversal signal occurs first.
Code – Tradestation
inputs: BCOunt(1),ExitBars(1);
if (high[2]<high[3] and low[2]>low[3]) or
(high[1]>high[2] and low[1]<low[2]) or
(high[0]<high[1] and low[0]>low[1]) then Begin
if close>close[Bcount] then buy next bar at market;
if close<close[Bcount] then sellshort next bar at market;
end;
If Barssinceentry>=ExitBars then Begin
sell next bar at market;
buy to cover next bar at market;
end;
Sample (Non Optimized) Results
Other Markets To Try
This pattern works pretty well on Daily Crude Oil bars. But, I have found it to work on these other markets (Daily bars):
CD – Canadian Dollar
LH – Lean Hogs
AD – Australian Dollar
HO – Heating Oil
CD – Canadian Dollar
DX – Dollar Index
SM – Soybean Meal
General Tip #14 – Psychology Is Important Too
So much of algo trading is about numbers, that it is easy to forget the human side of trading. Just remember, for every strategy you create, you have to be comfortable trading it. This means you have to be ready to expect the drawdowns to actually occur (most people ignore drawdowns until they hit you in the face).
In the end, it does not matter how profitable a strategy might be. If you can’t emotionally trade it, you’ll never succeed with it.
Pattern #15 – Morning and Evening Doji Star
General Description
One last candlestick, based on the Morning and Evening Doji Star.
Code – Plain English
1. Look for morning or evening Doji Star.
2. When one occurs, if the 10 bar momentum is up, then Buy.
3. When one occurs, if the 10 bar momentum is down, then SellShort.
4. Exit after X bars after entry, unless a reversal signal occurs first.
Code – Tradestation
inputs:
BCOunt(1), PCOunt(1),ExitBars(1);
variables: oMorningDojiStar( 0 ), oEveningDojiStar( 0 ) ;
Value1 = C_MornDoji_EveDoji( BCOunt, PCOunt, oMorningDojiStar, oEveningDojiStar ) ;
if oMorningDojiStar = 1 or oEveningDojiStar = 1 and close>close[10] then
begin
Buy("MornDojiStar") Next Bar at Market;
end
else if oMorningDojiStar = 1 or oEveningDojiStar = 1 and close>close[10] then
begin
Sell Short("EveDojiStar") Next Bar at Market;
end ;
If Barssinceentry>=ExitBars then Begin
sell next bar at market;
buy to cover next bar at market;
end;
Sample (Non Optimized) Results
Other Markets To Try
This pattern works pretty well on 90 Minute mini S&P bars (although not so good recently!). But, I have found it to work on these other markets (90 Minute bars):
FC – Feeder Cattle
YM – Mini Dow
SB – Sugar
RB – Unleaded Gas
C – Corn
LC – Live Cattle
HO – Heating Oil
General Tip #15 – Nothing In Trading Is Guaranteed
Many traders have a skewed view of algo trading:
1. I create a profitable backtest.
2. I decide to trade it live.
3. I sit back and relax, as money pours in.
The truth is trading is hard, whether it is algo trading, discretionary trading or random guessing.
And all the testing in the world will not guarantee that an algo will be successful in the future. Testing helps, to be sure, as does a proven successful strategy development process.
But just remember, even strategies built correctly can and will fail in real time. Hopefully never, but good traders are always ready for that (which proper position sizing, money management and backup strategies).
I hope you’ve enjoyed the 15 patterns, and I hope you have success with them! Feel free to let me know how it goes!!!!!
AND, please share with one of the buttons below - I appreciate it.
-Kevin Davey
Original Post:
https://my.kjtradingsystems.com/15-algo-trading-price-patterns.html
Source:
Interactive Brokers Modular IB strategy is ready to automate Futures, Options, Equities & FX via IB API
Sign Up Now