<?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; cycle moving average</title>
	<atom:link href="http://www.thinkscripter.com/tag/cycle-moving-average/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>Cycle Point Moving Average</title>
		<link>http://www.thinkscripter.com/indicator/cycle-point-moving-average/</link>
		<comments>http://www.thinkscripter.com/indicator/cycle-point-moving-average/#comments</comments>
		<pubDate>Wed, 20 May 2009 04:37:15 +0000</pubDate>
		<dc:creator>ThinkScripter</dc:creator>
				<category><![CDATA[Indicator]]></category>
		<category><![CDATA[custom]]></category>
		<category><![CDATA[cycle]]></category>
		<category><![CDATA[cycle moving average]]></category>
		<category><![CDATA[moving average]]></category>
		<category><![CDATA[thinkscript]]></category>

		<guid isPermaLink="false">http://www.thinkscripter.com/?p=1315</guid>
		<description><![CDATA[Plots a close approximation of the cycle point moving average. <a href="http://www.thinkscripter.com/indicator/cycle-point-moving-average/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><span style="color: #ff0000;"> <strong>UPDATE : This script has 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.</strong></span></p>
<p>This very basic script plots a close approximation of the cycle point moving average. You enter in the required price reversal for a cycle turn, a moving average period, and it does the rest courtesy of the TOS zigZag function. I had coded this script some time ago and found nothing particularly compelling about it but decided to use it to illustrate the only new thinkScript feature I saw in the last build; namely the <span style="color: #0000ff;">defineColor()</span><span style="color: #0000ff;"> </span>command. In the past, when ever I needed to control the color of some study plot dynamically, I had to hard code in the colors in the associated <span style="color: #0000ff;">assignValueColor()</span> statement. As such, the custom coloring was only modifiable by altering the thinkScript itself. Using the new <span style="color: #0000ff;">defineColor()</span> command allows the scripter to code in value assignable colors but also allow an end user to change those colors should they desire. I expect to retrofit my earlier studies with this capability as time allows.</p>
<p>Break&#8230;.Break&#8230;.</p>
<p>Thanks to all for bearing with me this week. I know my response to your emails has been a bit slower than usual but I think I&#8217;ve gotten back to just about everyone at this point. It&#8217;s been a pretty busy week for myself and the family as we move back into our house after a four year absence in Annapolis. As such I haven&#8217;t really had as much time to devote to developmental stuff as I would like. I expect to be full steam ahead by early next week. </p>
<div id="attachment_1314" class="wp-caption aligncenter" style="width: 640px"><a href="http://www.thinkscripter.com/wp-content/uploads/2009/05/cpma.png"><img class="size-full wp-image-1314" title="cpma" src="http://www.thinkscripter.com/wp-content/uploads/2009/05/cpma.png" alt="Cycle Point Moving Average"  /></a><p class="wp-caption-text">Cycle Point Moving Average</p></div>
<pre class="brush: thinkscript; title: ; notranslate">
# TS_CyclePointMovingAverage
# (c) 2009 http://www.thinkscripter.com
# thinkscripter@gmail.com
# Last Update 19 May 2009

declare fullrange;

input RequiredPointsForCycleReversal = 10;
input CycleMovingAveragePeriod = 7;

def ZZData = ZigZagSign(&quot;reversal amount&quot; = RequiredPointsForCycleReversal);
def isHigh = if ZZData[1] &lt; ZZData and ZZData &gt; ZZData[-1] then 1 else 0;
def isLow = if ZZData[1] &gt; ZZData and ZZData &lt; ZZData[-1] then 1 else 0;
plot cyclePoint = if isHigh then high else if isLow then low else double.nan;
plot CPMA = Average(ZZData, CycleMovingAveragePeriod);

CPMA.DefineColor(&quot;Positive Slope&quot;, color.cyan);
CPMA.DefineColor(&quot;Negative Slope&quot;, color.magenta);
CPMA.AssignValueColor(if CPMA - CPMA[1] &gt;= 0 then CPMA.color(&quot;Positive Slope&quot;) else CPMA.color(&quot;Negative Slope&quot;));
CPMA.setLineWeight(3);

cyclePoint.SetStyle(curve.POINTS);
cyclePoint.SetDefaultColor(color.white);
cyclePoint.SetLineWeight(5);
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.thinkscripter.com/indicator/cycle-point-moving-average/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
	</channel>
</rss>

