Algorithmic and Mechanical Forex Strategies | OneStepRemoved

  • Articles
  • Sophisticated Web Sites
  • Automated Trading
  • Testimonials
  • Contact

Support and Resistance Metric

September 17, 2013 by Timothy Lewkow 2 Comments

Converting back of the envelope ideas to trading algorithms is extremely challenging, but requires significant attention. This could be the single item that makes your system great. In this post, I suggest a way to find more defined support and resistance metric using limit order books.

Creating a Order Book Metric

To start, I want to create a frozen moment in time where two order books appear as in the following picture. For the sake of this example, I assume other signals have detected a $20.00 resistance level.

Support Resistance Metric Limit Order Book Comparison

Figure 1: Comparison of two limit order books during a suspected $20.00 resistance level.

Blue represents the limit bid and orange the limit ask. The order book on the left suggests strong resistance at 20, while the order book on the right suggests weakness . If you’re not convinced, see my post on the support and resistance in the limit order book.

The idea above is great in theory. How can you quantify the above two situations so that it’s actually useful? Otherwise, it’s just another fluff technical analysis piece with no real substance.

A successful method applied to Figure 1 should determined if a short position should be entered at $20.00 (left) or not (right).

The first of two decisions that you must make is how far to look into the order book — a value I will call N. The above two order books have N = 4 because each side of the book contains orders at 4 different price levels.

Of course this will depend on your access to data. However, you might also find through back testing that increasing N provides no useful information.

The next decision you have to make is how to weigh the volume in the order book.

You might be foolish to think that each level of the order book is created equally.

For simplicity, I am going to describe a linear weighting system where ticks closer to the price midpoint are given more weight. Referring to the first order book example, N=4 implies we need four weights on the ask side. My system has weights that satisfy the following conditions:

  • w1 – corresponds to $19.99
  • w2 – corresponds to $20.00
  • w3 – corresponds to $20.01
  • w4 – corresponds to $20.02
  • w1+w2+w3+w4 = 1
  • w1 > w2 > w3 > w4

These weights essentially alter the volume in the order book so that overcoming the level of resistance is a more pronounced event. Here’s how you can choose them for a linear case.

  • w1 = N = 4
  • w2 = (N-1) = 3
  • w3 = (N-2) = 2
  • w4 = (N-3) = 1
  • total = w1+w2 + w3 + w4 = 10

Through a process of normalization, the final weights are found as follows

  • w1 = N/total = 4/10 = .4 = 40%
  • w2 = (N-1)/total = 3/10 = .3 = 30%
  • w3 = (N-2)/total = 2/10 = .2 = 20%
  • w4 = (N-3)/total = 1/10 = .1 = 10%

Notice that the whole system comes by simply defining N, thus is easy to generalize and back test in your trading system.

The next step is to compute the average weighted price that would have to be paid if a market buyers chooses to pass the level of resistance. Again, I will refer to figure 1 on the ask side of the market. This will show the difference between a strong level of $20.00 resistance (left ask book) and a weak level of resistance (right ask book)

Support Resistance Metric Limit Order Book Comparison

Figure 1 repeated

Average price (left ask book) : $19.99*2+$20.00*8+$20.01*4+$20.02*5/19 = 20.0063

Average weighted price (left ask book) : $19.99*2*w1+$20.00*8*w2+$20.01*4*w3+$20.02*5*w4/(19) = 20.0022

Average price (right ask book) : $19.99*2+$20.00*8+$20.01*1+$20.02*1/12 = 20.0008

Average weighted price (right ask book) : $19.99*2*w1+$20.00*8*w2+$20.01*1*w3+$20.02*1*w4/(12) = 19.9989

From the weighting system, you can see that a assumed resistance of $20.00 is passed by only paying an average (weighted) price per share of $19.998 during a time of weak resistance.

The weighted average price shows more defined support and resistance levels

Generating Signals

Finally, to generate a solid metric, I considered the percent movement a stock would have to take to move past a weighted average price. For example:

Left ask book (strong resistance) : 100*(current price – average weighted price)/current price = 0.11%

Right ask book (weak resistance) : 100*(current price – average weighted price)/current price = 0.094%

My rule is set so that if the current price must move over 0.10% weighted average order book price (for a given value of N) then the resistance level is strong. Less that 0.10% makes me think the resistance is weak, and would signal for me to not initiate a short position.

Filed Under: Test your concepts historically, Trading strategy ideas Tagged With: average price, backtest, limit order, long, order book, resistance, short, signal, support, volume

Picking Trade Entry Signals

May 17, 2013 by Edward Lomax 3 Comments

So far in this series about building a solid trading strategy, I’ve gone over time frame, trend direction and using higher time frames and trend direction to filter trades. Now it is time to go over what most traders focus on when creating a trading system… entry signals. Basically, when do I pull the trigger and buy or sell in the market?

Before I start, I want to make one thing clear…

When to enter the market is not necessarily the most important part of your trading strategy.

Many traders think that if they can just nail down the right entry signals, nothing else matters. This is just not true. While deciding when you are going to enter the market is important, the other characteristics of a solid trading system are just as important or even more so.

Entry signals are exciting

Signals to enter the market are exciting. Just make sure that you don’t neglect the other important elements in a trading system.

Entry signals get a lot of attention because the topic is exciting, and things like money management and trade management are boring. But if you want to be successful, you cannot just focus on the things you like. You need to create a trading strategy that addresses every characteristic of solid trading, even the boring stuff.

Obviously your trading strategy needs a set of rules to tell it when to get into the market. I’m not going to claim to have the magic entry that always wins and can make you rich in a month. Frankly, that is not what you should be looking for either. I just want to go over some issues you are going to have to come to grips with when building your trading strategy.

Types Of Entry Orders

There are a few types of orders you can use to get into the market. Some wait for price to reach a certain level in the market before taking action, and some are immediate.

Pending Orders: A pending order is an order you place above or below current price action. When price reaches that level, an action (Buy or Sell) takes place.

  • Buy Stop Orders: An order is placed ABOVE price action. If price reaches this level a Buy trade is entered.
  • Sell Stop Orders: An order is placed BELOW price action. If price drops to this level a Sell trade is entered.
  • Buy Limit Orders: An order is placed BELOW price action. If price drops to this level a Buy trade is entered.
  • Sell Limit Orders: An order is placed ABOVE price action. If price reaches this level a Sell trade is entered.

Market Orders: A Market Order gets you into the market immediately. If you you want to take action at the current price level, you use a market order to Buy or Sell instantly.

Types Of Entry Signal Criteria

There are limitless ways to get into the market. They can range from the very simple to the incredibly complex. Here are some types of entry signals that can be used either alone or in combination.

Time Based Entry Signals – At a specific time a day, you place a market or pending order based on previous price action.

Set And Forget Entry Signals – These are either market or pending orders that you set up once, and then let price run to either the take profit or stop loss. Orders that have not triggered or are still running are normally closed the next day when new orders are placed.

Straddle Entry Signals – These are pending orders that straddles market price. At a certain time a day you place a Buy Stop order above price and a Sell Stop order below price. (These are normally set and forget style trades where you set take profit and stop loss for each order and come back the next day to see what happened).

Price Pattern Entry Signals – There are many price patterns (triangles, wedges, head and shoulders, etc.) that can be used to determine when to get into the market. There are also Harmonic Patterns (butterfly, bat, etc.) that have their own trading rules.

Candlestick Entry Signals – Candlestick patterns can be used to determine market reversals or continuation moves and pinpoint entries.

Divergence Entry Signals – Divergence happens when price action and an indicator (like MACD) are out of alignment. For example, price is trending up, but the MACD is going down. The thought is that price will follow the indicator at some point, and can be used to look for trade opportunities.

Indicator Alignment Entry Signals – There are thousands of indicators. There are also thousands of different settings for the indicators. This makes for a unlimited combination of indicators that can be put on your charts. When these indicators line up for a buy signal, you can enter the market long. When the indicators line up for a sell signal, you can enter the market short.

2 Considerations Regarding Entry Criteria And Expert Advisors

Since we are primarily talking about programming a trading strategy into an expert advisor, there are a couple of things you should take into consideration.

Complex Is Not Always Better – Many people think the more entry criteria they have, the better and more accurate the system will be. But that is not always the case. Sometimes a system can be so complex you get conflicting data which makes making a confident trading decision impossible.

The point of your entry criteria is to give you an edge in the market and identify high probability opportunities. You are never going to be able to create a system that wins all the time… so don’t try. Identify entry criteria that gives you an edge and avoid trying to search for the Holy Grail of trading systems.

Limiting The Times Of Day You Enter The Market – A lot of people want to build robots because they can look for trading opportunities 24 hours a day. I agree, this is one of the benefits of programming your strategy into an expert advisor. However, limiting the trading times might increase the effectiveness of your system.

The market is more active at certain times of the day like during the London open or when the London and New York markets are open at the same time. Sometimes limiting the hours a day your robot can trade improves accuracy and profitability.

Read the next article in the series: How to decide where to place your stop loss and take profit

Filed Under: Trading strategy ideas Tagged With: limit, market, pending, signal, stop

FREE trading strategies by email

Trending

Sorry. No data so far.

Archives

  • Dominari
  • How does the forex market work?
  • Indicators
  • MetaTrader Tips
  • MQL (for nerds)
  • NinjaTrader Tips
  • Pilum
  • QB Pro
  • Stop losing money
  • Test your concepts historically
  • Trading strategy ideas
  • Uncategorized
  • What's happening in the current markets?

Translation


Free Trading Strategies

Privacy PolicyRisk Disclosure

Copyright © 2023 OneStepRemoved.com, Inc. All Rights Reserved.