<?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; vba</title>
	<atom:link href="http://exceltrader.net/tag/vba/feed/" rel="self" type="application/rss+xml" />
	<link>http://exceltrader.net</link>
	<description>Excel Based Stock and Futures Trading tools.</description>
	<lastBuildDate>Wed, 18 Jan 2012 18:01:20 +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>Excel Benchmark 2011: An Excel Speed Test (with trading functions)</title>
		<link>http://exceltrader.net/984/benchmark_et-xls-an-excel-benchmark-for-traders/</link>
		<comments>http://exceltrader.net/984/benchmark_et-xls-an-excel-benchmark-for-traders/#comments</comments>
		<pubDate>Wed, 09 Mar 2011 00:22:00 +0000</pubDate>
		<dc:creator>ExcelTrader</dc:creator>
				<category><![CDATA[Automated trading Systems]]></category>
		<category><![CDATA[Backtesting]]></category>
		<category><![CDATA[Benchmark.xls]]></category>
		<category><![CDATA[Excel as a Trading Platform]]></category>
		<category><![CDATA[Indicators]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[2003]]></category>
		<category><![CDATA[2007]]></category>
		<category><![CDATA[2010]]></category>
		<category><![CDATA[benchmark]]></category>
		<category><![CDATA[cpu]]></category>
		<category><![CDATA[Excel]]></category>
		<category><![CDATA[excel speed]]></category>
		<category><![CDATA[processor]]></category>
		<category><![CDATA[smart calculation]]></category>
		<category><![CDATA[speed]]></category>
		<category><![CDATA[vba]]></category>

		<guid isPermaLink="false">http://exceltrader.net/?p=984</guid>
		<description><![CDATA[BenchMark_ET.xls measures Excel performance with 6 trading related Excel/VBA tests. Once the benchmark is complete, your results can be submitted to the Database (just press &#8220;Submit&#8221;). All submitted results are available here (all results are sortable). The default view is most recently submitted result topmost (so your result should be on top until you sort). [...]]]></description>
			<content:encoded><![CDATA[<p>

<style type="text/css">




.analysisBench {
	background-color: #FCF9FA;	
	float: left;
	font-size: 30px;
	height: auto;
	line-height: 35px;
	margin-bottom: 20px;
	margin-left: 20px;
	margin-right: 20px;
	margin-top: 20px;
	padding-bottom: 25px;
	padding-left: 25px;
	padding-right: 25px;
	padding-top: 25px;
	text-align: justify;
	width: auto;
	border: 6px solid #C04749;
}
</style>



<div class="analysisBench">
<p> <strong>Live Analysis of  Benchmark Results</strong></p>
<p>Of 608 Benchmark results, currently the Excel version with  the highest *average Total Score of 50.78 is Excel 2010. Excel 2003 has an average  Total Score of 36.17 . Excel 2002 has an average  Total Score of 30.18 and the worst average Total Score is Excel 2007 at 18.52.</p>
<p>Of the top 30 scores, 90% of the processors brand name is  Intel. Followed by AMD which is the processor in 10% of the top 30 results. The exact processor with the current top score of 118.2620 is Intel(R) Core(TM)2 Quad CPU    Q9550  @ 2.83GHz. It's likely that this processor is overclocked beyond what is shown on the benchmark <a href="http://exceltrader.net/et2/benchMark.php" target="_new">results page</a> and is not necessarily   the top performing processor at default settings.</p>
<p>Of the six tests used to determine Total score, Test 3 shows  the most variance between Excel Versions. For example the best score for test 3 in Excel 2003 is 56785 while the best test 3 score for 2010 is 7594 so for test three, Excel 2003 performs 747.76% better when only the best scores are considered. Test 3 measures how many ticks can be  displayed on a stock chart within a 30 second time period. The other tests composing Total Score involve more  intensive calculation tests than this charting display test. Although this difference is large, Test 3  should only be considered over Total Score for the most charting intensive  Excel programs where VBA and/or formula based calculations are relatively  minimal. For most Trading applications Total Score which is a composite of the  6 tests is the most useful score to use for evaluating Excel  versions/Processors/OS etc.</p>
<p>Of the 608 current results 136 are below 0. I would not  consider any system scoring below 0 adequate for running an excel based trading  system. A modern system scoring below 0 should be checked for unnecessary startup  programs, spyware, viruses etc. </p>
<p>*Scores below 0 are set to zero for purposes of calculating  average total score. </p>
<p>If your score is low and you’re considering a desktop upgrade, I currently recommend this high benchmark scoring <a href="http://www.amazon.com/gp/product/B004YD6FK8/ref=as_li_tf_tl?ie=UTF8&tag=switrablo-20&linkCode=as2&camp=1789&creative=9325&creativeASIN=B004YD6FK8" target="_blank">Intel 3.40GHz Quad Core i7-2600 desktop</a><img src="http://www.assoc-amazon.com/e/ir?t=switrablo-20&l=as2&o=1&a=B004YD6FK8" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /> and <a href="http://www.amazon.com/gp/product/B0039L50J8/ref=as_li_tf_tl?ie=UTF8&tag=switrablo-20&linkCode=as2&camp=1789&creative=9325&creativeASIN=B0039L50J8" target="_blank">Microsoft Office Home & Business 2010</a><img src="http://www.assoc-amazon.com/e/ir?t=switrablo-20&l=as2&o=1&a=B0039L50J8" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" />. </p>
</div>


<script type="text/javascript" src="http://wms.assoc-amazon.com/20070822/US/js/link-enhancer-common.js?tag=switrablo-20">
</script>
<noscript>
    <img src="http://wms.assoc-amazon.com/20070822/US/img/noscript.gif?tag=switrablo-20" alt="" />
</noscript>





</p>
<p>BenchMark_ET.xls measures Excel performance with 6      trading related Excel/VBA tests. Once the benchmark is complete, your results can be submitted to the Database (just press &#8220;Submit&#8221;). All      submitted results are available <a title="Benchmark results" href="http://exceltrader.net/et2/benchMark.php" target="_blank">here</a> (all results are sortable). The default view is most recently submitted result topmost (so your result should be on top until you sort). System Information is listed along with each test result (processor name, OS, Clock Speed, Cores, Excel Version, File type). A composite Scoring system is in place, but each individual test result is also listed in the results database. All results can be sorted in ascending/descending order by clicking each result&#8217;s title. For best results disable autosave and background error checking in Excel options.</p>
<p><strong>Instructions:</strong></p>
<ol>
<li><a href="/wp-content/uploads/BenchMark_ET.xls">Download Benchmark_ET.xls.</a></li>
<li>Open Benchmark_ET.xls and press the button &#8220;Start Benchmark&#8221;</li>
<li>(optional) Submit and view your results.</li>
</ol>
<div class="mceTemp">
<dl id="attachment_994" class="wp-caption alignnone" style="width: 349px;"> </dl>
<p><a href="http://exceltrader.net/wp-content/uploads/BenET.jpg"><img class="size-full wp-image-994" title="BenET" src="http://exceltrader.net/wp-content/uploads/BenET.jpg" alt="Benchmark for Excel by Exceltrader" width="339" height="398" /></a></p>
<dl id="attachment_994" class="wp-caption alignnone" style="width: 349px;"> </dl>
</div>
<p><em>Below is an explantion of each test:</em></p>
<p><strong><em>Test 1: </em></strong>Data Build Time</p>
<p>Measures the time it takes VBA to create 5 columns * 65535 rows of random tick data.</p>
<p><strong>Test 2: </strong>MACD VBA Calculation</p>
<p>Measures the time it takes VBA to calculate the MACD indicator for the 5 columns * 65535 rows of data created in test one.  (The VBA code for the MACD calculation is <a title="MACD" href="http://exceltrader.net/212/macd/" target="_blank">here</a>.)</p>
<p><strong>Test 3:</strong> Dispayed Ticks (30 Sec)</p>
<p>Measures the number of ticks (price changes) than can be displayed in 30 seconds. <em>In my original benchmark this was the only type of test. The results varied so greatly that newer versions of excel took hours to complete the benchmark while older versions took just minutes making the benchmark annoying to run. By limiting this test to 30 seconds the total time to run the benchmark will be similar among all systems tested.</em></p>
<p><strong>Test 4:</strong> 63000 ticks converted to OHLC</p>
<p>After 63000 ticks are created, this test converts the tick data to OHLC data. The result is measured in time.</p>
<p><strong>Test 5:</strong> Live formula Test</p>
<p>This test begins with with 5000 bars of OHLC and a series of formula based indicators. The last price changes in E5000 as rapidly as possible but waits for all formulas to calculate between each price change.  The benchmark result is the number of price changes that can be completed with formula recalculations within 30 seconds.  Below is the list of indicators calculated with live formulas in this test.</p>
<ol>
<li>SMA (100,200,300)</li>
<li>RSS</li>
<li>RSI</li>
<li>Fisher Transform of RSI</li>
</ol>
<p><strong>Test 6:</strong> Live formula Test</p>
<p>This test is identical to test 5 except that all formulas also refer to and are dependent on the changing cell, E5000. Test 6  compared to Test 5  is meant to test the &#8220;smart recalculation engine&#8221; promoted by Microsoft.  More info can be found in <a title="Smart Recalcuation" href="http://msdn.microsoft.com/en-us/library/aa730921%28v=office.12%29.aspx" target="_blank">this Microsoft article</a> under the section titles &#8220;Understanding Calculation Methods in Excel&#8221;.</p>
<p><strong>Scoring:</strong></p>
<p>A composite scoring system is in place and the result is listed in column two on the results data base page and also at the top of the benchmark results form upon completion. With the exception of test 3 all tests are counted equally. Test 3, which tests displayed ticks on a stock chart is counted 3 times because for trading it&#8217;s an important result to consider<strong>. </strong>To establish the composite score 20 tests were run on various systems and excel versions. The best and worst scores for each test were used to establish the benchmark score. The best scores from the initial tests resulted in a score of 100 and the worst scores resulted in a score of 0 therefore scores greater than 100 and below 0 are possible.  On the results page idle processor speed is shown and overclocked systems may not show the true processor speed. If you see two systems that look the same with significantly different scores, the higher score is likely from an overclocked system. Thanks for trying my Excel benchmark and submitting your system&#8217;s result!<strong><br />
</strong></p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://exceltrader.net/984/benchmark_et-xls-an-excel-benchmark-for-traders/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Stock Dividend Data Downloader.</title>
		<link>http://exceltrader.net/714/stock-dividend-data-downloader/</link>
		<comments>http://exceltrader.net/714/stock-dividend-data-downloader/#comments</comments>
		<pubDate>Sun, 21 Feb 2010 17:48:21 +0000</pubDate>
		<dc:creator>ExcelTrader</dc:creator>
				<category><![CDATA[Automated trading Systems]]></category>
		<category><![CDATA[Excel Trading Tools]]></category>
		<category><![CDATA[Dividend Dates]]></category>
		<category><![CDATA[Dividend Yield]]></category>
		<category><![CDATA[stocks]]></category>
		<category><![CDATA[vba]]></category>
		<category><![CDATA[xls]]></category>

		<guid isPermaLink="false">http://exceltrader.net/?p=714</guid>
		<description><![CDATA[The following (free) file downloads dividend data. Ex Dividend Date Dividend pay date. Dividend Yield. The instructions are: Enter your symbols in Column A Press the &#8220;Get Dividend Data&#8221; button. Below is an image of the file.]]></description>
			<content:encoded><![CDATA[<p>The<a href="/wp-content/uploads/DivDates.xls"> following (free) file</a> downloads dividend data.</p>
<ol>
<li>Ex Dividend Date</li>
<li>Dividend pay date.</li>
<li>Dividend Yield.</li>
</ol>
<p>The instructions are:</p>
<ol>
<li>Enter your symbols in Column A</li>
<li>Press the &#8220;Get Dividend Data&#8221; button.</li>
</ol>
<p>Below is an image of the file.</p>
<p><a href="http://exceltrader.net/wp-content/uploads/Dividend.jpg"><img class="alignnone size-full wp-image-718" title="Dividend" src="http://exceltrader.net/wp-content/uploads/Dividend.jpg" alt="" width="741" height="336" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://exceltrader.net/714/stock-dividend-data-downloader/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Stochastics Indicator &#8211; Excel VBA and Formula versions</title>
		<link>http://exceltrader.net/506/stochastics-indicator-vba-and-formula-versions/</link>
		<comments>http://exceltrader.net/506/stochastics-indicator-vba-and-formula-versions/#comments</comments>
		<pubDate>Thu, 29 Oct 2009 22:32:32 +0000</pubDate>
		<dc:creator>ExcelTrader</dc:creator>
				<category><![CDATA[Excel How to]]></category>
		<category><![CDATA[Free Excel/VBA based Indicators]]></category>
		<category><![CDATA[%D]]></category>
		<category><![CDATA[%K]]></category>
		<category><![CDATA[automated]]></category>
		<category><![CDATA[chart]]></category>
		<category><![CDATA[example]]></category>
		<category><![CDATA[Excel]]></category>
		<category><![CDATA[filetype]]></category>
		<category><![CDATA[How to]]></category>
		<category><![CDATA[stochastic]]></category>
		<category><![CDATA[stochastics]]></category>
		<category><![CDATA[stocks]]></category>
		<category><![CDATA[trading]]></category>
		<category><![CDATA[vba]]></category>

		<guid isPermaLink="false">http://www.exceltrader.net/?p=506</guid>
		<description><![CDATA[This post includes  two example excel files that show both VBA and Formula based calculations for the indicator "Stochastics". Both files contain the exact same set of Open High Low Close data. The formula based version should be easier to understand and serves as a way to verify that the VBA code that I wrote [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.exceltrader.net/wp-content/uploads/StochasticFormula.xls"></a>This post includes  two example excel files that show both VBA and Formula based calculations for the indicator "Stochastics".</p>
<p>Both files contain the exact same set of Open High Low Close data. The formula based version should be 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 for both %k and %D.  The major benefit of using VBA is that the parameters for Stochastics can be easily 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="http://www.exceltrader.net/wp-content/uploads/StochasticVBA.xls">here</a>.</p>
<p>The formula version can be downloaded <a href="http://www.exceltrader.net/wp-content/uploads/StochasticFormula.xls">here</a>. Below is an image of the formulas used in the formula based version.</p>
<p><a href="http://www.exceltrader.net/wp-content/uploads/StochasticFormula.gif"><img class="alignnone size-full wp-image-514" title="StochasticFormula" src="http://www.exceltrader.net/wp-content/uploads/StochasticFormula.gif" alt="StochasticFormula" width="1120" height="632" /></a></p>
<p>Below is the code that I wrote for the VBA based version.</p>
<p><font face=Courier New><SPAN style="color:#00007F">Sub</SPAN> ETstochastic() <SPAN style="color:#007F00">'written by Exceltrader www.exceltrader.net</SPAN><br /><SPAN style="color:#00007F">Dim</SPAN> StochSetting <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Integer</SPAN>, Ksetting <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Integer</SPAN>, Dsetting <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Integer</SPAN><br /><SPAN style="color:#00007F">Dim</SPAN> A() <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Double</SPAN>, B() <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Double</SPAN>, C() <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Double</SPAN>, D() <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Double</SPAN>, E() <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Double</SPAN><br /><SPAN style="color:#00007F">Dim</SPAN> Count <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Long</SPAN><br /><SPAN style="color:#00007F">Dim</SPAN> Xcounter <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Integer</SPAN>, Xavg <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Double</SPAN><br /><SPAN style="color:#00007F">Dim</SPAN> Zcounter <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Integer</SPAN>, Zavg <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Double</SPAN><br /><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 <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Integer</SPAN><br /><SPAN style="color:#007F00">'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''</SPAN><br /><SPAN style="color:#007F00">''&#160;&#160;The below three lines are the Stochastic settings.</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 />StochSetting = 14 <SPAN style="color:#007F00">'InputBox(Prompt:="Enter Stoch settings Number of Periods.", Title:="Stochastic Period", Default:="13")</SPAN><br />Ksetting = 2 <SPAN style="color:#007F00">'InputBox(Prompt:="Enter Moving Average For %K", Title:="%K Setting", Default:="5")</SPAN><br />Dsetting = 3 <SPAN style="color:#007F00">'InputBox(Prompt:="Enter Moving Average For %D", Title:="%D Setting", Default:="6")</SPAN><br />Set ws = ThisWorkbook.Worksheets("Svba")<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 /><SPAN style="color:#007F00">'does the same as formula =E15-(MIN(D1:D15))</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<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<SPAN style="color:#00007F">ReDim</SPAN> <SPAN style="color:#00007F">Preserve</SPAN> A(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 >= StochSetting + 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; A(Count) = .Cells(Count, "E") - Application.Min(ws.Range(.Cells(Count - StochSetting, "D") _<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; , .Cells(Count, "D")))<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; <SPAN style="color:#007F00">'does the same as formula&#160;&#160; =MAX(C36:C50)-MIN(D36:D50)</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<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<SPAN style="color:#00007F">ReDim</SPAN> <SPAN style="color:#00007F">Preserve</SPAN> B(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 >= StochSetting + 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; B(Count) = Application.Max(ws.Range(.Cells(Count - StochSetting, "C"), .Cells(Count, "C"))) _<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; - Application.Min(ws.Range(.Cells(Count - StochSetting, "D"), .Cells(Count, "D")))<br />&#160;&#160;&#160;&#160;&#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:#007F00">'=100*(I50/J50)</SPAN><br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<SPAN style="color:#00007F">ReDim</SPAN> <SPAN style="color:#00007F">Preserve</SPAN> C(StochSetting + 1 <SPAN style="color:#00007F">To</SPAN> <SPAN style="color:#00007F">UBound</SPAN>(B))<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<SPAN style="color:#00007F">For</SPAN> Count = StochSetting + 1 <SPAN style="color:#00007F">To</SPAN> <SPAN style="color:#00007F">UBound</SPAN>(B)<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; C(Count) = (A(Count) / B(Count)) * 100<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<SPAN style="color:#00007F">Next</SPAN> Count<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<SPAN style="color:#007F00">'=AVERAGE(K49:K50)</SPAN><br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<SPAN style="color:#00007F">ReDim</SPAN> <SPAN style="color:#00007F">Preserve</SPAN> D(StochSetting + Ksetting <SPAN style="color:#00007F">To</SPAN> <SPAN style="color:#00007F">UBound</SPAN>(B))<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<SPAN style="color:#00007F">For</SPAN> Count = StochSetting + Ksetting <SPAN style="color:#00007F">To</SPAN> <SPAN style="color:#00007F">UBound</SPAN>(B)<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<SPAN style="color:#00007F">For</SPAN> Xcounter = Count - Ksetting + 1 <SPAN style="color:#00007F">To</SPAN> Count <SPAN style="color:#007F00">'just go back and get the first C and go forward to current</SPAN><br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Xavg = C(Xcounter) + Xavg<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<SPAN style="color:#00007F">Next</SPAN> Xcounter<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;D(Count) = Xavg / Ksetting<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Xavg = <SPAN style="color:#00007F">Empty</SPAN><br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<SPAN style="color:#00007F">Next</SPAN> Count<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<SPAN style="color:#00007F">ReDim</SPAN> <SPAN style="color:#00007F">Preserve</SPAN> E(StochSetting + Ksetting + Dsetting - 1 <SPAN style="color:#00007F">To</SPAN> <SPAN style="color:#00007F">UBound</SPAN>(B))<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<SPAN style="color:#00007F">For</SPAN> Count = StochSetting + Ksetting + Dsetting - 1 <SPAN style="color:#00007F">To</SPAN> <SPAN style="color:#00007F">UBound</SPAN>(B)<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<SPAN style="color:#00007F">For</SPAN> Zcounter = Count - Dsetting + 1 <SPAN style="color:#00007F">To</SPAN> Count <SPAN style="color:#007F00">'just go back and get the first C and go forward to current</SPAN><br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Zavg = D(Zcounter) + Zavg<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<SPAN style="color:#00007F">Next</SPAN> Zcounter<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;E(Count) = Zavg / Dsetting<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Zavg = <SPAN style="color:#00007F">Empty</SPAN><br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<SPAN style="color:#00007F">Next</SPAN> Count<br />&#160;&#160;x = Empty: y = Empty: z = Empty<br />&#160;&#160;x = <SPAN style="color:#00007F">LBound</SPAN>(E)<br />&#160;&#160;y = <SPAN style="color:#00007F">UBound</SPAN>(E)<br />&#160;&#160;<SPAN style="color:#007F00">'put the stochastics on the workbook. Change column Letter as needed</SPAN><br />&#160;&#160;.Cells(x - 1, "J") = "%D"<br />&#160;&#160;.Cells(x - 1, "I") = "%K"<br />&#160;&#160;<SPAN style="color:#00007F">For</SPAN> z = x <SPAN style="color:#00007F">To</SPAN> y<br />&#160;&#160;.Cells(z, "J") = E(z)<br />&#160;&#160;.Cells(z, "I") = D(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><br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<br /></FONT></p>
]]></content:encoded>
			<wfw:commentRss>http://exceltrader.net/506/stochastics-indicator-vba-and-formula-versions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<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 Divergence.]]></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>
]]></content:encoded>
			<wfw:commentRss>http://exceltrader.net/470/macd-vba/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Data Converter to Convert OHLC Data to a larger timeframe.</title>
		<link>http://exceltrader.net/414/data-converter-to-convert-ohlc-data-to-a-larger-timeframe/</link>
		<comments>http://exceltrader.net/414/data-converter-to-convert-ohlc-data-to-a-larger-timeframe/#comments</comments>
		<pubDate>Sun, 30 Aug 2009 22:39:56 +0000</pubDate>
		<dc:creator>ExcelTrader</dc:creator>
				<category><![CDATA[Automated trading Systems]]></category>
		<category><![CDATA[Backtesting]]></category>
		<category><![CDATA[Equities]]></category>
		<category><![CDATA[Excel as a Trading Platform]]></category>
		<category><![CDATA[S&P futures]]></category>
		<category><![CDATA[Data Conversion]]></category>
		<category><![CDATA[Excel]]></category>
		<category><![CDATA[Forex]]></category>
		<category><![CDATA[futures]]></category>
		<category><![CDATA[live data]]></category>
		<category><![CDATA[OHLC]]></category>
		<category><![CDATA[stocks]]></category>
		<category><![CDATA[timeframe]]></category>
		<category><![CDATA[trading]]></category>
		<category><![CDATA[vba]]></category>
		<category><![CDATA[xls]]></category>

		<guid isPermaLink="false">http://www.exceltrader.net/?p=410</guid>
		<description><![CDATA[If you have ever wanted to take your existing Open High Low Close historical trading data and convert it into larger time frame, the following Excel VBA based data converter I wrote may do the trick. DataConverter.xls allows you to configure the Number of OHLC bars that should be condensed down into a single bar. [...]]]></description>
			<content:encoded><![CDATA[<p>If you have ever wanted to take your existing Open High Low Close historical trading data and convert it into larger time frame, the following Excel VBA based data converter I wrote may do the trick.</p>
<p><a href="http://www.exceltrader.net/wp-content/uploads/DataConverter.GIF"><img class="alignnone size-full wp-image-411" title="DataConverter" src="http://www.exceltrader.net/wp-content/uploads/DataConverter.GIF" alt="DataConverter" width="592" height="349" /></a></p>
<p>DataConverter.xls allows you to configure the Number of OHLC bars that should be condensed down into a single bar. You also can list the file name, sheet, and columns where your data is located.  The data will almost instantly be transformed into the higher time frame you have requested.</p>
<p>Instructions:</p>
<ol>
<li>Download      <a href="/wp-content/uploads/DataConverter.xls">DataConverter.xls</a> (*last updated 1/1/2011)</li>
<li>Open      DataConverter.xls. (Quickstart!: Skip the directions below. Just Open file and press &#8220;Convert&#8221; to see how it works with default settings.</li>
<li>If      you have OHLC Data in a workbook, open that file (you can also just use      the default sample data that is contained on the sample data sheet in      DataConverter.xls)</li>
<li>Enter      the Column letter for each type of data (Time/date, Open, High, Low,      Close, Volume)</li>
<li>Enter the Name of the WorkBook and worksheet that contain the data. For example, to convert 1 Minute bars to 4 minute bars, simply enter 4. To convert 3 minute bars to 15 minute bars enter 5 (5*3=15) etc etc.</li>
<li>Finally press the &#8220;Convert&#8221; Button.  The converted data will appear in a new workbook. Save as desired.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://exceltrader.net/414/data-converter-to-convert-ohlc-data-to-a-larger-timeframe/feed/</wfw:commentRss>
		<slash:comments>27</slash:comments>
		</item>
		<item>
		<title>Added new file for Live trading with Interactive Brokers</title>
		<link>http://exceltrader.net/338/added-new-file-for-live-trading-with-interactive-brokers/</link>
		<comments>http://exceltrader.net/338/added-new-file-for-live-trading-with-interactive-brokers/#comments</comments>
		<pubDate>Thu, 14 May 2009 17:58:06 +0000</pubDate>
		<dc:creator>ExcelTrader</dc:creator>
				<category><![CDATA[Automated trading Systems]]></category>
		<category><![CDATA[Equities]]></category>
		<category><![CDATA[Excel Books]]></category>
		<category><![CDATA[S&P futures]]></category>
		<category><![CDATA[Video Posts]]></category>
		<category><![CDATA[Add new tag]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[automated trading]]></category>
		<category><![CDATA[dde]]></category>
		<category><![CDATA[Excel]]></category>
		<category><![CDATA[futures]]></category>
		<category><![CDATA[ib]]></category>
		<category><![CDATA[interactive brokers]]></category>
		<category><![CDATA[twsDde.xls]]></category>
		<category><![CDATA[vba]]></category>

		<guid isPermaLink="false">http://www.exceltrader.net/?p=338</guid>
		<description><![CDATA[In addition to the free files located under &#8220;Instructions and Downloads&#8221;, there is now a under &#8220;Products and Services&#8221; for live trading via Interactive Brokers. This Excel VBA based file is an all in one solution for testing, trading and charting. This is very similar to a version I have been using for my personal [...]]]></description>
			<content:encoded><![CDATA[<p>In addition to the free files located under &#8220;Instructions and Downloads&#8221;, there is now a <a href="http://exceltrader.net/atsxls-ib-automated-trading-charting-and-backtesting/">new file </a>under &#8220;Products and Services&#8221; for live trading via Interactive Brokers. This Excel VBA based file is an all in one solution for testing, trading and charting.</p>
<p>This is very similar to a version I have been using for my personal trading for years. However this is a much improved version so I am pretty excited to have it completed and am in the process of converting my personal system over to this version. I hope that others find if useful.</p>
<p>The Youtube video below shows both live trading mode and backtesting mode.</p>
<p style="text-align: center;">
<p>&nbsp;<br />
&nbsp;<br />
&nbsp;<br />
&nbsp;</p>
<p><object width="425" height="344" data="http://www.youtube.com/v/1_C44nTGwUg&amp;hl=en&amp;fs=1" type="application/x-shockwave-flash"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/1_C44nTGwUg&amp;hl=en&amp;fs=1" /><param name="allowfullscreen" value="true" /></object><br />
&nbsp;<br />
&nbsp;<br />
&nbsp;<br />
&nbsp;</p>
<p><a href="http://www.exceltrader.net/wp-content/uploads/atsdemotrade2.gif"><img class="alignnone size-full wp-image-343" title="atsdemotrade2" src="http://www.exceltrader.net/wp-content/uploads/atsdemotrade2.gif" alt="atsdemotrade2" width="572" height="780" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://exceltrader.net/338/added-new-file-for-live-trading-with-interactive-brokers/feed/</wfw:commentRss>
		<slash:comments>0</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[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; [...]]]></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>
]]></content:encoded>
			<wfw:commentRss>http://exceltrader.net/212/macd/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to post your ATS trades in twitter using Excel</title>
		<link>http://exceltrader.net/180/how-to-post-your-ats-trades-in-twitter-using-excel/</link>
		<comments>http://exceltrader.net/180/how-to-post-your-ats-trades-in-twitter-using-excel/#comments</comments>
		<pubDate>Tue, 14 Apr 2009 16:13:09 +0000</pubDate>
		<dc:creator>ExcelTrader</dc:creator>
				<category><![CDATA[Excel How to]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[Excel]]></category>
		<category><![CDATA[tweet]]></category>
		<category><![CDATA[twitter]]></category>
		<category><![CDATA[vba]]></category>
		<category><![CDATA[xls]]></category>

		<guid isPermaLink="false">http://www.exceltrader.net/?p=180</guid>
		<description><![CDATA[As an example, the following Excel script can be used to post your automated trading system trades into twitter via API.  This code can easily be changed to do whatever you want. But in this example it will just be for sending a trade. Sub TWITTER() Dim symbol As String Dim Price As String Dim [...]]]></description>
			<content:encoded><![CDATA[<p>As an example, the following Excel script can be used to post your automated trading system trades into twitter via API.  This code can easily be changed to do whatever you want. But in this example it will just be for sending a trade.</p>
<p style="padding-left: 30px;">Sub TWITTER()<br />
Dim symbol As String<br />
Dim Price As String<br />
Dim xml, Username, Password, tweet<br />
Set xml = CreateObject(&#8220;MSXML2.XMLHTTP&#8221;)<br />
<span style="color: #00ff00;">&#8216;<span style="color: #339966;">change this to your username in quotes</span></span><br />
Username = &#8220;yourusername&#8221;<br />
<span style="color: #339966;">&#8216;change this to your password in quotes</span><br />
Password = &#8220;yourpassword&#8221;<br />
<span style="color: #339966;">&#8216;let the symbol variable have the symbol name from your excel sheet</span><br />
symbol = Workbooks(&#8220;yourworkbook.xls&#8221;).Worksheets(&#8220;yoursheetname&#8221;).Range(&#8220;a1 or your range&#8221;)<br />
<span style="color: #339966;">&#8216;let the Price variable have the symbol name from your excel sheet</span><br />
Price = Workbooks(&#8220;yourworkbook.xls&#8221;).Worksheets(&#8220;yoursheetname&#8221;).Range(&#8220;a2 or your range&#8221;)<br />
<span style="color: #339966;">&#8216;contruct the &#8220;tweet&#8221; this would create &#8220;Just bought a gazillion shares of (whatever $SYMBOL you have in A1) @ (whatever price you have in A2)</span><br />
tweet = &#8220;Just bought a gazillion shares of &#8221; &amp; &#8220;$&#8221; &amp; symbol &amp; &#8221; @ &#8221; &amp; Price<br />
<span style="color: #339966;">&#8216;post the tweet</span><br />
xml.Open &#8220;POST&#8221;, &#8220;http://&#8221; &amp; Username &amp; &#8220;:&#8221; &amp; Password &amp; &#8220;@twitter.com/statuses/update.xml?status=&#8221; &amp; tweet, False<br />
xml.setRequestHeader &#8220;Content-Type&#8221;, &#8220;content=text/html; charset=iso-8859-1&#8243;<br />
xml.Send<br />
Set xml = Nothing<br />
End Sub</p>
<p>If added to an existing excel trading system it may be best to set this to run 20 seconds or so after your actual trade is sent to avoid any interference which can be done as follows</p>
<p>Application.Ontime Now() + timeserial(0, 0, 20), &#8220;TWITTER&#8221;</p>
<p style="padding-left: 60px;">
<p style="padding-left: 60px;">
]]></content:encoded>
			<wfw:commentRss>http://exceltrader.net/180/how-to-post-your-ats-trades-in-twitter-using-excel/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to add an indicator to Simulator.xls Chart (or any Excel Stock Chart).</title>
		<link>http://exceltrader.net/158/add-indicator-excel/</link>
		<comments>http://exceltrader.net/158/add-indicator-excel/#comments</comments>
		<pubDate>Fri, 10 Apr 2009 23:37:02 +0000</pubDate>
		<dc:creator>ExcelTrader</dc:creator>
				<category><![CDATA[Charts]]></category>
		<category><![CDATA[automated]]></category>
		<category><![CDATA[Automated trading Systems]]></category>
		<category><![CDATA[data series]]></category>
		<category><![CDATA[Excel How to: Indicators]]></category>
		<category><![CDATA[stock]]></category>
		<category><![CDATA[system]]></category>
		<category><![CDATA[trading]]></category>
		<category><![CDATA[vba]]></category>

		<guid isPermaLink="false">http://www.exceltrader.net/?p=158</guid>
		<description><![CDATA[If you have ever tried to add a simple moving average (or any data series) to a stock chart you may have noticed that after adding the series, the chart got all messed up! Here is a short tutorial and an example file showing how to add a simple moving average to a stock chart. [...]]]></description>
			<content:encoded><![CDATA[<p>If you have ever tried to add a simple moving average (or any data series) to a stock chart you may have noticed that after adding the series, the chart got all messed up!</p>
<p>Here is a short tutorial and an example file showing how to add a simple moving average to a stock chart. I am going to use the Simulator.xls as and example. It should be noted that all the unused columns on the BarData sheet (currently K-IV) of the simulator can be used to add indicators of your choice.</p>
<p>Trick number one. the =NA() trick</p>
<p>To plot a simple moving average (SMA), the formula is =AVERAGE(E132:E150)</p>
<p>So that would go in R150 on BarData Sheet.</p>
<p>There is a problem though. Excel will try to plot something when there is not enough data to average or even when there is an error. Here is an example of a chart we are trying to avoid.</p>
<p><a href="http://www.exceltrader.net/wp-content/uploads/ind11.jpg"><img class="aligncenter size-full wp-image-160" title="ind11" src="http://www.exceltrader.net/wp-content/uploads/ind11.jpg" alt="ind11" width="282" height="744" /></a></p>
<p>The keep the chart clean, I want to generate the error NA# whenever I do not want anything plotted.</p>
<p>so to keep things looking right, change the formula in R150 to =IF(ISBLANK(E132),NA(),AVERAGE(E132:E150))</p>
<p>which means:</p>
<p>&#8220;If there is not enough data for this simple moving average, then give me NA# (so excel does not plot anything) otherwise just calculate the average.&#8221;</p>
<p>Next just drag and copy this formula from R150 up to R19 (the first cell where it is possible to have enought data to calculate the average!)</p>
<p>Now all that is left is to add this moving average to the chart. It&#8217;s surprisingly tricky though.</p>
<p>1. Right click on the chart and select &#8220;source data&#8221;</p>
<p>the following screen comes up. Click on &#8220;add&#8221; and fill it in as follows. (make sure there are some numbers in column R)</p>
<p><a href="http://www.exceltrader.net/wp-content/uploads/ind2.jpg"><img class="aligncenter size-full wp-image-161" title="ind2" src="http://www.exceltrader.net/wp-content/uploads/ind2.jpg" alt="ind2" width="413" height="463" /></a></p>
<p>2. Select OK and take a look at the chart. Things should look funny on the chart now. Don&#8217;t worry about it, just find the data series &#8220;indicator&#8221;. It should be somewhere on the chart. In my case it plotted this price moving average on the secondary axis which is volume!</p>
<p>Hover your mouse around the volume series looking for &#8220;indicator&#8221;. Right click on the &#8220;indicator&#8221; series and <span style="font-weight: bold;">change it to primary</span> <span style="font-weight: bold;">axis</span> from secondary axis (which will be hidden somewhere down in the volume bars if it&#8217;s on the secondary axis. It can be hard to find/click on, if it is you may want to zoom in)</p>
<p><a href="http://www.exceltrader.net/wp-content/uploads/ind31.jpg"><img class="aligncenter size-full wp-image-163" title="ind31" src="http://www.exceltrader.net/wp-content/uploads/ind31.jpg" alt="ind31" width="461" height="406" /></a></p>
<p>Now &#8220;indicator&#8221; should be plotted up there with price, but now the price chart will be all messed up!!!!!! (see how the first bar is missing parts!)</p>
<p><a href="http://www.exceltrader.net/wp-content/uploads/ind4.jpg"><img class="aligncenter size-full wp-image-164" title="ind4" src="http://www.exceltrader.net/wp-content/uploads/ind4.jpg" alt="ind4" width="198" height="222" /></a></p>
<p>Next you once again need to hover your mouse around the price series looking for &#8220;indicator&#8221; when indicator is visible, right click on it and select &#8220;chart type&#8221;.</p>
<p>The following screen comes up and just select XY (Scatter) as shown and press OK.</p>
<p><a href="http://www.exceltrader.net/wp-content/uploads/ind5.jpg"><img class="aligncenter size-full wp-image-165" title="ind5" src="http://www.exceltrader.net/wp-content/uploads/ind5.jpg" alt="ind5" width="535" height="412" /></a></p>
<p>Now the chart will look normal again.</p>
<p><a href="http://www.exceltrader.net/wp-content/uploads/ind6.jpg"><img class="aligncenter size-full wp-image-166" title="ind6" src="http://www.exceltrader.net/wp-content/uploads/ind6.jpg" alt="ind6" width="193" height="173" /></a></p>
<p>The last step is to properly format this scatter chart to look like a line. For the last time find the &#8220;indicator&#8221; series on the chart and right click on it. This time select &#8220;format data series&#8221; and set it as follows.<a href="http://www.exceltrader.net/wp-content/uploads/ind7.jpg"><img class="aligncenter size-full wp-image-167" title="ind7" src="http://www.exceltrader.net/wp-content/uploads/ind7.jpg" alt="ind7" width="605" height="414" /></a></p>
<p>Select &#8220;OK&#8221; and the resulting indicator should like like this.</p>
<p><a href="http://www.exceltrader.net/wp-content/uploads/ind8.jpg"><img class="aligncenter size-full wp-image-168" title="ind8" src="http://www.exceltrader.net/wp-content/uploads/ind8.jpg" alt="ind8" width="378" height="911" /></a></p>
<p>One final tip.</p>
<p>Use google! If you are wanting to add a <a href="http://exceltrader.net/506/stochastics-indicator-vba-and-formula-versions/">stochastic</a> indicator for example, but don&#8217;t know how to calculate it. Try the following search:</p>
<p>stochastic filetype:xls</p>
<p>This will return tons of Excel files described with the word stochastic. There is a good chance that you will find a nice example there. If you have no luck, next you should search investopedia.com, which often explains the calculations.</p>
]]></content:encoded>
			<wfw:commentRss>http://exceltrader.net/158/add-indicator-excel/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Excel Books I recommend</title>
		<link>http://exceltrader.net/137/excel-books-i-recommend/</link>
		<comments>http://exceltrader.net/137/excel-books-i-recommend/#comments</comments>
		<pubDate>Fri, 10 Apr 2009 13:59:24 +0000</pubDate>
		<dc:creator>ExcelTrader</dc:creator>
				<category><![CDATA[Excel Books]]></category>
		<category><![CDATA[Charts]]></category>
		<category><![CDATA[Excel]]></category>
		<category><![CDATA[live data]]></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=137</guid>
		<description><![CDATA[Best Beginner books 1. Excel 2007 Bible - It is important to have one book that just covers excel (not Visual Basic and Macros) so that you don&#8217;t unnecessarily use VBA for performing calculations better handled by formulas. The channels and trend lines in my videos of sim trading the ES are formula based not [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Best Beginner books</strong></p>
<p>1. <strong><a href="http://www.amazon.com/gp/product/0470044039/104-2137911-5800709?ie=UTF8&amp;tag=switrablo-20&amp;linkCode=xm2&amp;camp=1789&amp;creativeASIN=0470044039">Excel 2007 Bible</a> </strong>- It is important to have one book that just covers excel (not Visual Basic and Macros) so that you don&#8217;t unnecessarily use VBA for performing calculations better handled by formulas. The channels and trend lines in my <a href="http://www.youtube.com/blog89654328">videos</a> of sim trading the ES are formula based not VBA based like most people seem to think. I probably could not have figured it all out without this book.</p>
<p>2. <strong><a href="http://www.amazon.com/gp/product/0470046740/104-2137911-5800709?ie=UTF8&amp;tag=switrablo-20&amp;linkCode=xm2&amp;camp=1789&amp;creativeASIN=0470046740">Excel 2007 VBA Programming For Dummies</a></strong></p>
<p>3. <strong><a href="http://www.amazon.com/gp/product/1840782714/104-2137911-5800709?ie=UTF8&amp;tag=switrablo-20&amp;linkCode=xm2&amp;camp=1789&amp;creativeASIN=1840782714">Excel VBA in easy steps</a></strong> by Ed Robinson &#8211; By far the best beginner book but often out of stock. It&#8217;s only 188 pages but covers a lot of material in a very clear and concise manner. The examples are easy to understand even with no prior programming experience. If you have no prior VBA experience this is a great first book. Barnes and Noble is the publisher. The price on the cover is 9.95, but since it is out of print people are currently selling it used for $50 to $100 :(</p>
<p>4. <strong><a href="http://www.amazon.com/gp/product/0072231440/104-2137911-5800709?ie=UTF8&amp;tag=switrablo-20&amp;linkCode=xm2&amp;camp=1789&amp;creativeASIN=0072231440">Excel VBA Macro Programming</a><em> </em></strong>- If Excel VBA in easy steps is out of stock, this may be a good alternative judging from the reviews. I have not personally used this one though.</p>
<p><strong>Best Intermediate and Advanced books</strong></p>
<p>1. <strong><a href="http://www.amazon.com/gp/product/0596528345/104-2137911-5800709?ie=UTF8&amp;tag=switrablo-20&amp;linkCode=xm2&amp;camp=1789&amp;creativeASIN=0596528345">Excel Hacks</a> </strong>is filled with original content and examples. I have a lot of Excel books and thought I knew about pretty much everything until I bought this book.</p>
<p>2. <strong><a href="http://www.amazon.com/gp/product/0470046430/104-2137911-5800709?ie=UTF8&amp;tag=switrablo-20&amp;linkCode=xm2&amp;camp=1789&amp;creativeASIN=0470046430">Excel 2007 VBA Programmer&#8217;s Reference</a> </strong>This enormous book should be used for reference. It has a great index so you don&#8217;t have to waste time trying to figure out how to do some simple task. If you have used my earnings.xls workbook that automatically downloads stock&#8217;s earnings dates, then you have already benefited from this book. I used an example from the 2003 version of this book to learn from!</p>
<p><strong></strong></p>
<p>*Be careful about buying multiple books by the same author because there is a lot of repetition and they often put out practically the same book but with a different co author, book name and Cover!</p>
]]></content:encoded>
			<wfw:commentRss>http://exceltrader.net/137/excel-books-i-recommend/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

