<?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>ExcelTrader &#187; MACD</title>
	<atom:link href="http://exceltrader.net/tag/macd/feed/" rel="self" type="application/rss+xml" />
	<link>http://exceltrader.net</link>
	<description>Excel Based Stock and Futures Trading tools.</description>
	<lastBuildDate>Wed, 11 Aug 2010 15:37:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>MACD VBA</title>
		<link>http://exceltrader.net/470/macd-vba/</link>
		<comments>http://exceltrader.net/470/macd-vba/#comments</comments>
		<pubDate>Tue, 06 Oct 2009 21:08:35 +0000</pubDate>
		<dc:creator>ExcelTrader</dc:creator>
				<category><![CDATA[Automated trading Systems]]></category>
		<category><![CDATA[Equities]]></category>
		<category><![CDATA[Excel as a Trading Platform]]></category>
		<category><![CDATA[Free Excel/VBA based Indicators]]></category>
		<category><![CDATA[example]]></category>
		<category><![CDATA[Excel How to: Indicators]]></category>
		<category><![CDATA[MACD]]></category>
		<category><![CDATA[OHLC]]></category>
		<category><![CDATA[stocks]]></category>
		<category><![CDATA[trading]]></category>
		<category><![CDATA[vba]]></category>
		<category><![CDATA[xls]]></category>

		<guid isPermaLink="false">http://www.exceltrader.net/?p=470</guid>
		<description><![CDATA[This post includes links to two example xls files that show both VBA and Formula based calculations for the indicator MACD or Moving Average Convergence <p>Continue reading <a href="http://exceltrader.net/470/macd-vba/">MACD VBA</a></p>]]></description>
			<content:encoded><![CDATA[<p>This post includes links to two example xls files that show both VBA and Formula based calculations for the indicator MACD or Moving Average Convergence Divergence.</p>
<p>Both files contain the exact same set of Open High Low Close data. The formula based version is easier to understand and serves as a way to verify that the VBA code that I wrote is correct. Both methods give the same result.  The major benefit of using VBA is that the parameters for MACD can be easy changed from the input boxes. In addition the VBA method shows only the final result rather than take up five columns.</p>
<p>The VBA based version can be downloaded <a href="/wp-content/uploads/macdVBA.xls">here</a>.</p>
<p>The formula version can be downloaded <a href="/wp-content/uploads/MACDformulas.xls">here</a>. Below is the code from the VBA based version.</p>
<p><font face=Times New Roman><SPAN style="color:#00007F">Sub</SPAN> ETmacd() <SPAN style="color:#007F00">'written by Exceltrader www.exceltrader.net</SPAN><br /><SPAN style="color:#00007F">Dim</SPAN> EMAslow As <SPAN style="color:#00007F">Double</SPAN>, EMAf<SPAN style="color:#00007F">As</SPAN>t <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Double</SPAN>, ws <SPAN style="color:#00007F">As</SPAN> Worksheet, LR <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Integer</SPAN><br /><SPAN style="color:#00007F">Dim</SPAN> eMaF() <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Double</SPAN>, eMaS() <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Double</SPAN>, EMAdif(), emaPer() <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Double</SPAN>, MacDper <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Double</SPAN>, coUnt <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Integer</SPAN><br /><SPAN style="color:#00007F">Dim</SPAN> DataRange <SPAN style="color:#00007F">As</SPAN> Range<br /><SPAN style="color:#00007F">Dim</SPAN> ExPSlowWeight <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Double</SPAN><br /><SPAN style="color:#00007F">Dim</SPAN> ExPFastWeight As <SPAN style="color:#00007F">Double</SPAN><br /><SPAN style="color:#00007F">Dim</SPAN> PerWeight As <SPAN style="color:#00007F">Double</SPAN><br /><SPAN style="color:#007F00">'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''</SPAN><br /><SPAN style="color:#007F00">''&#160;&#160;The below three lines are the MACD settings.&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ''</SPAN><br /><SPAN style="color:#007F00">''&#160;&#160;The Values can either be changed here or uncomment the inputbox lines to be prompted.''</SPAN><br /><SPAN style="color:#007F00">'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''</SPAN><br />EMAslow = 13 <SPAN style="color:#007F00">'InputBox(Prompt:="Enter Macd Slow settings.", Title:="MACD SLOW", Default:="13")</SPAN><br />EMAfAst = 5 <SPAN style="color:#007F00">'InputBox(Prompt:="Enter Macd Fast settings.", Title:="MACD Fast", Default:="5")</SPAN><br />MacDper = 6 <SPAN style="color:#007F00">'InputBox(Prompt:="Enter Macd Period settings.", Title:="MACD Period", Default:="6")</SPAN><br />ExPSlowWeight = 2 / (EMAslow + 1)<br />PerWeight = 2 / (MacDper + 1)<br />ExPFastWeight = 2 / (EMAfAst + 1)<br /><SPAN style="color:#00007F">Set</SPAN> ws = ThisWorkbook.Worksheets("VBA") <SPAN style="color:#007F00">'or use exact sheet name for example ThisWorkbook.worksheet("Sheet1")</SPAN><br /><SPAN style="color:#007F00">'slow</SPAN><br />&#160;&#160;&#160;&#160;<SPAN style="color:#00007F">With</SPAN> ws<br />&#160;&#160;&#160;&#160;LR = .Cells(Rows.coUnt, "A").End(xlUp).Row<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<SPAN style="color:#00007F">For</SPAN> <SPAN style="color:#00007F">Each</SPAN> DataRange <SPAN style="color:#00007F">In</SPAN> ws.Range(.Cells(2, "A"), .Cells(LR, "A"))<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;coUnt = DataRange.Row + 1<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<SPAN style="color:#007F00">'fill the eMA slow Array</SPAN><br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<SPAN style="color:#00007F">ReDim</SPAN> <SPAN style="color:#00007F">Preserve</SPAN> eMaS(1 <SPAN style="color:#00007F">To</SPAN> coUnt)<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<SPAN style="color:#00007F">If</SPAN> coUnt = EMAslow + 1 <SPAN style="color:#00007F">Then</SPAN><br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<SPAN style="color:#007F00">'get the first value which is the Simple Moving average</SPAN><br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; eMaS(coUnt) = Application.Average(ws.Range(.Cells(2, "E"), .Cells(coUnt, "E")))<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<SPAN style="color:#00007F">ElseIf</SPAN> coUnt > EMAslow <SPAN style="color:#00007F">Then</SPAN><br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;eMaS(coUnt) = (.Cells(coUnt, "E") * ExPSlowWeight) + (eMaS(coUnt - 1) * (1 - ExPSlowWeight))<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN><br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<SPAN style="color:#00007F">Next</SPAN> DataRange<br /> <SPAN style="color:#007F00">'fast</SPAN><br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<SPAN style="color:#00007F">For</SPAN> <SPAN style="color:#00007F">Each</SPAN> DataRange <SPAN style="color:#00007F">In</SPAN> ws.Range(.Cells(2, "A"), .Cells(LR, "A"))<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;coUnt = DataRange.Row + 1<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<SPAN style="color:#007F00">'fill the eMA slow Array</SPAN><br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<SPAN style="color:#00007F">ReDim</SPAN> <SPAN style="color:#00007F">Preserve</SPAN> eMaF(1 <SPAN style="color:#00007F">To</SPAN> coUnt)<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<SPAN style="color:#00007F">If</SPAN> coUnt = EMAfAst + 1 <SPAN style="color:#00007F">Then</SPAN><br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<SPAN style="color:#007F00">'get the first value which is the Simple Moving average</SPAN><br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; eMaF(coUnt) = Application.Average(ws.Range(.Cells(2, "E"), .Cells(coUnt, "E")))<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<SPAN style="color:#00007F">ElseIf</SPAN> coUnt > EMAfAst <SPAN style="color:#00007F">Then</SPAN><br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;eMaF(coUnt) = (.Cells(coUnt, "E") * ExPFastWeight) + (eMaF(coUnt - 1) * (1 - ExPFastWeight))<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN><br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<SPAN style="color:#00007F">Next</SPAN> DataRange<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<SPAN style="color:#00007F">ReDim</SPAN> <SPAN style="color:#00007F">Preserve</SPAN> EMAdif(EM<SPAN style="color:#00007F">As</SPAN>low <SPAN style="color:#00007F">To</SPAN> <SPAN style="color:#00007F">UBound</SPAN>(eMaF))<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<SPAN style="color:#00007F">For</SPAN> coUnt = EM<SPAN style="color:#00007F">As</SPAN>low + 1 <SPAN style="color:#00007F">To</SPAN> <SPAN style="color:#00007F">UBound</SPAN>(eMaF)<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;EMAdif(coUnt) = eMaF(coUnt) - eMaS(coUnt)<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<SPAN style="color:#00007F">Next</SPAN> coUnt<br /><SPAN style="color:#007F00">'MacD Period</SPAN><br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<SPAN style="color:#00007F">Dim</SPAN> x <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Integer</SPAN>, y <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Integer</SPAN>, z As <SPAN style="color:#00007F">Integer</SPAN>, Avee As <SPAN style="color:#00007F">Double</SPAN><br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;y = EMAslow + MacDper - 1<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<SPAN style="color:#00007F">For</SPAN> x = y <SPAN style="color:#00007F">To</SPAN> <SPAN style="color:#00007F">UBound</SPAN>(EMAdif) - 2<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<SPAN style="color:#007F00">'get the SMA for first value</SPAN><br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<SPAN style="color:#00007F">If</SPAN> x = y <SPAN style="color:#00007F">Then</SPAN><br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<SPAN style="color:#00007F">For</SPAN> z = EMAslow + 1 <SPAN style="color:#00007F">To</SPAN> EMAslow + MacDper&#160;&#160;<SPAN style="color:#007F00">'(EMAslow + MacDper - 1)</SPAN><br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Ave = Ave + EMAdif(z)<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<SPAN style="color:#00007F">Next</SPAN> z<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<SPAN style="color:#00007F">ReDim</SPAN> emaPer(x <SPAN style="color:#00007F">To</SPAN> LR)<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;emaPer(x) = Ave / MacDper<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<SPAN style="color:#00007F">ElseIf</SPAN> x > y <SPAN style="color:#00007F">Then</SPAN><br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;emaPer(x) = (EMAdif(x + 1) * PerWeight) + (emaPer(x - 1) * (1 - PerWeight))<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN><br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<SPAN style="color:#00007F">Next</SPAN> x<br />&#160;&#160;x = Empty: y = Empty: z = Empty<br />&#160;&#160;x = <SPAN style="color:#00007F">LBound</SPAN>(emaPer)<br />&#160;&#160;y = <SPAN style="color:#00007F">UBound</SPAN>(emaPer)<br />&#160;&#160;<SPAN style="color:#00007F">For</SPAN> z = x <SPAN style="color:#00007F">To</SPAN> y - 1<br />&#160;&#160;.Cells(z + 1, "J") = EMAdif(z + 1) - emaPer(z)<br />&#160;&#160;<SPAN style="color:#00007F">Next</SPAN> z<br /> <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">With</SPAN><br /><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN> <SPAN style="color:#007F00">'written by Exceltrader www.exceltrader.net</SPAN><br /></FONT>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=@Exceltrader+MACD+VBA+http://tinyurl.com/34pclsf" title="Post to Twitter"><img class="nothumb" src="http://exceltrader.net/wp-content/plugins/tweet-this/icons/tt-twitter-micro4.png" alt="Post to Twitter" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://exceltrader.net/470/macd-vba/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>MACD</title>
		<link>http://exceltrader.net/212/macd/</link>
		<comments>http://exceltrader.net/212/macd/#comments</comments>
		<pubDate>Fri, 17 Apr 2009 15:31:10 +0000</pubDate>
		<dc:creator>ExcelTrader</dc:creator>
				<category><![CDATA[Free Excel/VBA based Indicators]]></category>
		<category><![CDATA[example]]></category>
		<category><![CDATA[Excel]]></category>
		<category><![CDATA[filetype]]></category>
		<category><![CDATA[indicator]]></category>
		<category><![CDATA[MACD]]></category>
		<category><![CDATA[stocks]]></category>
		<category><![CDATA[trading]]></category>
		<category><![CDATA[vba]]></category>
		<category><![CDATA[xls]]></category>

		<guid isPermaLink="false">http://www.exceltrader.net/?p=212</guid>
		<description><![CDATA[<p>The following excel file is an example of how to calculate the MACD indicator. This example shows the 5, 13, 6, setting. the MACD is in column N.  Over time I may add more excel indicator examples. As I do they will be most easily found in the right sidebar under the &#8220;How to&#8221; &#8211; <p>Continue reading <a href="http://exceltrader.net/212/macd/">MACD</a></p>]]></description>
			<content:encoded><![CDATA[<p>The following excel file is an example of how to calculate the MACD indicator. This example shows the 5, 13, 6, setting. the MACD is in column N.  Over time I may add more excel indicator examples. As I do they will be most easily found in the right sidebar under the &#8220;How to&#8221; &#8211; &#8220;Indicators&#8221; category.</p>
<p><a title="MACD" href="http://www.exceltrader.net/wp-content/uploads/exampleind.xls">MACD example in excel. </a>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=@Exceltrader+MACD+http://tinyurl.com/23wbrq7" title="Post to Twitter"><img class="nothumb" src="http://exceltrader.net/wp-content/plugins/tweet-this/icons/tt-twitter-micro4.png" alt="Post to Twitter" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://exceltrader.net/212/macd/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
