UPDATE MARCH 2010: The various profile studies (Volume/TPO) have been implemented natively by TOS and replace my thinkScript versions. I will leave these studies in the PRO bundle for those interested in looking at the code but I recommend using the new TOS versions henceforth. – Eric
It can’t be done. That’s what I told myself along with tens of readers who requested some variation of volume by price, market profile, or volume profile. ThinkScript lacks the basic tools necessary to easily accomplish such a study: iterative looping and indexed array variables (Guido: hint, hint…). Limitations be damned, I decided to give this beast at least the college effort. The volume of trades is depicted in the chart horizontally at price intervals. This “Volume by Price” can be used to understand which prices cause the largest activity and volume. This is useful in defining where the majority of historical trading volume happened and help find significant support and resistance lines. (Edit: FuturesTrader71 has an excellent video “Context and Trade Entries” discussing profiles and their use. See it here).
A few notes on setting this beast up. It plots in the bars to the right of the current price bar. As such, you need to set your style settings accordingly. The default bar length is 45 periods. So, you need to set your bars right at 50 since there is a 5 bar buffer between the volume profile and the current bar. Should you decide to use more bars for a larger histogram, you’ll need to set the barLength parameter to 5 less than the amount of right bars you choose. You will note that the highest volume bar is painted yellow and there is a dashed magenta VWAP line as well. All the bars are plotted relative to the highest volume bar and scaled accordingly. The profile is based on all the data plotted on the current chart so you can tailor it to meet your needs from a tick chart up to monthly. I tried numerous methods for sorting the volume into the various levels and settled for an equipartition model whereby any bar’s volume is divided equally between the high and the low of the bar. This is not exact but sans time and sales data in thinkScript, this seems to produce the best results. I am working on a variation that uses the market profile method of creating the histogram based on time-price-opportunities (TPOs).
This has been published to the PRO area of the forum in the current bundle.