Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
How to Pick Intraday Market Direction – The 80% Rule

Hello,

Have anyone code this rule or play with it? using the Value area

The Value Area: The range of prices where 70% of yesterday's volume took place. For instance, if the value area in the S&Ps is 138500-139000, then 70% of the previous day's volume took place between the prices of 138500-139000.

The 80% Rule: When the market opens above or below the value area, and then gets in the value area for two consecutive half-hour periods. The market then has an 80% chance of filling the value area.

13 responses

I always thought of working with "value area" these act as major support and resistances.
So let me try something on this. It will sharpen my pencil atleast. .. . .

By the way I need to understand more about the 80% rule so some questions here

  1. If open is outside value area do we want to take position in direction of value area.
  2. by filling the value area do you mean that you will want to stay in position till the other end of value area.

ie
if value area is 195~196 and open is 194.5 do you want to buy right away
and
you want to exit at 196 or at 195.5 ?

till that time I will find out how to find value area from he 1m panda

Here it is a nice paper that explains more in detail

http://www.marketdelta.com/blog/wp-content/uploads/Strategy-80PercentRule.pdf

@Erick

Attached is my implementation of the value area from the file you provided, scenario 2 and 3 were tested. close all orders 15 minutes before the close.

Not that I am a big fan of this "80% rule" but I was curious so I modified Adham's code (thank you Adham):
- value area calculation (I disagree with how it was calculated, and it might be worth double checking my implementation too)
- modified the test that decides whether to enter a new position (long or shot) for a stock (it was too strict, I made it more flexible)
- positions are closed whenever the price reach the value area borders (and not 15 minutes before trading close)
- don't let slippage kills the algorithm (200.000$ for each stock was way too much)
- expanded traded universe
- kept leverage and long/short exposure under control

I realized that what really matter is how to determine when a stock should be traded. The article says:

"It stated that there is an 80% chance when a market opens (or trades) above or below the value area, and then trades in the value area for two consecutive half hour periods, then the market has an 80% chance of filling the entire value area."

My opinion is that "and then trades in the value area for two consecutive half hour periods" is not clear enough. Depending on how you code this test you can get very different results. Also, there are lots of details to be taken care of to fully implement the paper, details that I didn't cover.

But here is the backtest and thanks to Adham for the original code.

oh, I forgot. A test without commission and slippage.

Luca, what you are undertaking here is a rather enormous task. You’re essentially setting off to create an algorithm based on the principles of auction market theory (AMT). I have traded, researched, and taught auction market theory for the past six years. I continuously blog examples of putting AMT into practice here. I wouldn’t make a trade decision without an analysis of the auction and volume profile.

More importantly, I would suggest that you first truly understand why AMT is robust and why it is absolutely crucial to making trading decisions (as opposed to simply setting off to write script based on some fixed percent “rule” and see what the cumulative returns plot looks like).

The interaction between transaction volume and price is key to understanding how and why prices change. There are two reasons why price increases after a buyer-initiated trade, e.g. First, market-makers upwardly adjust their beliefs about fair value as the buyer’s trade could contain asymmetric information (true edge). Second, market-makers require compensation for allowing their inventory to position itself away from fair market value. Therefore, a risk-averse market-maker will accommodate a subsequent buy order only at a higher price.

In summary, information asymmetry drives volume and quotes change in the direction of transaction volume. Volume begets price movement.

No one has done more to advance the study and practice of auction market theory than Don Jones, Cisco Futures. His website contains his research and short course materials. By the way, the value area is the central 70% and exists only when the distribution of transaction volume is normal (Gaussian). See? It gets complicated.

I’ll be very interested to see what you come up.

ADDENDUM:

Luca, see if you can visually identify the value areas in SPY for the past six months. I uploaded a screen grab of my market profile chart here. You'll immediately see the market doesn't provide us with nice normal distributions of volume and price from which we can exploit the "value area."

Thank you Stephen, your comment is much more interesting than the 80% rule ;) I will dig into AMT and see what I find.

Great! To do this stuff well, we need to become a hybrid of an avant-garde trader and an IT engineer. The more you know about what drives price, the better script writer you’ll be. Two additional comments:

  1. You refer to MarketDelta in your earlier post. They are a data provider for volume on the horizontal axis. I don’t believe Quantopian provides that data. Q staff, please chime in.

  2. Since I’m a trader first, quant second, I first translate the basic concept onto a chart to see what kind of trade signals it produces. That initial step serves as a “proof of concept.” So, I did exactly that with your value area trading concept that you're embarking on. And I used an intra-day chart since that was the title of your post.

Here’s the proof-of-concept script:

def lr = 6 * ( WMA(OHLC4, 10) - Average(OHLC4, 10) ) / 9;
def upBar = close > open;
def dnBar = close < open;
def short = lr > 0 && upBar && close > VAHigh;
def long = lr < 0 && dnBar && close < VALow;
plot longSignal = if long && !long1 and !long[2] then low else double.nan;
plot shortSignal = if short && !short1 and !short[2] then high else double.nan;

That means we plot a long signal on an upbar, in an uptrend, when price exceeds the value area high. (vv. for a short) This ensures you are fading the herd, buying on weakness/selling on strength, and trading when prices are distorted from fair market value.

Your concept looks like this during the past five days, trading S&P futures, intra-day at 5000 ticks. The results show a highly positive predictive value: 28 signals profitable, 5 false positives.

So, Luca …if you can get volume data on the horizontal axis into Quantopian’s IDE and write a python script equivalent to my thinkscript …you’re going to kick some butt. Good luck! (By the way, I took trades on a number of those signals last week.)

Yes, well put Steven. I am interested in an ES or NQ algo based on AMT. I don't know if futures are supported by Q or will be but it is there that I think an AMT algo can be fun. Won't qualify for the Q game but I do like the idea of an ES algo.

Lucas, to illustrate how arbitrary a fixed percentage level is, I labelled the auction levels in the Market Profile graphic here. (In the profile I labeled, both time and volume are roughly normally distributed.) If you just look at the past four days (S&P futures), the value areas expand and contract around the volume node as the auction proceeds. Rarely do they lie equidistant from the high volume node. If, however, you focus solely on the volume profile …your strategy of selling over-value and buying under-value (as defined by the auction and lying greater than one standard deviation away from fair market value) should still perform quite well.

@Stephen I was trying to use your script in ThinkOrSwim but It is not working could you paste the full script to check it out?

Luca, Adham, Thanks for the implementation. The idea behind this is to give you an insight to define an intraday edge. The strategy as you can see it by itself It wont be profitable. However it can be another variable for more complete strategy. I am lately experimenting with strategies with probabilities and statistics of movements in the indexes. It would be nice to get in into the market first 2 hours and get out of RISk :) and sleep well at night heheh

EG

Stephen pointed to some WSJ Options data at http://online.wsj.com/mdc/public/page/2_3022-mfgppl-moneyflow-20151014.html?mod=mdc_pastcalendar that goes back to May 2007. I'm hoping there is someone out there idealistic enough to want to scrape that and offer up for backtesting via fetcher for folks, seems if tried by anyone, they've been quiet, while surely significant upside potential in options data.