<?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>EMA &#8211; The Financial Hacker</title>
	<atom:link href="https://financial-hacker.com/tag/ema/feed/" rel="self" type="application/rss+xml" />
	<link>https://financial-hacker.com</link>
	<description>A new view on algorithmic trading</description>
	<lastBuildDate>Sun, 13 Mar 2022 10:17:27 +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>EMA &#8211; The Financial Hacker</title>
	<link>https://financial-hacker.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<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>
	</channel>
</rss>
