<?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>RSI &#8211; The Financial Hacker</title>
	<atom:link href="https://financial-hacker.com/tag/rsi/feed/" rel="self" type="application/rss+xml" />
	<link>https://financial-hacker.com</link>
	<description>A new view on algorithmic trading</description>
	<lastBuildDate>Fri, 13 Dec 2024 11:23:30 +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>RSI &#8211; The Financial Hacker</title>
	<link>https://financial-hacker.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>The Ultimate Strength Index</title>
		<link>https://financial-hacker.com/the-ultimate-strength-index/</link>
					<comments>https://financial-hacker.com/the-ultimate-strength-index/#comments</comments>
		
		<dc:creator><![CDATA[Petra Volkova]]></dc:creator>
		<pubDate>Fri, 13 Dec 2024 09:47:55 +0000</pubDate>
				<category><![CDATA[Indicators]]></category>
		<category><![CDATA[Petra on Programming]]></category>
		<category><![CDATA[Ehlers]]></category>
		<category><![CDATA[RSI]]></category>
		<guid isPermaLink="false">https://financial-hacker.com/?p=4776</guid>

					<description><![CDATA[The RSI (Relative Strength Index) is a popular indicator used in many trading systems for filters or triggers. In TASC 12/2024 John Ehlers proposed a replacement for this indicator. His USI (Ultimate Strength Index) has the advantage of symmetry – the range is -1 to 1 – and, especially important, less lag. So it can &#8230; <a href="https://financial-hacker.com/the-ultimate-strength-index/" class="more-link">Continue reading<span class="screen-reader-text"> "The Ultimate Strength Index"</span></a>]]></description>
										<content:encoded><![CDATA[<p><em>The <strong>RSI</strong> (Relative Strength Index) is a popular indicator used in many trading systems for filters or triggers. In TASC 12/2024 John Ehlers proposed a replacement for this indicator. His <strong>USI</strong> (Ultimate Strength Index) has the advantage of symmetry – the range is -1 to 1 – and, especially important, less lag. So it can trigger trades earlier. Like the RSI, it enhances cycles and trends in the data, which makes it well suited for various sorts of trading systems. Let’s look how to realize it in code.</em><span id="more-4776"></span></p>
<p>The USI is based on another indicator by John Ehlers, the <strong>Ultimate Smoother</strong>. It was covered in a previous article. Here’s again its code in 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>Similar to the RSI, the Ultimate Strength Index calculates the normalized differences of the ups and downs in the price curve, after no-lag smoothing. Here’s Ehlers’ EasyLanguage code converted to C:</p>
<pre class="prettyprint">var UltimateStrength (int Length)
{
  vars SU = series(max(0,priceC(0) - priceC(1)));
  var USU = UltimateSmooth(series(SMA(SU,4)),Length);
  vars SD = series(max(0,priceC(1) - priceC(0)));
  var USD = UltimateSmooth(series(SMA(SD,4)),Length);
  return (USU-USD)/fix0(USU+USD);
}</pre>
<p>The <strong>fix0</strong> function is a convenience function that corrects possible divisions by zero. For checking the correctness of our conversion, we’re plotting the USI with two different time periods on a SPX chart. The code:</p>
<pre class="prettyprint">void run()
{
  BarPeriod = 1440;
  StartDate = 20230801;
  EndDate = 20240801;
  assetAdd("SPX","STOOQ:^SPX");
  asset("SPX");
  plot("USI(112)",UltimateStrength(112),NEW|LINE,BLUE);
  plot("USI(28)",UltimateStrength(28),NEW|LINE,BLUE);
}</pre>
<p>The resulting chart replicates the ES chart in Ehlers’ article:</p>
<p><img fetchpriority="high" decoding="async" width="774" height="537" class="wp-image-4777" src="https://financial-hacker.com/wp-content/uploads/2024/12/word-image-4776-1.png" srcset="https://financial-hacker.com/wp-content/uploads/2024/12/word-image-4776-1.png 774w, https://financial-hacker.com/wp-content/uploads/2024/12/word-image-4776-1-300x208.png 300w, https://financial-hacker.com/wp-content/uploads/2024/12/word-image-4776-1-768x533.png 768w" sizes="(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 984px) 61vw, (max-width: 1362px) 45vw, 600px" /></p>
<p>We can see that the long time frame USI enhances the begin and end of trends, the short time frame USI makes the cycles visible. The code can be downloaded from the 2024 script repository.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://financial-hacker.com/the-ultimate-strength-index/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>The Relative Vix Strength Exponential Moving Average</title>
		<link>https://financial-hacker.com/the-relative-strength-exponential-moving-average/</link>
					<comments>https://financial-hacker.com/the-relative-strength-exponential-moving-average/#comments</comments>
		
		<dc:creator><![CDATA[Petra Volkova]]></dc:creator>
		<pubDate>Tue, 08 Mar 2022 16:28:49 +0000</pubDate>
				<category><![CDATA[Indicators]]></category>
		<category><![CDATA[Petra on Programming]]></category>
		<category><![CDATA[EMA]]></category>
		<category><![CDATA[Experiment]]></category>
		<category><![CDATA[RSI]]></category>
		<category><![CDATA[SPY]]></category>
		<guid isPermaLink="false">https://financial-hacker.com/?p=4325</guid>

					<description><![CDATA[The exponential moving average (EMA) and the Relative Strength Indicator (RSI) are both very popular and useful indicators for algorithmic trading. So why no glue both together to get an even better indicator? That was the basic idea of Vitali Apirine&#8217;s TASC 3/2022 article. We&#8217;re measuring the relative strength of a volatility index (VIX), and &#8230; <a href="https://financial-hacker.com/the-relative-strength-exponential-moving-average/" class="more-link">Continue reading<span class="screen-reader-text"> "The Relative Vix Strength Exponential Moving Average"</span></a>]]></description>
										<content:encoded><![CDATA[<p><em>The exponential moving average (EMA) and the Relative Strength Indicator (RSI) are both very popular and useful indicators for algorithmic trading. So why no glue both together to get an even better indicator? That was the basic idea of Vitali Apirine&#8217;s TASC 3/2022 article. We&#8217;re measuring the relative strength of a volatility index (VIX), and use the result as an EMA time period. Do we now have the ultimate indicator to beat them all?</em></p>
<p><span id="more-4325"></span></p>
<p>The algorithm from Vitali&#8217;s article, slightly reformulated for clarity:</p>
<p><strong>RSEMA[0] = Alpha * Price + (1-Alpha) * RSEMA[1]</strong></p>
<p>This is a classical EMA, but with a volatility dependent alpha factor:</p>
<p><strong>Alpha = 2/(TimePeriod+1) * (1 + 10*abs(EMAUp-EMADn)/(EMAUp+EMADn))</strong></p>
<p><strong>EMAUp</strong> and <strong>EMADn</strong> are the VIX EMA of days with positive returns and the VIX EMA of days with negative returns. The separation into positive and negative days resembles the RSI. And we have a double EMA in this formula, which will hopefully render the result twice as good. The factor <strong>10</strong> is inserted for getting an even better result.</p>
<p>VIX historical data is not available via API from free online sources as far as I know, but it can be downloaded from most brokers with the Zorro Download script. The resulting RSEMA code in C for Zorro:</p>
<pre class="prettyprint">var RSEMA(int Periods, int PdsEMA, var Mltp)
{
  asset("VIX");
  var VolatC = priceC();
  asset(AssetPrev); // re-select asset
  var VolatUp = series(ifelse(RET(1)&gt;0,VolatC,0)),
    VolatDn = series(ifelse(RET(1)&lt;0,VolatC,0));
  var EMAUp = EMA(VolatUp,PdsEMA), EMADn = EMA(VolatDn,PdsEMA);
  var RS = abs(EMAUp-EMADn)/(EMAUp+EMADn+0.00001)*Mltp;
  var Rate = 2./(Periods+1)*(RS+1);
  return EMA(priceC(),Rate);
}
</pre>
<p><strong>AssetPrev</strong> is the asset that was selected when the <strong>RSEMA</strong> function is called. Adding <strong>0.00001</strong> to the divisor prevents a crash by division by zero. Note that the often used EMA is available in two versions, to be called with a data series or with a single variable. I&#8217;m using the variable version here.</p>
<p>The RSEMA(10,10,10) applied on a SPX500 chart replicates the chart in the TASC article:</p>
<p><img decoding="async" src="https://financial-hacker.com/wp-content/uploads/2022/03/030822_1611_TheRelative1.png" alt=""></p>
<p>We can see that the RSEMA (blue) has noticeably less lag than the EMA (red), which is not really surprising because the higher alpha rate is equivalent to a smaller EMA time period. The author believed that EMA crossovers of this indicator can be used as entry points for long trades. But with the caveat that they <em>&#8220;produce lots of whipsaws […] and should be used in conjunction with price analysis&#8221;</em>.</p>
<p>He&#8217;s certainly right. A long-only SPY trading system with RSEMA-EMA crossovers at default parameter values produced a positive end result, as seen in the chart below. But with large drawdowns and, sadly, far less profitable than buy-and-hold. So, be sure to use it only in conjunction with price analysis. Whatever that means. And better not on a real money account.</p>
<p><img decoding="async" src="https://financial-hacker.com/wp-content/uploads/2022/03/030822_1611_TheRelative2.png" alt=""></p>
<p>For your own experiments, the RSEMA indicator and the SPY trading system can be downloaded from the 2022 script repository.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://financial-hacker.com/the-relative-strength-exponential-moving-average/feed/</wfw:commentRss>
			<slash:comments>5</slash:comments>
		
		
			</item>
		<item>
		<title>Petra on Programming: Get Rid of Noise</title>
		<link>https://financial-hacker.com/petra-on-programming-get-rid-of-noise/</link>
					<comments>https://financial-hacker.com/petra-on-programming-get-rid-of-noise/#comments</comments>
		
		<dc:creator><![CDATA[Petra Volkova]]></dc:creator>
		<pubDate>Fri, 27 Nov 2020 14:54:48 +0000</pubDate>
				<category><![CDATA[Indicators]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ehlers]]></category>
		<category><![CDATA[RSI]]></category>
		<category><![CDATA[SPY]]></category>
		<guid isPermaLink="false">https://financial-hacker.com/?p=3742</guid>

					<description><![CDATA[A major problem of indicator-based strategies is that most indicators produce more or less noisy output, resulting in false signals. The faster the indicator reacts on market situations, the noisier is it usually. In the S&#38;C December issue, John Ehlers proposed a de-noising technology based on correlation. Compared with a lowpass filter, this method does &#8230; <a href="https://financial-hacker.com/petra-on-programming-get-rid-of-noise/" class="more-link">Continue reading<span class="screen-reader-text"> "Petra on Programming: Get Rid of Noise"</span></a>]]></description>
										<content:encoded><![CDATA[<p><em>A major problem of indicator-based strategies is that most indicators produce more or less noisy output, resulting in false signals. The faster the indicator reacts on market situations, the noisier is it usually. In the S&amp;C December issue, <strong>John Ehlers</strong> proposed a de-noising technology based on correlation. Compared with a lowpass filter, this method does not delay the signal. As an example, we will apply the noise elimination to Ehlers&#8217; <strong>MyRSI</strong> indicator, a RSI variant that he presented in an earlier article.</em><span id="more-3742"></span></p>
<p>The MyRSI indicator sums up positive and negative changes in a data series, and returns their normalized difference. The C version for Zorro:</p>
<pre class="prettyprint">var MyRSI(vars Data,int Period)<br />{<br /> var CU = SumUp(Data,Period+1);<br /> var CD = -SumDn(Data,Period+1);<br /> return ifelse(CU+CD != 0,(CU-CD)/(CU+CD),0);<br />}<span style="color: #2e74b5"><br /></span></pre>
<p>For eliminating noise, the function below (<strong>NET</strong> = <strong>N</strong>oise <strong>E</strong>limination <strong>T</strong>echnology) calculates the <strong>Kendall Correlation</strong> of a data series with a rising slope. This is supposed to remove all components that are not following the main trend of the indicator output. The code:</p>
<pre class="prettyprint">var NET(vars Data,int Period)<br />{<br /> int i,k;<br /> var Num = 0;<br /> for(i=1; i&lt;Period; i++)<br />   for(k=0; k&lt;i; k++)<br />     Num -= sign(Data[i]-Data[k]);<br /> var Denom = .5*Period*(Period-1);<br /> return Num/Denom;<br />}</pre>
<p>For making the effect of the denoising visible, we produce a SPY chart from 2019-2020. The red line is the original MyRSI, the blue line the de-noised version:</p>
<p><img decoding="async" src="https://financial-hacker.com/wp-content/uploads/2020/11/112720_1424_PetraonProg1.png" alt="" /></p>
<p>The technology appears to work well in this example for removing the noise. But the NET function is not meant as a replacement of a lowpass or smoothing filter: its output is always in the -1 .. +1 range, so it can be used for de-noising oscillators, but not, for instance, to generate a smoothed version of the price curve.</p>
<p>One might be tempted to use the blue line in the above chart for trade signals. RSI-based signals usually trigger a long trade when the indicator crosses below a lower threshold, and a short trade when it crosses above an upper threshold. But alas, neither is strategy development this easy nor is the de-noised MyRSI the holy grail of indicators. I tested several methods to use it for generating SPY trade signals, but neither was a strong improvement over a simple lowpass filter strategy or even to buy-and-hold. Maybe a reader can find a more convincing solution?</p>
<p>The MyRSI and NET functions and the script for generating the chart can be downloaded from the 2020 script repository. You need Zorro 2.33 or above.</p>

]]></content:encoded>
					
					<wfw:commentRss>https://financial-hacker.com/petra-on-programming-get-rid-of-noise/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
	</channel>
</rss>
