<?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>Smoothing &#8211; The Financial Hacker</title>
	<atom:link href="https://financial-hacker.com/tag/smoothing/feed/" rel="self" type="application/rss+xml" />
	<link>https://financial-hacker.com</link>
	<description>A new view on algorithmic trading</description>
	<lastBuildDate>Fri, 17 May 2024 13:45:08 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://financial-hacker.com/wp-content/uploads/2017/07/cropped-mask-32x32.jpg</url>
	<title>Smoothing &#8211; The Financial Hacker</title>
	<link>https://financial-hacker.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Ehlers’ Ultimate Smoother</title>
		<link>https://financial-hacker.com/ehlers-ultimate-smoother/</link>
					<comments>https://financial-hacker.com/ehlers-ultimate-smoother/#comments</comments>
		
		<dc:creator><![CDATA[Petra Volkova]]></dc:creator>
		<pubDate>Fri, 17 May 2024 10:10:01 +0000</pubDate>
				<category><![CDATA[Indicators]]></category>
		<category><![CDATA[Petra on Programming]]></category>
		<category><![CDATA[Ehlers]]></category>
		<category><![CDATA[Smoothing]]></category>
		<guid isPermaLink="false">https://financial-hacker.com/?p=4717</guid>

					<description><![CDATA[In TASC 3/24, John Ehlers presented several functions for smoothing a price curve without lag, smoothing it even more, and applying a highpass and bandpass filter. No-lag smoothing, highpass, and bandpass filters are already available in the indicator library of the Zorro platform, but not Ehlers&#8217; latest invention, the Ultimate Smoother. It achieves its tremendous &#8230; <a href="https://financial-hacker.com/ehlers-ultimate-smoother/" class="more-link">Continue reading<span class="screen-reader-text"> "Ehlers’ Ultimate Smoother"</span></a>]]></description>
										<content:encoded><![CDATA[<p><em>In TASC 3/24, John Ehlers presented several functions for smoothing a price curve without lag, smoothing it even more, and applying a highpass and bandpass filter. No-lag smoothing, highpass, and bandpass filters are already available in the indicator library of the Zorro platform, but not Ehlers&#8217; latest invention, the Ultimate Smoother. It achieves its tremendous smoothing power by subtracting the high frequency components from the price curve, using a highpass filter.</em><span id="more-4717"></span></p>
<p>The function below is a straightforward conversion of Ehlers&#8217; EasyLanguage code to C:</p>
<pre class="prettyprint">var UltimateSmoother (var *Data, int Length)
{
  var f = (1.414*PI) / Length;
  var a1 = exp(-f);
  var c2 = 2*a1*cos(f);
  var c3 = -a1*a1;
  var c1 = (1+c2-c3)/4;
  vars US = series(*Data,4);
  return US[0] = (1-c1)*Data[0] + (2*c1-c2)*Data[1] - (c1+c3)*Data[2]
+ c2*US[1] + c3*US[2];
}</pre>
<p>For comparing lag and smoothing power, we apply the ultimate smoother, the super smoother from Zorro&#8217;s indicator library, and a standard EMA to an ES chart from 2023:</p>
<pre class="prettyprint">void run()
{
  BarPeriod = 1440;
  StartDate = 20230201;
  EndDate = 20231201;
  assetAdd("ES","YAHOO:ES=F");
  asset("ES");
  int Length = 30;
  plot("UltSmooth", UltimateSmoother(seriesC(),Length),LINE,MAGENTA);
  plot("Smooth",Smooth(seriesC(),Length),LINE,RED);
  plot("EMA",EMA(seriesC(),3./Length),LINE,BLUE);}
}</pre>
<p>The resulting chart replicates the ES chart in the article. The EMA is shown in blue, the super smoothing filter in red, and the ultimate smoother in magenta:</p>
<p><img fetchpriority="high" decoding="async" width="917" height="560" class="wp-image-4718" src="https://financial-hacker.com/wp-content/uploads/2024/05/word-image-4717-1.png" srcset="https://financial-hacker.com/wp-content/uploads/2024/05/word-image-4717-1.png 917w, https://financial-hacker.com/wp-content/uploads/2024/05/word-image-4717-1-300x183.png 300w, https://financial-hacker.com/wp-content/uploads/2024/05/word-image-4717-1-768x469.png 768w" sizes="(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px" /></p>
<p>We can see that the ultimate smoother produces indeed the best, albeit smoothed, representation of the price curve.</p>
<p>In TASC 4/24, Ehlers also presented two band indicators based on his Ultimate Smoother. Band indicators can be used to trigger long or short positions when the price hits the upper or lower band. The first band indicator, the <strong>Ultimate Channel</strong>, is again a straightforward conversion to the C language from Ehlers’ TradeStation code:</p>
<pre class="prettyprint">var UltimateChannel(int Length,int STRLength,int NumSTRs)
{
  var TH = max(priceC(1),priceH());
  var TL = min(priceC(1),priceL());
  var STR = UltimateSmoother(series(TH-TL),STRLength);
  var Center = UltimateSmoother(seriesC(),Length);
  rRealUpperBand = Center + NumSTRs*STR;
  rRealLowerBand = Center - NumSTRs*STR;
  return Center;
}</pre>
<p><strong>rRealUpperBand</strong> and <strong>rRealLowerBand</strong> are pre-defined global variables that are used by band indicators in the indicator library of the Zorro platform. For testing the new indicator, we apply it to an ES chart:</p>
<pre class="prettyprint">void run()
{
  BarPeriod = 1440;
  StartDate = 20230301;
  EndDate = 20240201;
  assetAdd("ES","YAHOO:ES=F");
  asset("ES");
  UltimateChannel(20,20,1);
  plot("UltChannel1",rRealUpperBand,BAND1,BLUE);
  plot("UltChannel2",rRealLowerBand,BAND2,BLUE|TRANSP);
}</pre>
<p>The resulting chart replicates the ES chart in Ehlers’ article:</p>
<p><img decoding="async" width="1060" height="620" class="wp-image-4721" src="https://financial-hacker.com/wp-content/uploads/2024/05/word-image-4717-1-1.png" srcset="https://financial-hacker.com/wp-content/uploads/2024/05/word-image-4717-1-1.png 1060w, https://financial-hacker.com/wp-content/uploads/2024/05/word-image-4717-1-1-300x175.png 300w, https://financial-hacker.com/wp-content/uploads/2024/05/word-image-4717-1-1-1024x599.png 1024w, https://financial-hacker.com/wp-content/uploads/2024/05/word-image-4717-1-1-768x449.png 768w" sizes="(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px" /></p>
<p>The second band indicator, <strong>Ultimate Bands</strong>, requires less code than Ehlers’ implementation, since lite-C can apply functions to a whole data series:</p>
<pre class="prettyprint">var UltimateBands(int Length,int NumSDs)
{
  var Center = UltimateSmoother(seriesC(),Length);
  vars Diffs = series(priceC()-Center);
  var SD = sqrt(SumSq(Diffs,Length)/Length);
  rRealUpperBand = Center + NumSDs*SD;
  rRealLowerBand = Center - NumSDs*SD; return Center;
}</pre>
<p>Again applied to the ES chart:</p>
<pre class="prettyprint">void run()
{
  BarPeriod = 1440;
  StartDate = 20230301;
  EndDate = 20240201;
  assetAdd("ES","YAHOO:ES=F");
  asset("ES");
  UltimateBands(20,1);
  plot("UltBands1",rRealUpperBand,BAND1,BLUE);
  plot("UltBands2",rRealLowerBand,BAND2,BLUE|TRANSP);
}</pre>
<p><img decoding="async" width="1060" height="620" class="wp-image-4722" src="https://financial-hacker.com/wp-content/uploads/2024/05/word-image-4717-2.png" srcset="https://financial-hacker.com/wp-content/uploads/2024/05/word-image-4717-2.png 1060w, https://financial-hacker.com/wp-content/uploads/2024/05/word-image-4717-2-300x175.png 300w, https://financial-hacker.com/wp-content/uploads/2024/05/word-image-4717-2-1024x599.png 1024w, https://financial-hacker.com/wp-content/uploads/2024/05/word-image-4717-2-768x449.png 768w" sizes="(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px" /></p>
<p>We can see that both indicators produce relatively similar bands with low lag. The code of the Ultimate Smoother and the bands can be downloaded from the 2024 script repository.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://financial-hacker.com/ehlers-ultimate-smoother/feed/</wfw:commentRss>
			<slash:comments>7</slash:comments>
		
		
			</item>
	</channel>
</rss>
