<?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; retracement</title>
	<atom:link href="http://www.thinkscripter.com/tag/retracement/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>ThinkScripter AutoFibLines Code Explained &#8211; Part 2</title>
		<link>http://www.thinkscripter.com/tutorial/thinkscripter-autofiblines-code-explained-part-2/</link>
		<comments>http://www.thinkscripter.com/tutorial/thinkscripter-autofiblines-code-explained-part-2/#comments</comments>
		<pubDate>Wed, 03 Jun 2009 01:13:57 +0000</pubDate>
		<dc:creator>ThinkScripter</dc:creator>
				<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[Add new tag]]></category>
		<category><![CDATA[custom]]></category>
		<category><![CDATA[Fibonacci]]></category>
		<category><![CDATA[retracement]]></category>
		<category><![CDATA[thinkscript]]></category>

		<guid isPermaLink="false">http://www.thinkscripter.com/?p=1367</guid>
		<description><![CDATA[Recall from part one that the core engine driving the ThinkScripter AutoFibLines script is TOS&#8217; built in ZigZagSign() function. I chose to harness the power of this function rather than re-invent the wheel to capture the swing highs and lows &#8230; <a href="http://www.thinkscripter.com/tutorial/thinkscripter-autofiblines-code-explained-part-2/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Recall from <a href="http://www.thinkscripter.com/2009/05/29/thinkscripter-autofiblines-code-explained-part-1/">part one</a> that the core engine driving the <a href="http://www.thinkscripter.com/2009/03/29/thinkscripter-autofibs/">ThinkScripter AutoFibLines</a> script is TOS&#8217; built in ZigZagSign() function. I chose to harness the power of this function rather than re-invent the wheel to capture the swing highs and lows needed to draw Fibonacci lines. With this piece of the code complete, the script enables any bar to determine if it is a swing high or swing low and set an appropriate flag if so.</p>
<p>At this point I should explain an important nuance here. If you have ever watched the TOS ZigZag in action you will have noticed that it often &#8220;Changes its mind&#8221; about whether to draw an inflection point or not. This is just the nature of the way the ZigZag works on any platform. So, as a result, a bar may get its swing high/low flag set only to have the ZigZag change a bar or two later. We don&#8217;t want false high/lows flagged so we force our entire chart to redraw each bar with the <code>declare fullrange</code> statement up front. Therefore, if a flag is set and then nullified a bar later, the redraw of the chart will remove the false flag.</p>
<p>Onward&#8230;.In order to draw the Fibonacci levels at the final bar, that bar needs to know the previously recorded values of the swing high and swing low. Enter the <code>rec</code> statement. Many folks get the <code>def</code> and <code>rec</code> statements confused. In this case, we need to carry along a value in a variable using <code>rec</code> (short for recursion). Any variable definition that refers to a previous value of itself requires the use of this command. To properly seed the <code>rec</code> variable, you need to use the <code>compoundValue()</code> statement. The compoundValue() statement sets the value of the variable to one value if less than a certain number of bars have passed and to another value when they have. We&#8217;ll dive deeper into this one in another segment. For now, just push the &#8220;I believe&#8221; button. Here&#8217;s the resulting code to hold the swing high/low values and carry them forward from bar to bar:</p>
<pre class="brush: thinkscript; title: ; notranslate"> rec prevLow = compoundValue(1, if(isLow[1], min(lowest(low,3),low[-1]), prevLow[1]));
rec prevHigh = compoundValue(1, if(isHigh[1], max(highest(high,3),high[-1]), prevHigh[1]));</pre>
<p>Since the ZigZag function does not always grab the absolute high/low, I&#8217;ve added a little code to search the identified high/low bar for larger extreme values on adjacent bars.</p>
<p>Again, in plain english: set the value of prevLow to be the lowest low from this bar or the previous/following bars if and only if this bar has been identified as a swing low and if it is not then carry the value of the swing low from the previous bar forward. Similar for the prevHigh variable.</p>
<p>Tune in next time and we&#8217;ll dive deeper into the methodology for drawing in the blank space to the right of the last bar. Again, the <a href="http://www.thinkscripter.com/forum">AutoFibLines code is available in the forum</a> if you&#8217;d like it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thinkscripter.com/tutorial/thinkscripter-autofiblines-code-explained-part-2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>ThinkScripter AutoFibLines</title>
		<link>http://www.thinkscripter.com/indicator/thinkscripter-autofibs/</link>
		<comments>http://www.thinkscripter.com/indicator/thinkscripter-autofibs/#comments</comments>
		<pubDate>Sun, 29 Mar 2009 18:03:35 +0000</pubDate>
		<dc:creator>ThinkScripter</dc:creator>
				<category><![CDATA[Indicator]]></category>
		<category><![CDATA[custom]]></category>
		<category><![CDATA[Fibonacci]]></category>
		<category><![CDATA[retracement]]></category>
		<category><![CDATA[thinkscript]]></category>

		<guid isPermaLink="false">http://thinkscripter.wordpress.com/?p=875</guid>
		<description><![CDATA[AutoFibs will automatically draw a set of user-defined fib levels and extensions based on the previous swing high and low. <a href="http://www.thinkscripter.com/indicator/thinkscripter-autofibs/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><span style="color: #ff0000;"><strong>UPDATE to the UPDATE:</strong></span> After AutoFibLevels flatlined with last weekend&#8217;s TOS release, I had to re-write the script to entirely remove the ZigZag function. After a week in the ThinkScripter laboratory fueled with generous amounts of <a href="http://www.shiner.com/">Shiner Bock</a>, the script lives again and has several enhancements. As before, the AutoFibs will automatically draw a set of user-defined fib levels and extensions based on the previous swing high and low. The user defines the price/percentage reversal required to establish a reversal has occurred. The new version is now functional on <strong><em>all</em></strong> charts/symbols including FOREX.</p>
<p><span style="color: #ff0000;"> <strong>UPDATE : This script had been rendered inoperable as of 12 Dec 09 due to changes in the TOS ZigZag function. I will leave it posted as a reference for coders to examine the script methodology. The new version does not use the Zig Zag and is available to PRO Subscribers.</strong></span></p>
<p>Ever found yourself trading a very fast paced market and wanted some reference to the Fibonacci retracements/extensions but didn&#8217;t want to keep drawing and erasing them using the standard ToS tool? I have &#8211;  so I created the AutoFibLines study. AutoFibLines looks for price reversals greater than a user defined threshold and then captures the swing highs and lows. Using these levels, it then plots a series of seven user defined Fibonacci ratio levels as well as the previous swing high and low. The Fibonacci ratios are fully user configurable and can be both positive numbers (in the direction of the current price swing) or negative numbers (opposite to the current price swing). The Fib levels are plotted in the empty space to the right of the current bar and so you must have some &#8220;Right bars&#8221; specified in the style settings. The study updates continuously with price action so there is no user interaction required beyond initial configuration. You can run multiple copies of the study with different reversal thresholds specified to see major, minor, and micro levels at once. <span style="color: #ff0000;">(Note: There is currently a bug in TOS build 1324 and up causing this study to be intermittent on TICK charts. TOS is addressing the issue)</span></p>
<p><div id="pro" class="wp-caption aligncenter" style="width: 640px"><a href="http://www.thinkscripter.com/wp-content/uploads/2009/03/autofibsannotated.png"><img class="size-full wp-image-877" title="autofibsannotated" src="http://www.thinkscripter.com/wp-content/uploads/2009/03/autofibsannotated.png" alt="ThinkScripter AutoFibs" /></a><p class="wp-caption-text">ThinkScripter AutoFibs</p></div><br />
<a href="http://www.thinkscripter.com/forum">
<p style="text-align: center;"><strong> Code Now Available in the ThinkScripter Forum</strong></p>
<p></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.thinkscripter.com/indicator/thinkscripter-autofibs/feed/</wfw:commentRss>
		<slash:comments>22</slash:comments>
		</item>
	</channel>
</rss>

