Algorithmic and Mechanical Forex Strategies | OneStepRemoved

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

Support and Resistance

September 11, 2013 by Timothy Lewkow Leave a Comment

The Limit Order Book is lurking behind every price tick in every market you can imagine. From the ill-liquid real estate market, all the way to high frequency bond trading, the limit order book determines all price movements.

A simple example in my last post of supply and demand demonstrated how price changes in an equity market. I made several arguments justifying the existence of a bid ask spread, and showed how this leads to price formation. My goal in this post is to find clarity in the foggy world of support and resistance using limit order books. Support and resistance information can be used to build confidence when entering or exiting a trade.

Imaginary Price Levels

If you try searching for support and resistance, a wealth of information can be found usually in the form of some article accompanied by several charts with lines claiming to have found the magical levels.

Every such chart I have found, however, has one single thing in common. The stock price always, at some point, just slightly crosses these horizontal lines. To me, it feels like a slap in the face… the ultimate I told you so from market experts that can apparently see into the future. Here’s a great example I picked up on Google.

Support and Resistance chart

Figure 1: Support and Resistance levels breached leaving question of imaginary lines.

I realize that mathematical definitions of these levels exist, and I realize that human psychological traits are often correctly considered. Nevertheless, they still lack precision! The arguments for true black and white support and resistance levels always must always have a fair amount of uncertainty. Sadly, this is just another part of working in this business.

If I see a price move past a resistance level in real time (i.e., not being able to see the entire future nicely displayed in front of me like Figure 1), I often question if the level has been breached. This could perhaps leave you in the worst possible position as the market rockets the wrong way. The limit order book can reduce this uncertainty by displaying real information.

If you try searching for support and resistance, a wealth of information can be found usually in the form of some article accompanied by several charts with lines claiming to have found the magical levels.

Suppose a stock is testing a human psychological resistance level of $20.00 and your algorithm has signaled that you initiate a short position. You wish to enter the market at the highest possible price without missing the peak. More importantly though, you wish to confirm a resistance level still exists . If the current order book is displayed as below left, you would have confidence that enough sell pressure is present to hold the resistance.

Support and Resistance limit order book

Figure 2: The left side of the image shows more market depth on the offer (orange), which is resistance. The right image shows light depth, which is the absence of resistance.

On the other hand, if the order book is displayed as above right, it it would take only a moderate collection of market order buyers to break the $20.00 level– and break it fast in this example. Short sellers would run to cover, and the market could swiftly move against you.

Measure Support and Resistance

I found some research out of Wharton suggesting an order book metric (cumulative depth), and have heard more advanced ideas shared in my personal research symposiums. That said, I think this situation is being made too complex.

Translating the above example into math should be straight forward, and customizable to the strength of signal generated by your algorithm. Allow me to suggest a crude, yet effective starting place.

Suppose you are back watching an equity as it approaches what you think to be a $20.00 resistance level. You need a metric to identify the strength of the resistance, and have one of the given order books displayed above in Figure 2. In the order book on the right, you could find the average price it would take a market buyer to pass four levels of depth. This calculation ((2*19.99+8*20+1*20.01+2*20.22)/12) shows resistance strength of 20.0008.

Using an analogous calculation on the left shows resistance strength of 20.0063, a greater value that can act as a metric defining a resistance level.

The more expensive it is to surpass a level of resistance, the less likely it will happen.

Exactly how this metric is created has many degrees of freedom. If you suspect a resistance level exists at $20.00, you could initiate a position that depends on how expensive a set of market orders would have to be to consume past the resistance. You could also alter how far deep to look when calculating the average price.

These two measures involve simple math, and provide a deeper insight to market movements. They are based on the absolute lowest levels of price formation by supply and demand, and are certainly items to consider when building a full system. In my next post, I will provide a more specific strategy to consider implementing.

Filed Under: Trading strategy ideas Tagged With: algorithm, bid, depth of market, limit order, offer, order book, resistance, support, Wharton

Limit Order Book

August 28, 2013 by Timothy Lewkow 3 Comments

I remember the first time that I really sat down and thought about it. Why exactly does a stock price change? Shrinking the economy and the number of shares helped. Examples starting with 10 oranges together with supply and demand arguments sparked good ideas. But, expanding a simple scenario into a full blown economy with high volumes and different order types never made any sense.

The story is not complete without considering the information contained in a limit order book. It’s the absolute best source for highlighting buying and selling power in a market in real time. The information within the data often results in more desirable entry and exits points.

A simple example of a limit order book

limit order book example

The orange squares represent units of stock that you can buy at market

Suppose that each block represents one share of stock on both the bid and ask side of the market frozen in time. The volume of shares in the above plot are limit orders waiting for execution or cancellation.

Say that Frank comes along and wants to buy 5 shares using a market order. In that case, his order will be filled immediately.

Remarkably, the current quote displayed  of $20,26 is not where Frank can trade- there are no shares available at that price. The quoting convention reflects the spread rather than tradeable prices.

The 5 empty colored squares represents the 5 shares that Frank bought with his market order

The 5 empty colored squares on the right represents the 5 shares that Frank bought with his market order

The order is filled by sellers in a first in, first out (FIFO) process. Those who waited the longest in the order book receive the first execution.

Frank’s market order for 5 shares receives execution at two different prices. The first 2 shares fill at $20.27. The depth of market at that price is only 2 shares, forcing him to sweep the $20.27 price and move on to the next available price at $20.28.

4 total shares are available at $20.28. Because Frank only needs an extra 3 shares, he completes his total order at this level.

The best offer displayed when Frank placed the trade was $20.27, but his average fill is $27.276 (2 * $20.27 + 3 * $20.28). The slightly worse price doesn’t have anything do with slimy brokers. Slippage is the natural result of buying more shares than there are shares available.

Try making Frank a more aggressive buyer. Say he wants nine shares. Large orders receive worse fills because they suck up most of the liquidity on one side of the market.

Why A Spread Exists

Before answering this question, it is first worth understanding the difference between a quote driven and an order driven market.

Order driven market:

• Displays all of the current bids and asks across the market

• Has complete transparency

Quote driven market:

• Displays bid and ask prices from market makers, dealers, or specialists.This is the norm among retail forex brokers

• Often provides a guarantee that an order is filled

A quote driven market has more moving parts and will likely be involved in any market you wish to trade in. Therefore, it is a good idea to think about the existence of a spread in this setting.

When you post an order in a quote driven market, the dealer will either fill it with their own inventory or match you with another market participant. For this reason, part of your transaction cost goes to the dealer who has done this work for you.

In a simple model, the bid ask spread is the price that aggressive traders must pay to have their order immediately filled– think buying and selling the same security at almost the same instant. The spread is the compensation to a dealer for offering that immediacy.

A good way to think about the size of the spread is to consider a market with several competing dealers. In this case, there are two primary scenarios:

1. If the spread is too high, more dealers will enter the market to gain profit from the large bid/ask spread

2. If the spread is too low, dealers will lose money, and exit the market

These two factors ensure that the liquid market dealers make normal profits, and that spreads are of reasonable size.

Supply and Demand

The existence of a spread is quite natural and leads back to the simplicity of supply and demand. Start the argument small and work your way up! I found a great example in an article by Glenn Curtis on August 19 with the following story.

Suppose that a one-of-a-kind diamond is found in the remote countryside of Africa by a miner. An investor hears about the find, phones the miner and offers to buy the diamond for $1 million. The miner says she wants a day or two to think about it. In the interim, newspapers and other investors come forward and show their interest. With other investors apparently interested in the diamond, the miner holds out for $1.1 million and rejects the $1 mil- lion offer. Now suppose two more potential buyers make themselves known and submit bids for $1.2 million and $1.3 million dollars, respectively. The new asking price of that diamond is going to go up. The following day, a miner in Asia uncovers 10 more diamonds exactly like the one found by the miner in Africa. As a result, both the price and demand for the African diamond will drop precipitously because of the sudden abundance of the once- rare diamond.

Imagine the diamond becomes more popular. More buyers want it. More mines open, and more sellers emerge. In a rational setting, this creates a quote driven a bid ask spread. Add enough volume, and before long, you are back to the first example.

Filed Under: What's happening in the current markets? Tagged With: ask, bid, FIFO, limit, order book, slippage, spread

Forex spread

December 20, 2011 by Shaun Overton Leave a Comment

Spreads are the true cost of trading forex. Opening a position results in an immediate loss. Profits only occur whenever the price moves beyond the gap, known as the spread, between the buy and sell prices.

Bid and Ask

The screen shows two prices, the bid and ask. Novice traders understand these terms more intuitively by thinking of them as the “sell” and “buy” prices, respectively.

You can think of electronic forex trading as a form of sohpisticated haggling. Everyone may agree but that the price is generally X, but everyone also wants to try to shave a few pips off of the price. Traders want a discount.

Disagreement in the marketplace causes the bid and ask to exist. If someone wants to buy euros, someone else wants to sell them and they both agree on a price, a trade occurs. When a trade does not occur, which is most of the time, the spread reflects disagreement among the group.

A trade entering the market generally causes the price to move. Consider an example where someone buys dollars. The dollar should rise in value to reflect the latest transaction. The buy trade removes the previous ask from the market depth. The next ask becomes the best available price for purchase.

The other side of the market, the bid, sees the price adjust. Traders typically responds by adjusting the bid in the same direction. The traders offering the bid expect the price to rise. That is, after all, the reason that you’re able to sell. You’re selling what they’re buying and you’re buying what they’re selling.

The movement of the price causes a reaction. The people behind the bid still want to buy at a price better than the market using a limit order. They also realize that the price is moving away from them. A common reaction is for the bid to adjust approximately the same distance as the movement in the ask. The adjustment in the spread is what keeps it relatively consistent.

Spread mark up

You only pay the spread once. When you enter a buy trade, you enter on the ask. The only way to exit that trade is by selling at the bid, a problem that occurs immediately upon entry. The movement of the ask price from that point forward is completely irrelevant. The ask could drop or explode upwards. It doesn’t matter to your trade. Your trade can only exit on the bid. It’s the only price that counts when you’re already long.

One unique aspect of forex trading is that the brokers bury their commissions in the spread. Say, for example, that the wholesale price of USDJPY is 76.480 on the bid and 76.485 on the ask. Brokers read this type of quote 76.480 at 76.485, with the bid coming first and the ask quoted last.

The broker then takes the prices and mark them up like any middle man. The mark up varies between brokers. Most charge an additional 1 to 2 pips per transaction.

The broker faces three options when marking up the spread – he can add it to the bid, the ask or he can split the difference between the two. Current market conditions dictate which option is the most suitable.

Although it seems like a good idea to tack half of the mark up on both sides of the bid ask spread to eliminate guessing incorrectly, this doesn’t usually work out well for the broker. Order flow comes in very unevenly and usually with a strong bias in one direction.

I posted in the past about forex trader sentiment and how lopsided the trades of retail traders can be. If the forex broker sees that 75% of the GBPUSD orders coming in are to buy, then it makes sense to heavily weight the spread cost to where all of the business is.

Consider an example where the next 100 lots traded will be 75% buys and 25% sells with a 1 pip markup. If the 1 pip mark up on the spread applies to only the bid, then there would only be 25 lots where the broker earns his pip. That’s the dumbest thing he can do in that situation. He could evenly split the markup with 0.5 pips added to the bid and 0.5 pips added to the ask. He would make 0.5 pips on 25 lots and 0.5 pips on 75 lots for a total of 50 pips. The best scenario for the broker is to let the traders going short trade for free and to charge all of the traders going long the full pip. He doesn’t make anything on the short flow, but he makes 75 pips on the long traders. It’s clearly in his best interest to full mark up the spread in one direction whenever the order flow is uneven.

Traders are on the losing end of spread markups. It completely eliminates pricing transparnecy. Most brokerages allow you to review within their statements the break down of profit and loss into categories. Commissions and trading costs are most definitely found on every trading statement from stocks and futures brokers. Not so in forex. You can guess trading costs and that’s it.

Spread mark ups also eliminates trading opportunities. A client that I visited in Dubai in 2009 absolutely loved FAP Turbo. He swore up and down that it was the greatest EA that he ever bought. His only complaint was that the EA’s performance depended entirely on the broker. He often complained the most about FXCM because they charged the largest mark ups.

FAP Turbo worked by waiting for unlikely, fleeting moments of volatility in ranging pairs like the EURGBP. When the price corrected, the EA sought to take the smallest of profits – something on the order of 3-5 pips. The problem stemmed from the fact that the mark up would cause the take profit not to hit. The wholesale price would reach the limit, but because of the spread mark up, the price he was paying often missed his limit. My client preferred to pay a direct commission. Even though the cost was identical, the increased probability of a successful trade dramatically affected the net outcomes.

Spread reflects risk and liquidity

Each currency pair usually has its own spread. The spread of a currency is a function of its risk and liquidity. When traders look at an exotic currency pair like the ZAR/JPY or USD/TKY, the first thing that they notice are the spreads that seem incredibly wide when compared to the pairs that they’re used to trading. That’s because hardly anyone trades those pairs.

The lack of interest means that anyone that makes a market in an FX pair needs to receive sufficient compensation to make it worth their while. Sufficient compensation here means charging you a fat spread. The low trading volume, which is called liquidity, creates a problem with risk. The largest financial instruments in the world like currencies and stock indeces usually only move a few tenths of a percent per day. Instruments with less trading activity almost always exhibit higher volatility. Prices are more suspeptible to violent moves when fewer people participate in a market. The people making a market in those currencies charge a higher premium as a consequence.

Trading is a marketplace

It’s important to remember that the numbers on the screen are not computer generated. They are real prices that real traders offer in the market place.

The word trade accurately describes the transaction. Someone must agree to a trade before it can occur. Clicking a button to buy does not assure that you get to buy an unlimited quantity at the price displayed.

Filed Under: How does the forex market work? Tagged With: ask, bid, risk. liquidity, spread

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 © 2022 OneStepRemoved.com, Inc. All Rights Reserved.