<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>ThinkScripter &#187; relative volume</title>
	<atom:link href="http://www.thinkscripter.com/tag/relative-volume/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.thinkscripter.com</link>
	<description>thinkScript Indicators for thinkorswim</description>
	<lastBuildDate>Sun, 29 Jan 2012 16:11:22 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Relative Volume Percentage</title>
		<link>http://www.thinkscripter.com/indicator/relative-volume-percentage/</link>
		<comments>http://www.thinkscripter.com/indicator/relative-volume-percentage/#comments</comments>
		<pubDate>Sun, 26 Jul 2009 15:26:10 +0000</pubDate>
		<dc:creator>ThinkScripter</dc:creator>
				<category><![CDATA[Indicator]]></category>
		<category><![CDATA[custom]]></category>
		<category><![CDATA[relative volume]]></category>
		<category><![CDATA[thinkscript]]></category>
		<category><![CDATA[volume]]></category>

		<guid isPermaLink="false">http://www.thinkscripter.com/?p=1436</guid>
		<description><![CDATA[A study comparing the current price bar's volume to historical volume in the same bar on previous days. <a href="http://www.thinkscripter.com/indicator/relative-volume-percentage/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Several forum members requested a study to compare the current price bar&#8217;s volume to historical volume in the same bar on previous days. The resulting study displays the current bar&#8217;s volume as a percentage of the historical average for as much data is available in your chart. The 20 day charts will provide the most usable data. This study can be used on any intraday charts (i.e. anything less than daily charts) <strong>BUT WILL NOT WORK ON TICK CHARTS</strong>. Let me say this again, this study <strong>DOES NOT WORK ON TICK CHARTS</strong>. Ok, that&#8217;s enough yelling. It should be obvious why this won&#8217;t work on tick charts but furthermore, we still have a bug in TOS that crashes the study any time the getAggregationPeriod() function is called on a tick chart.</p>
<p>You&#8217;ll need to enter the number of hours in the trading cycle. Normally this is 6.5 hours for stocks (0930-1600) and 6.75 for index futures (0930-1615). This study is designed to be used on trading hours charts (i.e. &#8220;Show trading hours only&#8221; checked).</p>
<p>Lastly, you&#8217;ll need to select if you are using the chart on an index future like the /ES.  When TOS plots an hourly chart of an index future, there is one extra bar in the chart because of the partial hour up front and partial hour in back. I put in a particularly inelegant kludge to work around this until something more aesthetically pleasing comes to mind.</p>
<div id="attachment_1440" class="wp-caption aligncenter" style="width: 640px"><a href="http://www.thinkscripter.com/wp-content/uploads/2009/07/RelPercVol.png"><img src="http://www.thinkscripter.com/wp-content/uploads/2009/07/RelPercVol.png" alt="Relative Volume Percentage" title="RelPercVol" class="size-full wp-image-1440" /></a><p class="wp-caption-text">Relative Volume Percentage</p></div>
<pre class="brush: thinkscript; title: ; notranslate"># TS_RelativePercentVolume
# http://www.thinkscripter.com
# thinkscripter@gmail.com
# Last Update 26 JUL 2009

##### DO NOT USE ON TICK CHARTS #####

declare lower;

# Use the number of hours from market open to market open the following
# session (6.5 for stocks, 6.75 for index futures etc)
input hoursPerCycle = 6.75;
# Must select YES for /ES, /NQ etc since and extra bar appears on hourly charts
input indexFuture = YES;
input averagePeriod = 10;
input threshold = 25.0;

rec cycle = compoundValue(1, if getDay() != getDay()[1] then cycle[1]+1 else cycle[1],1);
def barLength = getAggregationPeriod()/60000;

def barsPerCycleV = round100(hoursPerCycle*60/barLength);
def barsPerCycleR = round100((hoursPerCycle*60/barLength)/100)*100;
def barsPerCycle = if barsPerCycleV &gt; barsperCycleR then barsPerCycleR+1 else barsPerCycleR;

# This 'kludge' is in here since index futures plotted on a one hour chart add an extra bar
# Not elegant but it works until something hits me 

def kludge = if indexFuture and barsPerCycle==7 then 1 else 0;

rec aggVolume = volume + aggVolume[barsPerCycle+kludge];
def aveVolume = aggVolume/(cycle+1);

plot percentDiff = ((volume/aveVolume))*100.0;
percentDiff.setpaintingStrategy(paintingStrategy.HISTOGRAM);
percentDiff.setLineWeight(3);
percentDiff.assignValueColor(if percentDiff &lt; 100-threshold then color.red else if percentDiff &gt; 100+threshold then color.green else color.white);

plot zero = 100;
zero.setDefaultColor(color.white);
zero.setStyle(curve.SHORT_DASH);

plot highMark = 200;
highMark.setDefaultColor(color.dark_gray);

plot lowMark = 0;
lowMark.setDefaultColor(color.dark_gray);

plot ave = average(percentDiff,averagePeriod);
ave.setDefaultColor(color.yellow);</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.thinkscripter.com/indicator/relative-volume-percentage/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
	</channel>
</rss>

