<?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; gap</title>
	<atom:link href="http://www.thinkscripter.com/tag/gap/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>Gap Fill</title>
		<link>http://www.thinkscripter.com/indicator/gap-fill/</link>
		<comments>http://www.thinkscripter.com/indicator/gap-fill/#comments</comments>
		<pubDate>Thu, 28 Jan 2010 22:10:12 +0000</pubDate>
		<dc:creator>ThinkScripter</dc:creator>
				<category><![CDATA[Indicator]]></category>
		<category><![CDATA[custom]]></category>
		<category><![CDATA[gap]]></category>
		<category><![CDATA[gap fill]]></category>
		<category><![CDATA[half gap]]></category>
		<category><![CDATA[thinkscript]]></category>

		<guid isPermaLink="false">http://www.thinkscripter.com/?p=1940</guid>
		<description><![CDATA[Displays a gap opening and it's 50% fill line.  <a href="http://www.thinkscripter.com/indicator/gap-fill/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>By popular request, here is a study that will display a gap opening and it&#8217;s 50% fill line. The plot will dynamically collapse as the gap is filled. It will work on any intraday chart timeframe, 24 hours or regular trading hours so long as the two affected trading days are showing. (Edit: If you would like the % Gap Filled box in the upper left, uncomment out the last line of code by removing the #)</p>
<div id="attachment_1942" class="wp-caption aligncenter" style="width: 640px"><a href="http://www.thinkscripter.com/wp-content/uploads/2010/01/GapFill.png"><img src="http://www.thinkscripter.com/wp-content/uploads/2010/01/GapFill.png" alt="" title="GapFill"  class="size-full wp-image-1942" /></a><p class="wp-caption-text">Gap Fill</p></div>
<pre class="brush: thinkscript; title: ; notranslate"># TS_GapFill
# http://www.thinkscripter.com
# thinkscripter@gmail.com
# Last Update 28 Jan 2010

input marketOpenTime = 0930;
input marketCloseTime = 1615;

def yesterdaysClose = close(period = &quot;DAY&quot;)[1];

def secondsFromOpen =  secondsFromTime(marketOpenTime);
def secondsTillClose = secondsTillTime(marketCloseTime);
def marketOpen = if secondsFromOpen &gt;= 0 and secondsTillClose &gt;= 0 then 1 else 0;

rec regularHoursOpen = if (secondsFromOpen &gt;= 0 and secondsFromOpen[1] &lt; 0) or
(getDay() != getDay()[1]) then open else regularHoursOpen[1];

def newDay = if getDay() != getDay()[1] then 1 else 0;

rec regHoursHigh = if newDay then high else if marketOpen then
if high &gt; regHoursHigh[1] then high else regHoursHigh[1] else high;
rec regHoursLow = if newDay then low else if marketOpen then
if low &lt; regHoursLow[1] then low else regHoursLow[1] else low;

def yc = if marketOpen then yesterdaysClose else double.nan;
def o = if marketOpen then regularHoursOpen else double.nan;
def hg = o + (yc - o) / 2;

def gapUp = if yc &lt; o then 1 else 0;
def gapDown = if yc &gt; o then 1 else 0;

def gapRemaining = if gapUp then
Max(regHoursLow - yc, 0) else
if gapDown then Max(yc - regHoursHigh, 0) else 0;

def percentRemaining = 100 * gapRemaining / AbsValue(yc - o);
def gapFilled = if percentRemaining == 0 then 1 else 0;
def halfGapFilled = if percentRemaining &lt;= 50 then 1 else 0;

plot gH = if (gapUp and !gapFilled and marketOpen and !newDay[-1])
then regHoursLow else if (gapDown and !gapFilled and marketOpen and !newDay[-1])
then yc else double.nan;
plot gL = if (gapUp and !gapFilled and marketOpen and !newDay[-1])
then yc else if (gapDown and !gapFilled and marketOpen and !newDay[-1])
then regHoursHigh else double.nan;
plot hGF = if !gapFilled and !halfGapFilled and marketOpen and !newDay[-1]
then hg else double.nan;

gH.SetPaintingStrategy(paintingStrategy.DaSHES);
gH.AssignValueColor(if gapDown then color.darK_red else color.dark_green);
gL.SetPaintingStrategy(paintingStrategy.DASHES);
gL.AssignValueColor(if gapDown then color.darK_red else color.dark_green);
hGF.setStyle(curve.LONG_DASH);
hGF.SetDefaultColor(color.dark_gray);
gH.hideBubble();
gL.hideBubble();
hgF.hideBubble();

AddCloud(gH, gL, color.gray, color.gray);
#AddChartLabel(gapUp or gapDown, concat(percentRemaining, &quot; % Gap Remaining&quot;), color.white);</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.thinkscripter.com/indicator/gap-fill/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
	</channel>
</rss>

