Back

Working out Value Area (a.k.a Market Profile/Volume Profile from Auction Market Theory)

Hi all,  Here's my first contribution to the community: an attempted implementation of the value area calculation from auction maket theory (Steidlmayer, Dalton etc). Couldn't find this on QC and other implementations I've seen floating on other sites seem to be wrong. Briefly:

"The value area represents the area of greatest trade facilitation and acceptance of value in the day timeframe and is signified by the price region where 70 percent of the day’s volume occurred." (Page 331, Mind Over Markets: Power Trading with Market Generated Information). 

As a stand-alone signal, it probably won't get you very far but in combination with others trading signals can help you verify when price action is consolidating, overextended etc. You pass the function bars from a History call and it returns the the Point of Control (most traded price), the high and the low of the value area as decimals. 

It works most of the time but could still use alot of testing and improvement (am fairly new to developing in c#).   Major bug at the moment is the backtest hangs on certain days (e.g. Feburary 5th and 6th 2020) yet works fine others (all days in March so far, e.g.) and I can't seem to figure out why. Open to any suggestions and feedback!
 

Cheers

Update Backtest








0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Still working on this but I think I know what the issue is...the 'comparing volume of price intervals' starts from the highest volume interval and works its way out, but isn't robust to local minimas, so it'll gets stuck in an infinite loop if the volume profile doesn't follow a nice bell shape e.g on the example chart here https://tlc.thinkorswim.com/center/reference/Tech-Indicators/studies-library/V-Z/VolumeProfile

Will update this as I try other methods...

1

I am very interested in this; if you are a 'pro' on tradingview.com you also get access to the 'value area' metrics which are very useful! 

0

I've made a working script in Python that calculates volume-based POC as well as time-based POC. However it runs quite slowly as is apparent when calculating over large datasets (1H history over 2 years of data takes ~8 minutes on a single symbol!). I'd be interested in hearing of an implementation that somehow avoids "binning" volume/time @ price but instead relies only on a novel idea for accumulating/decumulating volume/time @ price that saves on memory/iterations.

I was mulling over a notion of creating a "vector path histogram", where the beginning is the lowest price encountered (or just simply $0), and the end point is the highest value encountered. The step-wise curve itself is defined by the accumulation of bar data as it's encountered and decumulation as it passes beyond the lookback period.

So when you encounter new bar data, you create two 90 degree pivot anchors for each high/low when/where required which rises/fells the histogram line by the quantity you specify (volume / time). So the only object retained in memory is a vector path with a lower limit of 0 and an unbound upper limit. However I don't know how to program this or what the optimal mathematics is.

1

Jake Mitchell , happy to take a look at optimizing your data vector. It sounds like a great idea.

0

Hi everyone,

I've attached a Python backtest which implements a technique for calculating the Point of Control for a given day. We can accomplish this by setting our universe resolution to minute/second and determining the volume traded at each level over the intraday candles in OnData. When the day is over, we can build a window which captures the prices levels and the associated volumes traded. We start this window at the price level which had the most volume throughout the day and grow it incrementally in the direction of the price level that had the most volume (up or down) until we have 70% of the day's volume captured.

See the attached backtest and code for a full working example.

Best,
Derek

0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Update Backtest





0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Loading...

This discussion is closed