Posts Tagged ‘TPO’

Volume Profile Goes Native to Think or Swim!

February 28, 2010

Think or Swim implemented both Volume Profile and TPO Profiles as built-in studies in the latest release. I was working on a hacked version for volume by price that was clogging up my processor, so this is a welcome addition. Here’s what the settings do:

Price Per Row Mode: Choose how it calculates how wide the volume “bin” is. You can choose “Automatic”, where it figures out a spacing on its own, or you can choose “Ticksize”, where each bin is one tick wide, or “Custom” where you can specify a width. If you choose “Custom” then the input “Custom Row Height” is used, but otherwise it is ignored.

Time Per Profile: The amount of time that each profile will include. “Chart” gives you only one profile covering the entire chart. “Hour” gives you one profile for each hour in the chart, and so forth.

Profiles: How many profiles you want displayed superimposed over the price action. If you ask for more than there are matching periods on the chart, the extras are ignored.

On Expansion: Do you want the plot over in the right hand side beyond the price action, or on top of price? “Yes” puts it over on the right hand side, with the added constraint that you only get one profile no matter how many you asked for. “No” plots each profile on top of the corresponding period’s starting bar.

On my screenshot above, I have added two “Volume Profile” studies. One is set to “Chart” and “On Expansion=yes”, so it is an overall summary of all the volume on the chart. I also added one set to “Two Days” and “On Expansion=no”. This results in multiple two-day volume distributions plotted on top of price.

Work In Progress: Time-Price Opportunity Indicator for Think or Swim

October 4, 2009

There are several traders on Stocktwits and Twitter in general that really know their stuff. One is @futurestrader71, who reads the pulse of the S&P500 futures with amazing accuracy. He is often talking about levels in the market where value has been established. These value areas are levels where the market has spent lot of time and traded lot of volume in the recent past. There’s a lot to this subject, including an analysis framework known as Market Profile. In the traditional market profile structure, the trading day is broken up into 30 minute time periods. Then price plots are made showing all prices traded during that 30 minutes. Each point is known as a Time-Price Opportunity (TPO) point. The basic theory as I understand it is that the market will have important reactions near the highest-count TPO areas, where the market is fairly valued (or at least where most of the bulls and bears agree on price). The more time and volume done at a price level, the more likely that the level will be an area of support or resistance the future. In addition, if the market trades outside of the value area and stays there, you know that the accepted valuation of the market is changing, and this can be valuable information.

We don’t have “volume by price” or Market Profile data available to us in Think or Swim natively. However, Thinkscripter has worked his usual miracles and has created one of each. I was in the process of trying to make a TPO indicator of my own when I saw his release. Therefore, if you are interested in volume by price or a full-fledged TPO indicator, I recommend his scripts. However, I’m releasing what I was working on here for the interested public.

The basic idea of my indicator is simple: just count all of the bars that touched a given price level and sum them up over the entire chart. This would be trivial if we had the capability in Thinkscript to use loops. But since we don’t, a lot more trickery is involved, as you can see in my code. I take the highest high and the lowest low in the chart, and divide the range into 30 levels–the high being one and the low being another, with 28 intermediate levels. Why 30? Pulled out of the air–but you have to write many lines of code for each level, so that’s as far as I went. Then for each bar in the chart, I check each level to see if the price bar touches it. Then I sum up all the counts for all the levels in the chart. The level (or levels if it is a tie) with the highest touch count is the max level and is plotted in white. The rest of the levels’ counts are ratioed as a percentage of the max level’s counts, and they appear in gray.

There are two inputs. First is a cutoff percentage. If you enter 75, all levels with a touch count less than 75% of the max count level are hidden. If you put in 0, none are cut off and you see all the levels. I couldn’t think of a good way to show the level counts individually (like Thinkscripter did), so mine doesn’t tell you the relative count sizes. You know the max count level is white, and the rest are either on if above the count threshold, or off if below. The only other input is “exclude today”. If true, then it ignores today’s trades so you have a static picture of the situation at the end of day yesterday. If false, then it is constantly updating as the current day unfolds.

Here’s a couple of plots. First shows a cutoff of 75%:


And a cutoff of 50%:


When you see those high TPO levels, with the big holes in between, then those big swings of last week start to make sense. And it also starts to make sense as to why we found resistance and support where we did on 9/28 and 9/30.

So there it is. Please note: In its current form, this is not a rigorous treatment of Market Profile concepts! But it could be developed into one with further work. I’ve just got too much going on right now, so I’m handing it over to you if you want it. Download the “TPO” code in the “Work in Progress” section of my Google site.