<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" gd:etag="W/&quot;AkUCRXk9fyp7ImA9WxBUGUQ.&quot;"><id>tag:blogger.com,1999:blog-5815834906618132494</id><updated>2010-03-07T15:44:24.767-06:00</updated><title>FOSS Trading</title><subtitle type="html">Algorithmic Trading with Free Open Source Software</subtitle><link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://blog.fosstrading.com/feeds/posts/default" /><link rel="alternate" type="text/html" href="http://blog.fosstrading.com/" /><link rel="hub" href="http://pubsubhubbub.appspot.com/" /><author><name>Joshua Ulrich</name><uri>http://www.blogger.com/profile/16641971932645230429</uri><email>noreply@blogger.com</email></author><generator version="7.00" uri="http://www.blogger.com">Blogger</generator><openSearch:totalResults>22</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/FossTrading" /><feedburner:info uri="fosstrading" /><entry gd:etag="W/&quot;DEcMQ3c9eyp7ImA9WxBWFUU.&quot;"><id>tag:blogger.com,1999:blog-5815834906618132494.post-2858383843068689086</id><published>2010-02-06T22:35:00.002-06:00</published><updated>2010-02-07T17:41:22.963-06:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-02-07T17:41:22.963-06:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="blotter" /><title>Updated Tactical Asset Allocation Results</title><content type="html">In November, I used the strategy in &lt;a href="http://www.mebanefaber.com/"&gt;Mebane Faber's&lt;/a&gt; Tactical Asset Allocation &lt;a href="http://ssrn.com/abstract=962461"&gt;paper&lt;/a&gt; to provide an &lt;a href="http://blog.fosstrading.com/2009/11/tactical-asset-allocation-using-blotter.html"&gt;introduction to blotter&lt;/a&gt;.  Faber has &lt;a href="http://www.mebanefaber.com/2010/02/05/quant-approach-to-taa-updated-for-2009/"&gt;updated the strategy's results&lt;/a&gt; through the end of 2009.  For those interested, he expands on the paper in his book, &lt;a href="http://www.amazon.com/gp/product/0470284897?ie=UTF8&amp;amp;tag=fotr09-20&amp;amp;linkCode=as2&amp;amp;camp=1789&amp;amp;creative=390957&amp;amp;creativeASIN=0470284897"&gt;The Ivy Portfolio&lt;/a&gt;.&lt;img alt="" border="0" class=" ictkgnejbcfjmjqmuoso ictkgnejbcfjmjqmuoso ictkgnejbcfjmjqmuoso xuhhwslqeyucatarpgdu xuhhwslqeyucatarpgdu xuhhwslqeyucatarpgdu xuhhwslqeyucatarpgdu" height="1" src="http://www.assoc-amazon.com/e/ir?t=fotr09-20&amp;amp;l=as2&amp;amp;o=1&amp;amp;a=0470284897" style="border: medium none ! important; margin: 0px ! important;" width="1" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5815834906618132494-2858383843068689086?l=blog.fosstrading.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/3uFPdl9RYVPCATeggnWtlKIbh60/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/3uFPdl9RYVPCATeggnWtlKIbh60/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/3uFPdl9RYVPCATeggnWtlKIbh60/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/3uFPdl9RYVPCATeggnWtlKIbh60/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/FossTrading?a=dacClTr9x3E:AA05N8XpOi8:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FossTrading?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FossTrading?a=dacClTr9x3E:AA05N8XpOi8:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FossTrading?i=dacClTr9x3E:AA05N8XpOi8:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FossTrading?a=dacClTr9x3E:AA05N8XpOi8:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FossTrading?i=dacClTr9x3E:AA05N8XpOi8:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FossTrading?a=dacClTr9x3E:AA05N8XpOi8:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FossTrading?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FossTrading?a=dacClTr9x3E:AA05N8XpOi8:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FossTrading?i=dacClTr9x3E:AA05N8XpOi8:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/FossTrading/~4/dacClTr9x3E" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.fosstrading.com/feeds/2858383843068689086/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=5815834906618132494&amp;postID=2858383843068689086" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5815834906618132494/posts/default/2858383843068689086?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5815834906618132494/posts/default/2858383843068689086?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/FossTrading/~3/dacClTr9x3E/updated-tactical-asset-allocation.html" title="Updated Tactical Asset Allocation Results" /><author><name>Joshua Ulrich</name><uri>http://www.blogger.com/profile/16641971932645230429</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="12731449228814218421" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://blog.fosstrading.com/2010/02/updated-tactical-asset-allocation.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C0UBRXoyfSp7ImA9WxBWFE8.&quot;"><id>tag:blogger.com,1999:blog-5815834906618132494.post-6784699773940885117</id><published>2010-02-05T15:46:00.001-06:00</published><updated>2010-02-05T19:54:14.495-06:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-02-05T19:54:14.495-06:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Events" /><title>R/Finance 2010: Registration Open</title><content type="html">As posted by Dirk Eddelbuettel on R-SIG-Finance:&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;R / Finance 2010: Applied Finance with R&lt;br /&gt;
April 16 &amp;amp; 17, Chicago, IL, US&lt;br /&gt;
&lt;br /&gt;
The second annual R / Finance conference for applied finance using R, the premier free software system for statistical computation and graphics, will be held this spring in Chicago, IL, USA on Friday April 16 and Saturday April 17.&lt;br /&gt;
&lt;br /&gt;
Building on the success of the inaugural R / Finance 2009 event, this two-day conference will cover topics as diverse as portfolio theory, time-series analysis, as well as advanced risk tools, high-performance computing, and econometrics. All will be discussed within the context of using R as a primary tool for financial risk management and trading.&lt;br /&gt;
&lt;br /&gt;
Invited keynote presentations by Bernhard Pfaff, Ralph Vince, Mark Wildi and Achim Zeileis are complemented by over twenty talks (both full-length and 'lightning') selected from the submissions.&amp;nbsp; Four optional tutorials are also offered on Friday April 16.&lt;br /&gt;
&lt;br /&gt;
R / Finance 2010 is organized by a local group of R package authors and community contributors, and hosted by the International Center for Futures and Derivatives [ICFD] at the University of Illinois at Chicago.&lt;br /&gt;
&lt;br /&gt;
Conference registration is now open. Special advanced registration pricing is available, as well as discounted pricing for academic and student registrations.&lt;br /&gt;
&lt;br /&gt;
More details and registration information can be found at the website at&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;a href="http://www.rinfinance.com/"&gt;http://www.RinFinance.com&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
For the program committee:&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; Gib Bassett, Peter Carl, Dirk Eddelbuettel, John Miller,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; Brian Peterson, Dale Rosenthal, Jeffrey Ryan&lt;/blockquote&gt;&lt;br /&gt;
I hope to meet some of you there!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5815834906618132494-6784699773940885117?l=blog.fosstrading.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/jGmavSWDqjpEJT8ymeyxd6ATr4Y/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/jGmavSWDqjpEJT8ymeyxd6ATr4Y/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/jGmavSWDqjpEJT8ymeyxd6ATr4Y/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/jGmavSWDqjpEJT8ymeyxd6ATr4Y/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/FossTrading?a=szccrfIRBgA:-Yo8pM0RSxs:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FossTrading?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FossTrading?a=szccrfIRBgA:-Yo8pM0RSxs:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FossTrading?i=szccrfIRBgA:-Yo8pM0RSxs:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FossTrading?a=szccrfIRBgA:-Yo8pM0RSxs:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FossTrading?i=szccrfIRBgA:-Yo8pM0RSxs:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FossTrading?a=szccrfIRBgA:-Yo8pM0RSxs:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FossTrading?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FossTrading?a=szccrfIRBgA:-Yo8pM0RSxs:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FossTrading?i=szccrfIRBgA:-Yo8pM0RSxs:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/FossTrading/~4/szccrfIRBgA" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.fosstrading.com/feeds/6784699773940885117/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=5815834906618132494&amp;postID=6784699773940885117" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5815834906618132494/posts/default/6784699773940885117?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5815834906618132494/posts/default/6784699773940885117?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/FossTrading/~3/szccrfIRBgA/rfinance-2010-registration-open.html" title="R/Finance 2010: Registration Open" /><author><name>Joshua Ulrich</name><uri>http://www.blogger.com/profile/16641971932645230429</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="12731449228814218421" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://blog.fosstrading.com/2010/02/rfinance-2010-registration-open.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEIHSHo_eyp7ImA9WxBQEUo.&quot;"><id>tag:blogger.com,1999:blog-5815834906618132494.post-1477228546344728693</id><published>2010-01-10T17:01:00.003-06:00</published><updated>2010-01-10T19:15:39.443-06:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-01-10T19:15:39.443-06:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="LSPM" /><category scheme="http://www.blogger.com/atom/ns#" term="Examples" /><title>LSPM with snow</title><content type="html">My &lt;a href="http://blog.fosstrading.com/2010/01/lspm-examples.html"&gt;last post&lt;/a&gt; provided examples of how to use the &lt;a href="http://r-forge.r-project.org/projects/lspm"&gt;LSPM package&lt;/a&gt;.  Those who experimented with the code have probably found that constrained optimizations with horizons &gt; 6 have long run-times (when calc.max &gt;= horizon).&lt;br /&gt;&lt;br /&gt;This post will illustrate how the &lt;a href="http://cran.r-project.org/web/packages/snow/"&gt;snow&lt;/a&gt; package can increase the speed of the probDrawdown and probRuin functions on computers with multiple cores.  This yields &lt;span style="font-style: italic;"&gt;nearly&lt;/span&gt; linear improvements in run-times relative to the number of cores.  (Improvements are &lt;span style="font-style: italic;"&gt;nearly&lt;/span&gt; linear because there is overhead in setting up the cluster and communication between the nodes.)&lt;br /&gt;&lt;br /&gt;The first optimization takes 346 seconds on my 2.2Ghz Centrino, while the second optimization (with snow) takes 193 seconds... nearly a 45% improvement.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new;font-size:85%;" &gt;# Load the libraries&lt;br /&gt;library(LSPM)&lt;br /&gt;library(snow)&lt;br /&gt;&lt;br /&gt;# Create a Leverage Space Portfolio object&lt;br /&gt;trades &lt;- cbind(&lt;br /&gt; c(-150,-45.33,-45.33,rep(13,5),rep(79.67,3),136),&lt;br /&gt; c(253,-1000,rep(-64.43,3),253,253,448,rep(-64.43,3),253),&lt;br /&gt; c(533,220.14,220.14,-500,533,220.14,799,220.14,-325,220.14,533,220.14) )&lt;br /&gt;probs &lt;- c(rep(0.076923077,2),0.153846154,rep(0.076923077,9))&lt;br /&gt;port &lt;- lsp(trades,probs)&lt;br /&gt;&lt;br /&gt;# Optimization using one CPU core&lt;br /&gt;system.time({&lt;br /&gt;res1 &lt;- optimalf(port,probDrawdown,0.1,DD=0.2,horizon=5,control=list(NP=30,itermax=100))&lt;br /&gt;})&lt;br /&gt;&lt;br /&gt;# Create snow socket cluster for both cores&lt;br /&gt;clust &lt;- makeSOCKcluster(2)&lt;br /&gt;&lt;br /&gt;# Optimization using both CPU cores&lt;br /&gt;system.time({&lt;br /&gt;res2 &lt;- optimalf(port,probDrawdown,0.1,DD=0.2,horizon=5,snow=clust,control=list(NP=30,itermax=100))&lt;br /&gt;})&lt;br /&gt;&lt;br /&gt;# Stop snow cluster&lt;br /&gt;stopCluster(clust)&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5815834906618132494-1477228546344728693?l=blog.fosstrading.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/dOmhCuORAYFe9xEky68OJY4BtTU/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/dOmhCuORAYFe9xEky68OJY4BtTU/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/dOmhCuORAYFe9xEky68OJY4BtTU/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/dOmhCuORAYFe9xEky68OJY4BtTU/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/FossTrading?a=i8WzCVmHVK4:xXgMWdy_0xs:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FossTrading?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FossTrading?a=i8WzCVmHVK4:xXgMWdy_0xs:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FossTrading?i=i8WzCVmHVK4:xXgMWdy_0xs:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FossTrading?a=i8WzCVmHVK4:xXgMWdy_0xs:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FossTrading?i=i8WzCVmHVK4:xXgMWdy_0xs:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FossTrading?a=i8WzCVmHVK4:xXgMWdy_0xs:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FossTrading?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FossTrading?a=i8WzCVmHVK4:xXgMWdy_0xs:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FossTrading?i=i8WzCVmHVK4:xXgMWdy_0xs:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/FossTrading/~4/i8WzCVmHVK4" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.fosstrading.com/feeds/1477228546344728693/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=5815834906618132494&amp;postID=1477228546344728693" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5815834906618132494/posts/default/1477228546344728693?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5815834906618132494/posts/default/1477228546344728693?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/FossTrading/~3/i8WzCVmHVK4/lspm-with-snow.html" title="LSPM with snow" /><author><name>Joshua Ulrich</name><uri>http://www.blogger.com/profile/16641971932645230429</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="12731449228814218421" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://blog.fosstrading.com/2010/01/lspm-with-snow.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0EEQXw_eCp7ImA9WxBRFkk.&quot;"><id>tag:blogger.com,1999:blog-5815834906618132494.post-7146931820585067167</id><published>2010-01-02T15:35:00.001-06:00</published><updated>2010-01-04T18:00:00.240-06:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-01-04T18:00:00.240-06:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="LSPM" /><category scheme="http://www.blogger.com/atom/ns#" term="Examples" /><title>LSPM Examples</title><content type="html">I have received several requests for additional &lt;a href="https://r-forge.r-project.org/projects/lspm"&gt;LSPM&lt;/a&gt; documentation over the past couple days and a couple months ago &lt;a href="http://blog.fosstrading.com/2009/09/update.html"&gt;I promised an introduction&lt;/a&gt; to LSPM.&lt;br /&gt;
&lt;br /&gt;
In this long-overdue post, I will show how to optimize a Leverage Space Portfolio with the LSPM package.&amp;nbsp; Please use the comments to let me know what you would like to see next.&lt;br /&gt;
&lt;br /&gt;
Some copious notes  before we get to the code:&lt;br /&gt;
&lt;br /&gt;
These examples are based on revision &lt;strike&gt;26&lt;/strike&gt; 31 from r-forge and &lt;u&gt;will not work under earlier revisions&lt;/u&gt; (and may not work with later revisions). LSPM is still in &lt;b&gt;very&lt;/b&gt; alpha status.&amp;nbsp; Expect things to change, perhaps significantly.&lt;br /&gt;
&lt;br /&gt;
These examples were run using &lt;strike&gt;&lt;a href="http://cran.r-project.org/src/contrib/Archive/DEoptim/DEoptim_1.3-3.tar.gz"&gt;DEoptim_1.3-3&lt;/a&gt; (and LSPM revision 26 depends on that version)&lt;/strike&gt; code from DEoptim_1.3-3 that has been bundled inside LSPM.&amp;nbsp; We are working with the DEoptim authors to address issues with more recent versions of DEoptim.&amp;nbsp; LSPM will un-bundle and use the most recent version of DEoptim as soon as the issues are resolved.&lt;br /&gt;
&lt;br /&gt;
The first two examples are taken from &lt;a href="http://www.amazon.com/gp/product/0470455950?ie=UTF8&amp;amp;tag=fotr09-20&amp;amp;linkCode=as2&amp;amp;camp=1789&amp;amp;creative=9325&amp;amp;creativeASIN=0470455950"&gt;Vince, Ralph (2009). The Leverage Space Trading Model. New York: John Wiley &amp;amp; Sons, Inc.&lt;/a&gt;&lt;img alt="" border="0" class=" kkhzmhumvwvpsurumhgy kkhzmhumvwvpsurumhgy kkhzmhumvwvpsurumhgy kkhzmhumvwvpsurumhgy poswuubwwoyhqgxqrjtw poswuubwwoyhqgxqrjtw poswuubwwoyhqgxqrjtw poswuubwwoyhqgxqrjtw" height="1" src="http://www.assoc-amazon.com/e/ir?t=fotr09-20&amp;amp;l=as2&amp;amp;o=1&amp;amp;a=0470455950" style="border: medium none ! important; margin: 0px ! important;" width="1" /&gt;  The results will not match the book because of differences between optimization via DEoptim and Ralph's genetic algorithm implementation.&amp;nbsp; Ralph believes his genetic algorithm is getting hung up on a local maximum, whereas DEoptim is closer to the global solution.&lt;br /&gt;
&lt;ol&gt;&lt;/ol&gt;&lt;br /&gt;
&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: x-small;"&gt;# Load the LSPM package&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: x-small;"&gt;library(LSPM)&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-size: x-small;"&gt;# Multiple strategy example (data found on pp. 84-87)&lt;br /&gt;
trades &amp;lt;- cbind(&lt;br /&gt;
&amp;nbsp;c(-150,-45.33,-45.33,rep(13,5),rep(79.67,3),136),&lt;br /&gt;
&amp;nbsp;c(253,-1000,rep(-64.43,3),253,253,448,rep(-64.43,3),253),&lt;br /&gt;
&amp;nbsp;c(533,220.14,220.14,-500,533,220.14,799,220.14,-325,220.14,533,220.14) )&lt;br /&gt;
probs &lt;/span&gt;&lt;span style="font-size: x-small;"&gt;&amp;lt;-&lt;/span&gt;&lt;span style="font-size: x-small;"&gt; c(rep(0.076923077,2),0.153846154,rep(0.076923077,9))&lt;br /&gt;
&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: x-small;"&gt;# Create a Leverage Space Portfolio object&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: x-small;"&gt;port &lt;/span&gt;&lt;span style="font-size: x-small;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size: x-small;"&gt;- lsp(trades,probs)&lt;br /&gt;
&lt;br /&gt;
# DEoptim parameters (see ?DEoptim)&lt;br /&gt;
# NP=30&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (10 * number of strategies)&lt;br /&gt;
# itermax=100&amp;nbsp; (maximum number of iterations)&lt;br /&gt;
DEctrl &lt;/span&gt;&lt;span style="font-size: x-small;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size: x-small;"&gt;- list(NP=30,itermax=100)&lt;br /&gt;
&lt;br /&gt;
# Unconstrainted Optimal f (results on p. 87)&lt;br /&gt;
res &lt;/span&gt;&lt;span style="font-size: x-small;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size: x-small;"&gt;- optimalf(port,control=DEctrl)&lt;br /&gt;
&lt;br /&gt;
&lt;/span&gt;&lt;span style="font-size: x-small;"&gt;# Drawdown-constrained Optimal f (results on p. 137)&lt;br /&gt;
# Since horizon=12, this optimization will take about an hour&lt;br /&gt;
res &lt;/span&gt;&lt;span style="font-size: x-small;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;"&gt;- optimalf(port,probDrawdown,0.1,DD=0.2,horizon=12,calc.max=4,control=DEctrl)&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;"&gt;# Ruin-constrained Optimal f&lt;br /&gt;
res &lt;/span&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;"&gt;- optimalf(port,probRuin,0.1,DD=0.2,horizon=4,control=DEctrl)&lt;br /&gt;
&lt;br /&gt;
# Drawdown-constrained Optimal f&lt;br /&gt;
res &lt;/span&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;"&gt;- optimalf(port,probDrawdown,0.1,DD=0.2,horizon=4,control=DEctrl)&lt;/span&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5815834906618132494-7146931820585067167?l=blog.fosstrading.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/B_WJPKsnlFMwHsY3EUsa8Tajjbs/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/B_WJPKsnlFMwHsY3EUsa8Tajjbs/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/B_WJPKsnlFMwHsY3EUsa8Tajjbs/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/B_WJPKsnlFMwHsY3EUsa8Tajjbs/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/FossTrading?a=G3yp4d91jF8:HYzQ5tZa9nI:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FossTrading?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FossTrading?a=G3yp4d91jF8:HYzQ5tZa9nI:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FossTrading?i=G3yp4d91jF8:HYzQ5tZa9nI:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FossTrading?a=G3yp4d91jF8:HYzQ5tZa9nI:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FossTrading?i=G3yp4d91jF8:HYzQ5tZa9nI:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FossTrading?a=G3yp4d91jF8:HYzQ5tZa9nI:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FossTrading?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FossTrading?a=G3yp4d91jF8:HYzQ5tZa9nI:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FossTrading?i=G3yp4d91jF8:HYzQ5tZa9nI:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/FossTrading/~4/G3yp4d91jF8" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.fosstrading.com/feeds/7146931820585067167/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=5815834906618132494&amp;postID=7146931820585067167" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5815834906618132494/posts/default/7146931820585067167?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5815834906618132494/posts/default/7146931820585067167?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/FossTrading/~3/G3yp4d91jF8/lspm-examples.html" title="LSPM Examples" /><author><name>Joshua Ulrich</name><uri>http://www.blogger.com/profile/16641971932645230429</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="12731449228814218421" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://blog.fosstrading.com/2010/01/lspm-examples.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkUERXo7eCp7ImA9WxBUGUQ.&quot;"><id>tag:blogger.com,1999:blog-5815834906618132494.post-8332842223445511674</id><published>2009-11-18T21:18:00.014-06:00</published><updated>2010-03-07T15:43:24.400-06:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-03-07T15:43:24.400-06:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="blotter" /><category scheme="http://www.blogger.com/atom/ns#" term="Code" /><title>Tactical asset allocation using blotter</title><content type="html">&lt;a href="https://r-forge.r-project.org/projects/blotter"&gt;blotter&lt;/a&gt; is an &lt;a href="http://www.r-project.org/"&gt;R&lt;/a&gt; package that tracks the P&amp;amp;L of your trading systems (or simulations), even if your portfolio spans many security types and/or currencies.  This post uses blotter to track a simple two-ETF trading system.&lt;br /&gt;
&lt;br /&gt;
The contents of this post borrow heavily from code and comments in the "longtrend" demo script in the blotter package.  Many thanks to &lt;a href="http://www.braverock.com/%7Epeter/"&gt;Peter Carl&lt;/a&gt; and &lt;a href="http://www.braverock.com/%7Ebrian/"&gt;Brian Peterson&lt;/a&gt; for their hard work.&lt;br /&gt;
&lt;br /&gt;
The first chart shows the result of holding an equal-weight portfolio of &lt;a href="http://finance.yahoo.com/q?s=SPY"&gt;SPY&lt;/a&gt; and &lt;a href="http://finance.yahoo.com/q?s=IEF"&gt;IEF&lt;/a&gt; from 2002-07-31 to 2009-10-31.  The 2008 bear market led to a 30% drawdown in this portfolio.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_8iehP8a8rkE/SwS1neN40tI/AAAAAAAAAGo/W-lzFP5B2XM/s1600/20091118_blotter_buyhold.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="400" src="http://3.bp.blogspot.com/_8iehP8a8rkE/SwS1neN40tI/AAAAAAAAAGo/W-lzFP5B2XM/s400/20091118_blotter_buyhold.png" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
The second chart shows the result of following &lt;a href="http://www.mebanefaber.com/"&gt;Mebane Faber's&lt;/a&gt; tactical asset allocation approach using the same ETFs and time period.  Though it did not perform as well as buy-and-hold through 2007, the 2008 bear market only caused a 5% drawdown for this strategy.  Both observations are consistent with the conclusion in &lt;a href="http://ssrn.com/abstract=962461"&gt;Faber's article&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_8iehP8a8rkE/SwS1nZjIZ8I/AAAAAAAAAGs/zZauBNcllvg/s1600/20091118_blotter_strategy.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="400" src="http://1.bp.blogspot.com/_8iehP8a8rkE/SwS1nZjIZ8I/AAAAAAAAAGs/zZauBNcllvg/s400/20091118_blotter_strategy.png" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
Without further ado, here's the code:&lt;br /&gt;
&lt;br /&gt;
&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: x-small;"&gt;# This code implements the strategy found in:&lt;br /&gt;
# Faber, Mebane T., "A Quantitative Approach to Tactical Asset Allocation."&lt;br /&gt;
# Journal of Risk Management (Spring 2007).&lt;br /&gt;
&lt;br /&gt;
# The article implements a simpler version of the 200-day SMA, opting for a&lt;br /&gt;
# 10-month SMA because monthly data are more easily available in earlier&lt;br /&gt;
# periods and lower granularity should translate to lower transaction costs.&lt;br /&gt;
&lt;br /&gt;
# The rules of the system are relatively simple:&lt;br /&gt;
# - Buy when monthly price &amp;gt; 10-month SMA&lt;br /&gt;
# - Sell and move to cash when monthly price &amp;lt; 10-month SMA&lt;br /&gt;
&lt;br /&gt;
# 1. All entry and exit prices are on the day of the signal at the close.&lt;br /&gt;
# 2. All data series are total return series including dividends, updated monthly.&lt;br /&gt;
#    NOTE: For the purposes of this demo, we only use price returns.&lt;br /&gt;
# 3. Cash returns are estimated with 90-day commercial paper.  Margin rates for&lt;br /&gt;
#    leveraged models are estimated with the broker call rate.&lt;br /&gt;
#    NOTE: For the purposes of this demo, we ignore interest and leverage.&lt;br /&gt;
# 4. Taxes, commissions, and slippage are excluded.&lt;br /&gt;
&lt;br /&gt;
# Data:&lt;br /&gt;
# This demo uses monthly data downloaded from Yahoo Finance for two ETFs: SPY and&lt;br /&gt;
# IEF.  These were chosen to illustrate the classic stock/bond asset portfolio.&lt;br /&gt;
# Though longer serires would be preferred, data for IEF begin in mid-2002.&lt;br /&gt;
&lt;br /&gt;
# Load required libraries&lt;br /&gt;
library(quantmod)&lt;br /&gt;
library(TTR)&lt;br /&gt;
library(blotter) # r-forge revision 193&lt;br /&gt;
library(PerformanceAnalytics)&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: x-small;"&gt;&lt;br /&gt;
# Set initial values&lt;br /&gt;
initDate='2002-07-31'&lt;br /&gt;
endDate='2009-10-31'&lt;br /&gt;
initEq=100000&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: x-small;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: x-small;"&gt;# Set currency and instruments&lt;br /&gt;
currency("USD")&lt;br /&gt;
stock("IEF",currency="USD",multiplier=1)&lt;br /&gt;
stock("SPY",currency="USD",multiplier=1)&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: x-small;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: x-small;"&gt;# Load data with quantmod&lt;br /&gt;
print("Loading data")&lt;br /&gt;
symbols = c("IEF", "SPY")&lt;br /&gt;
getSymbols(symbols, from=initDate, to=endDate, index.class=c("POSIXt","POSIXct"))&lt;br /&gt;
&lt;br /&gt;
# Adjust prices for splits/dividends (thanks pg)&lt;br /&gt;
#IEF = adjustOHLC(IEF)&lt;br /&gt;
&lt;/span&gt;&lt;span style="font-size: x-small;"&gt;#SPY = adjustOHLC(&lt;/span&gt;&lt;span style="font-size: x-small;"&gt;SPY&lt;/span&gt;&lt;span style="font-size: x-small;"&gt;)&lt;br /&gt;
&lt;br /&gt;
&lt;/span&gt;&lt;span style="font-size: x-small;"&gt;# Convert data to monthly frequency (to.weekly() needs drop.time=FALSE)&lt;br /&gt;
IEF = to.monthly(IEF, indexAt='endof')&lt;br /&gt;
SPY = to.monthly(SPY, indexAt='endof')&lt;br /&gt;
&lt;/span&gt;&lt;span style="font-size: x-small;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span style="font-size: x-small;"&gt;# Set up indicators with TTR&lt;br /&gt;
print("Setting up indicators")&lt;br /&gt;
IEF$SMA = SMA(Cl(IEF), 10)&lt;br /&gt;
SPY$SMA = SMA(Cl(SPY), 10)&lt;br /&gt;
&lt;br /&gt;
# Set up a portfolio object and an account object in blotter&lt;br /&gt;
initPortf(name='default', symbols=symbols, initDate=initDate)&lt;br /&gt;
initAcct(name='default', portfolios='default', initDate=initDate, initEq=initEq)&lt;br /&gt;
verbose = TRUE&lt;br /&gt;
&lt;br /&gt;
# Create trades&lt;br /&gt;
for( i in 10:NROW(SPY) ) {&lt;br /&gt;
&amp;nbsp; CurrentDate=time(SPY)[i]&lt;br /&gt;
&amp;nbsp; equity = getEndEq(Account='default', CurrentDate)&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; for( symbol in symbols ) {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; sym = get(symbol)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; ClosePrice = as.numeric(Cl(sym[i,]))&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; Posn = getPosQty(Portfolio='default', Symbol=symbol, Date=CurrentDate)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; UnitSize = as.numeric(trunc((equity/NROW(symbols))/ClosePrice))&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; # Position Entry (assume fill at close)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; if( Posn == 0 ) {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; # No position, so test to initiate Long position&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if( Cl(sym[i,]) &amp;gt; sym[i,'SMA'] ) {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Store trade with blotter&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; addTxn('default', Symbol=symbol, TxnDate=CurrentDate,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TxnPrice=ClosePrice, TxnQty=UnitSize, TxnFees=0, verbose=verbose)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; } else {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Have a position, so check exit&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if( Cl(sym[i,]) &amp;lt; sym[i,'SMA'] ) {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Store trade with blotter&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; addTxn(Portfolio='default', Symbol=symbol, TxnDate=CurrentDate,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TxnPrice=ClosePrice, TxnQty=-Posn, TxnFees=0, verbose=verbose)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&amp;nbsp; } # End symbols loop&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; # Calculate P&amp;amp;L and resulting equity with blotter&lt;br /&gt;
&amp;nbsp; updatePortf(Portfolio='default', Dates=CurrentDate)&lt;br /&gt;
&amp;nbsp; updateAcct(name='default', Dates=CurrentDate)&lt;br /&gt;
&amp;nbsp; updateEndEq(Account='default', Dates=CurrentDate)&lt;br /&gt;
&lt;br /&gt;
} # End dates loop&lt;br /&gt;
&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: x-small;"&gt;# Buy and Hold cumulative equity&lt;br /&gt;
buyhold = cumprod( ( 1 + 0.5*ROC(Cl(IEF)) + 0.5*ROC(Cl(SPY)) )[-1] )&lt;br /&gt;
&lt;br /&gt;
# Final values&lt;br /&gt;
cat('Tactical Asset Allocation Return: ',(getEndEq(Account='default', Date=CurrentDate)-initEq)/initEq,'\n')&lt;br /&gt;
cat('Buy and Hold Return: ',tail(buyhold,1)-1,'\n')&lt;br /&gt;
&lt;br /&gt;
# Plot Strategy Summary&lt;br /&gt;
png(filename="20091118_blotter_strategy.png", 720, 720)&lt;/span&gt;&lt;/div&gt;&lt;div class="ii gt" id=":ud" style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: x-small;"&gt;charts.PerformanceSummary(ROC(&lt;/span&gt;&lt;wbr&gt;&lt;/wbr&gt;&lt;span style="font-size: x-small;"&gt;getAccount('default')$TOTAL$End.&lt;/span&gt;&lt;wbr&gt;&lt;/wbr&gt;&lt;span style="font-size: x-small;"&gt;Eq)[-1],main="Tactical Asset Allocation")&lt;/span&gt;&lt;/div&gt;&lt;span style="font-size: x-small;"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;dev.off()&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt; &lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt; # Plot Buy and Hold Summary&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt; png(filename="20091118_blotter_buyhold.png", 720, 720)&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt; charts.PerformanceSummary(ROC(buyhold)[-1],main="Buy &amp;amp; Hold")&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt; dev.off()&lt;/span&gt;&lt;br /&gt;
&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5815834906618132494-8332842223445511674?l=blog.fosstrading.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/opeFWtU-2hkvTXaX8xtje1EHBD0/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/opeFWtU-2hkvTXaX8xtje1EHBD0/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/opeFWtU-2hkvTXaX8xtje1EHBD0/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/opeFWtU-2hkvTXaX8xtje1EHBD0/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/FossTrading?a=fEDZCwKfi_4:0WMaKk5nDxQ:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FossTrading?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FossTrading?a=fEDZCwKfi_4:0WMaKk5nDxQ:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FossTrading?i=fEDZCwKfi_4:0WMaKk5nDxQ:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FossTrading?a=fEDZCwKfi_4:0WMaKk5nDxQ:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FossTrading?i=fEDZCwKfi_4:0WMaKk5nDxQ:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FossTrading?a=fEDZCwKfi_4:0WMaKk5nDxQ:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FossTrading?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FossTrading?a=fEDZCwKfi_4:0WMaKk5nDxQ:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FossTrading?i=fEDZCwKfi_4:0WMaKk5nDxQ:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/FossTrading/~4/fEDZCwKfi_4" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.fosstrading.com/feeds/8332842223445511674/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=5815834906618132494&amp;postID=8332842223445511674" title="18 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5815834906618132494/posts/default/8332842223445511674?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5815834906618132494/posts/default/8332842223445511674?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/FossTrading/~3/fEDZCwKfi_4/tactical-asset-allocation-using-blotter.html" title="Tactical asset allocation using blotter" /><author><name>Joshua Ulrich</name><uri>http://www.blogger.com/profile/16641971932645230429</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="12731449228814218421" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/_8iehP8a8rkE/SwS1neN40tI/AAAAAAAAAGo/W-lzFP5B2XM/s72-c/20091118_blotter_buyhold.png" height="72" width="72" /><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">18</thr:total><feedburner:origLink>http://blog.fosstrading.com/2009/11/tactical-asset-allocation-using-blotter.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DE4FR347eSp7ImA9WxBTE08.&quot;"><id>tag:blogger.com,1999:blog-5815834906618132494.post-2645473985861727296</id><published>2009-11-05T18:54:00.005-06:00</published><updated>2009-12-08T20:48:36.001-06:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-12-08T20:48:36.001-06:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Data" /><title>opentick alternatives</title><content type="html">I've been getting a bit of traffic from people searching for opentick &lt;a href="http://blog.fosstrading.com/2009/04/opentick-is-no-more.html"&gt;(the defunct company)&lt;/a&gt;, so I've started a list of similar (but non-free) data providers.&lt;br /&gt;&lt;br /&gt;I'm not affiliated with any of these vendors, and the list is in no particular order.  I'll update this post as more information becomes available.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.blogger.com/www.iqfeed.net"&gt;IQFeed&lt;/a&gt;&lt;br /&gt;- &lt;a href="http://www.iqfeed.net/index.cfm?displayaction=data&amp;amp;section=services"&gt;features&lt;/a&gt;, &lt;a href="http://www.iqfeed.net/index.cfm?displayaction=data&amp;amp;section=fees"&gt;fees&lt;/a&gt;, &lt;a href="http://www.iqfeed.net/index.cfm?displayaction=developer&amp;amp;section=main"&gt;API&lt;/a&gt;**&lt;br /&gt;- starts at $60/month*&lt;br /&gt;- OS: Windows&lt;br /&gt;- Same API as &lt;a href="http://www.dtniq.com/"&gt;DTN.IQ&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.blogger.com/www.esignal.com"&gt;eSignal&lt;/a&gt;&lt;br /&gt;- &lt;a href="http://www.esignal.com/esignal/features_exp.aspx?name=all"&gt;features&lt;/a&gt;, &lt;a href="http://www.esignal.com/esignal/pricing.aspx"&gt;fees&lt;/a&gt;, &lt;a href="http://www.esignal.com/esignal/features_exp.aspx?name=activex"&gt;API&lt;/a&gt;**&lt;br /&gt;- starts at $125/month*&lt;br /&gt;- OS: Windows&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.eoddata.com/Default.aspx"&gt;eoddata&lt;/a&gt;&lt;br /&gt;- &lt;a href="http://www.eoddata.com/Products/Default.aspx"&gt;features, fees, API&lt;/a&gt;&lt;br /&gt;- some data are free, as low as 1-minute intraday data for $19.95/month&lt;br /&gt;- OS: Windows&lt;br /&gt;&lt;br /&gt;Notes:&lt;br /&gt;*  plus exchange fees&lt;br /&gt;** API access may cost extra&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5815834906618132494-2645473985861727296?l=blog.fosstrading.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/CDYx6Q7tCGCjxGuQlwRI3myak8o/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/CDYx6Q7tCGCjxGuQlwRI3myak8o/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/CDYx6Q7tCGCjxGuQlwRI3myak8o/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/CDYx6Q7tCGCjxGuQlwRI3myak8o/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/FossTrading?a=eweB223I6k8:1oX6477Gd30:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FossTrading?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FossTrading?a=eweB223I6k8:1oX6477Gd30:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FossTrading?i=eweB223I6k8:1oX6477Gd30:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FossTrading?a=eweB223I6k8:1oX6477Gd30:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FossTrading?i=eweB223I6k8:1oX6477Gd30:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FossTrading?a=eweB223I6k8:1oX6477Gd30:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FossTrading?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FossTrading?a=eweB223I6k8:1oX6477Gd30:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FossTrading?i=eweB223I6k8:1oX6477Gd30:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/FossTrading/~4/eweB223I6k8" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.fosstrading.com/feeds/2645473985861727296/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=5815834906618132494&amp;postID=2645473985861727296" title="9 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5815834906618132494/posts/default/2645473985861727296?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5815834906618132494/posts/default/2645473985861727296?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/FossTrading/~3/eweB223I6k8/opentick-alternatives.html" title="opentick alternatives" /><author><name>Joshua Ulrich</name><uri>http://www.blogger.com/profile/16641971932645230429</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="12731449228814218421" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">9</thr:total><feedburner:origLink>http://blog.fosstrading.com/2009/11/opentick-alternatives.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CE4CQXs8fyp7ImA9WxNWGEU.&quot;"><id>tag:blogger.com,1999:blog-5815834906618132494.post-2842153556450258091</id><published>2009-10-18T11:21:00.003-05:00</published><updated>2009-10-18T11:22:40.577-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-10-18T11:22:40.577-05:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Data" /><title>Xasax closes shop</title><content type="html">Six months after &lt;a href="http://blog.fosstrading.com/2009/04/opentick-is-no-more.html"&gt;shutting down opentick completely&lt;/a&gt; Xasax (opentick's parent company) has followed suit.&lt;br /&gt;&lt;br /&gt;It looks like Xasax hit funding problems in August... &lt;a href=http://www.watersonline.com/public/showPage.html?page=imd_index&gt;Inside Market Data&lt;/a&gt; mentions the above in &lt;a href=http://www.watersonline.com/public/showPage.html?page=868403&gt;this story&lt;/a&gt;.  Here is the &lt;a href=http://www.watersonline.com/public/showPage.html?page=868401&gt;full story&lt;/a&gt; (subscription required).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5815834906618132494-2842153556450258091?l=blog.fosstrading.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/n_1gxg6EOgWrHXxfKJxYYFYspnE/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/n_1gxg6EOgWrHXxfKJxYYFYspnE/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/n_1gxg6EOgWrHXxfKJxYYFYspnE/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/n_1gxg6EOgWrHXxfKJxYYFYspnE/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/FossTrading?a=IybuwNG-N3c:ElfYrjgYPqs:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FossTrading?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FossTrading?a=IybuwNG-N3c:ElfYrjgYPqs:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FossTrading?i=IybuwNG-N3c:ElfYrjgYPqs:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FossTrading?a=IybuwNG-N3c:ElfYrjgYPqs:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FossTrading?i=IybuwNG-N3c:ElfYrjgYPqs:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FossTrading?a=IybuwNG-N3c:ElfYrjgYPqs:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FossTrading?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FossTrading?a=IybuwNG-N3c:ElfYrjgYPqs:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FossTrading?i=IybuwNG-N3c:ElfYrjgYPqs:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/FossTrading/~4/IybuwNG-N3c" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.fosstrading.com/feeds/2842153556450258091/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=5815834906618132494&amp;postID=2842153556450258091" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5815834906618132494/posts/default/2842153556450258091?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5815834906618132494/posts/default/2842153556450258091?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/FossTrading/~3/IybuwNG-N3c/xasax-closes-shop.html" title="Xasax closes shop" /><author><name>Joshua Ulrich</name><uri>http://www.blogger.com/profile/16641971932645230429</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="12731449228814218421" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">2</thr:total><feedburner:origLink>http://blog.fosstrading.com/2009/10/xasax-closes-shop.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUcBQHs4eSp7ImA9WxNQFko.&quot;"><id>tag:blogger.com,1999:blog-5815834906618132494.post-324584731763768887</id><published>2009-09-22T22:37:00.000-05:00</published><updated>2009-09-22T22:37:31.531-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-09-22T22:37:31.531-05:00</app:edited><title>Update</title><content type="html">I can't believe it's been two months since I last posted... wow, time has a way of slipping through my fingers.&amp;nbsp; Here's a short list of some upcoming posts:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;An introduction to &lt;a href="https://r-forge.r-project.org/projects/lspm"&gt;LSPM&lt;/a&gt; -- a new R package that implements &lt;a href="http://parametricplanet.com/rvince/"&gt;Ralph Vince's&lt;/a&gt; leverage space portfolio model (co-authored with &lt;a href="http://dopeness.org/"&gt;Soren Macbeth&lt;/a&gt;).&lt;/li&gt;
&lt;li&gt;Updated charting with &lt;a href="http://www.quantmod.com/"&gt;quantmod&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;An introduction to &lt;a href="https://r-forge.r-project.org/projects/blotter"&gt;blotter&lt;/a&gt; -- a transaction-based infrastructure for trading systems and simulation, providing support for multi-asset class and multi-currency portfolios. &lt;/li&gt;
&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5815834906618132494-324584731763768887?l=blog.fosstrading.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/KpSq7kEAUGkbDu_hMa9RX9-mYX4/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/KpSq7kEAUGkbDu_hMa9RX9-mYX4/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/KpSq7kEAUGkbDu_hMa9RX9-mYX4/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/KpSq7kEAUGkbDu_hMa9RX9-mYX4/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/FossTrading?a=-hpkjh9jnc0:YZ72EKgVk2k:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FossTrading?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FossTrading?a=-hpkjh9jnc0:YZ72EKgVk2k:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FossTrading?i=-hpkjh9jnc0:YZ72EKgVk2k:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FossTrading?a=-hpkjh9jnc0:YZ72EKgVk2k:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FossTrading?i=-hpkjh9jnc0:YZ72EKgVk2k:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FossTrading?a=-hpkjh9jnc0:YZ72EKgVk2k:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FossTrading?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FossTrading?a=-hpkjh9jnc0:YZ72EKgVk2k:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FossTrading?i=-hpkjh9jnc0:YZ72EKgVk2k:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/FossTrading/~4/-hpkjh9jnc0" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.fosstrading.com/feeds/324584731763768887/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=5815834906618132494&amp;postID=324584731763768887" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5815834906618132494/posts/default/324584731763768887?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5815834906618132494/posts/default/324584731763768887?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/FossTrading/~3/-hpkjh9jnc0/update.html" title="Update" /><author><name>Joshua Ulrich</name><uri>http://www.blogger.com/profile/16641971932645230429</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="12731449228814218421" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">1</thr:total><feedburner:origLink>http://blog.fosstrading.com/2009/09/update.html</feedburner:origLink></entry><entry gd:etag="W/&quot;Dk8EQnY6fCp7ImA9WxBVFEs.&quot;"><id>tag:blogger.com,1999:blog-5815834906618132494.post-3058745081573813777</id><published>2009-07-19T08:38:00.003-05:00</published><updated>2010-02-17T21:46:43.814-06:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-02-17T21:46:43.814-06:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Code" /><title>David Varadi's RSI(2) alternative</title><content type="html">Here's a quick R implementation of &lt;a href="http://cssanalytics.wordpress.com/"&gt;David Varadi's&lt;/a&gt; alternative to the RSI(2).&amp;nbsp; Michael Stokes over at the &lt;a href="http://marketsci.wordpress.com/"&gt;MarketSci&lt;/a&gt; blog has three great posts exploring this indicator:&lt;br /&gt;
&lt;ol&gt;&lt;li&gt;&lt;a href="http://marketsci.wordpress.com/2009/07/15/varadi%e2%80%99s-rsi2-alternative-the-dv2/" rel="bookmark" title="Permanent Link to &amp;quot;Varadi’s RSI(2) Alternative: The DV(2)&amp;quot;"&gt;Varadi’s RSI(2) Alternative: The&amp;nbsp;DV(2)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://marketsci.wordpress.com/2009/07/16/rsi2-vs-dv2/" rel="bookmark" title="Permanent Link to &amp;quot;RSI(2) vs. DV(2)&amp;quot;"&gt;RSI(2) vs.&amp;nbsp;DV(2)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://marketsci.wordpress.com/2009/07/17/last-couple-of-notes-on-dv2/" rel="bookmark" title="Permanent Link to &amp;quot;Last Couple of Notes on DV(2)&amp;quot;"&gt;Last Couple of Notes on&amp;nbsp;DV(2)&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;Here's the R code:&lt;br /&gt;
&lt;blockquote&gt;&lt;span style="font-size: x-small;"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;DV &amp;lt;- function(HLC, n=2, bounded=FALSE) {&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp; # "HLC" is an _xts_ object with "High", "Low", and "Close"&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp; # columns, in that order.&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp; &lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp; # This is David Varadi's alternative to the RSI(2).&amp;nbsp; Calculations&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp; # taken from the marketsci blog -- http://marketsci.wordpress.com&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp; # Author of this implementation: Joshua Ulrich&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp; # Calculate each day's high/low mean&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp; hlMean &amp;lt;- rowMeans( HLC[,-3] )&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp; &lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp; # Calculate the running Mean of the Close divided by the&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp; # high/low mean, then subtract 1.&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp; res &amp;lt;- runMean( HLC[,3] / hlMean, n ) - 1&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp; &lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp; # If we want the bounded DV...&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp; if(bounded) {&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Set the range to calculated the bounded DV&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; rng &amp;lt;- 252:NROW(res)&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Grab the index of the unbounded results, so we can convert&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # the bounded results back to an xts object.&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; indx &amp;lt;- index(res)&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # A simple percent rank function hack&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; pctRank &amp;lt;- function(x,i) match(x[i], sort(coredata(x[(i-251):i])))&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Apply the percent rank function to the coredata of our results&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; res &amp;lt;- sapply(rng, function(i) pctRank(res, i) / 252)&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Convert the bounded results to xts&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; res &amp;lt;- xts(c(rep(NA,251),res), indx)&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp; }&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp; # Return results&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp; return(res)&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5815834906618132494-3058745081573813777?l=blog.fosstrading.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/A6PHwxlJFI7mhR3h3pJCG0N563g/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/A6PHwxlJFI7mhR3h3pJCG0N563g/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/A6PHwxlJFI7mhR3h3pJCG0N563g/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/A6PHwxlJFI7mhR3h3pJCG0N563g/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/FossTrading?a=Bgf-p294Odo:TKOIGmsnOMY:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FossTrading?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FossTrading?a=Bgf-p294Odo:TKOIGmsnOMY:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FossTrading?i=Bgf-p294Odo:TKOIGmsnOMY:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FossTrading?a=Bgf-p294Odo:TKOIGmsnOMY:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FossTrading?i=Bgf-p294Odo:TKOIGmsnOMY:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FossTrading?a=Bgf-p294Odo:TKOIGmsnOMY:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FossTrading?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FossTrading?a=Bgf-p294Odo:TKOIGmsnOMY:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FossTrading?i=Bgf-p294Odo:TKOIGmsnOMY:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/FossTrading/~4/Bgf-p294Odo" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.fosstrading.com/feeds/3058745081573813777/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=5815834906618132494&amp;postID=3058745081573813777" title="6 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5815834906618132494/posts/default/3058745081573813777?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5815834906618132494/posts/default/3058745081573813777?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/FossTrading/~3/Bgf-p294Odo/david-varadis-rsi2-alternative.html" title="David Varadi's RSI(2) alternative" /><author><name>Joshua Ulrich</name><uri>http://www.blogger.com/profile/16641971932645230429</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="12731449228814218421" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">6</thr:total><feedburner:origLink>http://blog.fosstrading.com/2009/07/david-varadis-rsi2-alternative.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEMHRXc-eip7ImA9WxJVEkg.&quot;"><id>tag:blogger.com,1999:blog-5815834906618132494.post-777935340186875356</id><published>2009-06-28T22:02:00.012-05:00</published><updated>2009-06-29T00:13:54.952-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-06-29T00:13:54.952-05:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Examples" /><category scheme="http://www.blogger.com/atom/ns#" term="Code" /><title>RSI(2) Evaluation</title><content type="html">Despite my best efforts, it's been a month since the last post of this series.  The &lt;a href="http://blog.fosstrading.com/2009/04/testing-rsi2-with-r.html"&gt;first post&lt;/a&gt; replicated this &lt;a href="http://marketsci.wordpress.com/2008/12/09/trading-with-rsi2/"&gt;simple RSI(2) strategy&lt;/a&gt; from the &lt;a href="http://marketsci.wordpress.com/"&gt;MarketSci Blog&lt;/a&gt; using &lt;a href="http://www.r-project.org/"&gt;R&lt;/a&gt;.  The &lt;a href="http://blog.fosstrading.com/2009/05/rsi2-with-position-sizing.html"&gt;second post&lt;/a&gt; showed how to replicate &lt;a href="http://marketsci.wordpress.com/2008/12/14/trading-strategy-scaling-inout-of-rsi2/"&gt;the strategy&lt;/a&gt; that scales in/out of RSI(2).&lt;br /&gt;
&lt;br /&gt;
This post will use the &lt;a href="http://cran.r-project.org/web/packages/PerformanceAnalytics/"&gt;PerformanceAnalytics&lt;/a&gt; package to evaluate the rules that scale in/out of positions. I've also provided a simple function that provides some summary statistics. There is a lot of code, so I put it at the end of the post.&lt;br /&gt;
&lt;br /&gt;
Table 1 contains output from my simple trade summary function (the wins and losses are in percentages, i.e. 0.69 is 69 basis points).  The short side of the rule traded more often and had a lower win rate.  The short side overcame its lower win rate via much higher mean and median win/loss ratios.&lt;br /&gt;
&lt;br /&gt;
&lt;table border="0" cellpadding="0" cellspacing="0" width=600px&gt;&lt;caption&gt;Table 1: RSI(2) Trade Statistics - RSI steps = 5, Size steps = 0.25&lt;/caption&gt; &lt;tbody&gt;
&lt;tr&gt;   &lt;th align="center"&gt;Signal&lt;/th&gt;   &lt;th align="center"&gt;# Trades&lt;/th&gt;   &lt;th align="center"&gt;% Win&lt;/th&gt;   &lt;th align="center"&gt;Mean Win&lt;/th&gt;   &lt;th align="center"&gt;Mean Loss&lt;/th&gt;   &lt;th align="center"&gt;Median Win&lt;/th&gt;   &lt;th align="center"&gt;Median Loss&lt;/th&gt;   &lt;th align="center"&gt;Mean W/L&lt;/th&gt;   &lt;th align="center"&gt;Median W/L&lt;/th&gt; &lt;/tr&gt;
&lt;tr align="center"&gt;&lt;td&gt;-1.00&lt;/td&gt;&lt;td&gt;133&lt;/td&gt;&lt;td&gt;58&lt;/td&gt;&lt;td&gt;0.69&lt;/td&gt;&lt;td&gt;-0.44&lt;/td&gt;&lt;td&gt;0.53&lt;/td&gt;&lt;td&gt;-0.25&lt;/td&gt;&lt;td&gt;1.55&lt;/td&gt;&lt;td&gt;2.12&lt;/td&gt;&lt;/tr&gt;
&lt;tr align="center"&gt;&lt;td&gt;-0.75&lt;/td&gt;&lt;td&gt;173&lt;/td&gt;&lt;td&gt;49&lt;/td&gt;&lt;td&gt;0.62&lt;/td&gt;&lt;td&gt;-0.39&lt;/td&gt;&lt;td&gt;0.37&lt;/td&gt;&lt;td&gt;-0.25&lt;/td&gt;&lt;td&gt;1.60&lt;/td&gt;&lt;td&gt;1.48&lt;/td&gt;&lt;/tr&gt;
&lt;tr align="center"&gt;&lt;td&gt;-0.50&lt;/td&gt;&lt;td&gt;143&lt;/td&gt;&lt;td&gt;54&lt;/td&gt;&lt;td&gt;0.43&lt;/td&gt;&lt;td&gt;-0.36&lt;/td&gt;&lt;td&gt;0.28&lt;/td&gt;&lt;td&gt;-0.19&lt;/td&gt;&lt;td&gt;1.19&lt;/td&gt;&lt;td&gt;1.51&lt;/td&gt;&lt;/tr&gt;
&lt;tr align="center"&gt;&lt;td&gt;-0.25&lt;/td&gt;&lt;td&gt;158&lt;/td&gt;&lt;td&gt;56&lt;/td&gt;&lt;td&gt;0.21&lt;/td&gt;&lt;td&gt;-0.19&lt;/td&gt;&lt;td&gt;0.14&lt;/td&gt;&lt;td&gt;-0.13&lt;/td&gt;&lt;td&gt;1.15&lt;/td&gt;&lt;td&gt;1.08&lt;/td&gt;&lt;/tr&gt;
&lt;tr align="center"&gt;&lt;td&gt;0.00&lt;/td&gt;&lt;td&gt;1262&lt;/td&gt;&lt;td&gt;0&lt;/td&gt;&lt;td&gt;NaN&lt;/td&gt;&lt;td&gt;NaN&lt;/td&gt;&lt;td&gt;NA&lt;/td&gt;&lt;td&gt;NA&lt;/td&gt;&lt;td&gt;NaN&lt;/td&gt;&lt;td&gt;NA&lt;/td&gt;&lt;/tr&gt;
&lt;tr align="center"&gt;&lt;td&gt;0.25&lt;/td&gt;&lt;td&gt;117&lt;/td&gt;&lt;td&gt;53&lt;/td&gt;&lt;td&gt;0.26&lt;/td&gt;&lt;td&gt;-0.31&lt;/td&gt;&lt;td&gt;0.18&lt;/td&gt;&lt;td&gt;-0.21&lt;/td&gt;&lt;td&gt;0.83&lt;/td&gt;&lt;td&gt;0.86&lt;/td&gt;&lt;/tr&gt;
&lt;tr align="center"&gt;&lt;td&gt;0.50&lt;/td&gt;&lt;td&gt;137&lt;/td&gt;&lt;td&gt;58&lt;/td&gt;&lt;td&gt;0.51&lt;/td&gt;&lt;td&gt;-0.58&lt;/td&gt;&lt;td&gt;0.31&lt;/td&gt;&lt;td&gt;-0.35&lt;/td&gt;&lt;td&gt;0.87&lt;/td&gt;&lt;td&gt;0.89&lt;/td&gt;&lt;/tr&gt;
&lt;tr align="center"&gt;&lt;td&gt;0.75&lt;/td&gt;&lt;td&gt;143&lt;/td&gt;&lt;td&gt;62&lt;/td&gt;&lt;td&gt;0.88&lt;/td&gt;&lt;td&gt;-0.89&lt;/td&gt;&lt;td&gt;0.50&lt;/td&gt;&lt;td&gt;-0.71&lt;/td&gt;&lt;td&gt;0.99&lt;/td&gt;&lt;td&gt;0.70&lt;/td&gt;&lt;/tr&gt;
&lt;tr align="center"&gt;&lt;td&gt;1.00&lt;/td&gt;&lt;td&gt;119&lt;/td&gt;&lt;td&gt;63&lt;/td&gt;&lt;td&gt;1.34&lt;/td&gt;&lt;td&gt;-1.41&lt;/td&gt;&lt;td&gt;0.80&lt;/td&gt;&lt;td&gt;-1.11&lt;/td&gt;&lt;td&gt;0.95&lt;/td&gt;&lt;td&gt;0.71&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;
Table 2 shows the output from the PerformanceAnalytics table.Drawdowns() function.  The largest percentage drawdown occurred in late 2008, but only lasted a few weeks.&lt;br /&gt;
&lt;br /&gt;
The table also shows the system is prone to drawdowns that trough quickly and take months to recover from.  A week of bad trades can take months to recover from.&lt;br /&gt;
&lt;br /&gt;
&lt;table border="0" cellpadding="0" cellspacing="0" width=600px&gt;&lt;caption&gt;Table 2: RSI(2) Drawdowns - RSI steps = 5, Size steps = 0.25&lt;/caption&gt; &lt;tbody&gt; &lt;/tbody&gt;&lt;tbody&gt;
&lt;tr&gt;   &lt;th align="center"&gt;From&lt;/th&gt;   &lt;th align="center"&gt;Trough&lt;/th&gt;   &lt;th align="center"&gt;To&lt;/th&gt;   &lt;th align="center"&gt;Depth&lt;/th&gt;   &lt;th align="center"&gt;Length&lt;/th&gt;   &lt;th align="center"&gt;To Trough&lt;/th&gt;   &lt;th align="center"&gt;Recovery&lt;/th&gt;  &lt;/tr&gt;
&lt;tr align="center"&gt;&lt;td&gt;2008-10-06&lt;/td&gt;&lt;td&gt;2008-10-10&lt;/td&gt;&lt;td&gt;2008-10-28&lt;/td&gt;&lt;td&gt;-0.157&lt;/td&gt;&lt;td&gt;17&lt;/td&gt;&lt;td&gt;5&lt;/td&gt;&lt;td&gt;12&lt;/td&gt;&lt;/tr&gt;
&lt;tr align="center"&gt;&lt;td&gt;2001-08-30&lt;/td&gt;&lt;td&gt;2001-09-21&lt;/td&gt;&lt;td&gt;2002-01-23&lt;/td&gt;&lt;td&gt;-0.091&lt;/td&gt;&lt;td&gt;96&lt;/td&gt;&lt;td&gt;12&lt;/td&gt;&lt;td&gt;84&lt;/td&gt;&lt;/tr&gt;
&lt;tr align="center"&gt;&lt;td&gt;2002-07-19&lt;/td&gt;&lt;td&gt;2002-07-23&lt;/td&gt;&lt;td&gt;2002-08-20&lt;/td&gt;&lt;td&gt;-0.088&lt;/td&gt;&lt;td&gt;23&lt;/td&gt;&lt;td&gt;3&lt;/td&gt;&lt;td&gt;20&lt;/td&gt;&lt;/tr&gt;
&lt;tr align="center"&gt;&lt;td&gt;2000-03-22&lt;/td&gt;&lt;td&gt;2000-04-14&lt;/td&gt;&lt;td&gt;2000-07-05&lt;/td&gt;&lt;td&gt;-0.076&lt;/td&gt;&lt;td&gt;73&lt;/td&gt;&lt;td&gt;18&lt;/td&gt;&lt;td&gt;55&lt;/td&gt;&lt;/tr&gt;
&lt;tr align="center"&gt;&lt;td&gt;2009-02-17&lt;/td&gt;&lt;td&gt;2009-02-23&lt;/td&gt;&lt;td&gt;2009-04-27&lt;/td&gt;&lt;td&gt;-0.070&lt;/td&gt;&lt;td&gt;49&lt;/td&gt;&lt;td&gt;5&lt;/td&gt;&lt;td&gt;44&lt;/td&gt;&lt;/tr&gt;
&lt;tr align="center"&gt;&lt;td&gt;2003-03-14&lt;/td&gt;&lt;td&gt;2003-03-21&lt;/td&gt;&lt;td&gt;2003-05-09&lt;/td&gt;&lt;td&gt;-0.055&lt;/td&gt;&lt;td&gt;40&lt;/td&gt;&lt;td&gt;6&lt;/td&gt;&lt;td&gt;34&lt;/td&gt;&lt;/tr&gt;
&lt;tr align="center"&gt;&lt;td&gt;2000-10-09&lt;/td&gt;&lt;td&gt;2000-10-12&lt;/td&gt;&lt;td&gt;2000-12-06&lt;/td&gt;&lt;td&gt;-0.052&lt;/td&gt;&lt;td&gt;42&lt;/td&gt;&lt;td&gt;4&lt;/td&gt;&lt;td&gt;38&lt;/td&gt;&lt;/tr&gt;
&lt;tr align="center"&gt;&lt;td&gt;2002-08-29&lt;/td&gt;&lt;td&gt;2002-09-24&lt;/td&gt;&lt;td&gt;2002-10-10&lt;/td&gt;&lt;td&gt;-0.051&lt;/td&gt;&lt;td&gt;30&lt;/td&gt;&lt;td&gt;18&lt;/td&gt;&lt;td&gt;12&lt;/td&gt;&lt;/tr&gt;
&lt;tr align="center"&gt;&lt;td&gt;2008-01-02&lt;/td&gt;&lt;td&gt;2008-01-22&lt;/td&gt;&lt;td&gt;2008-03-11&lt;/td&gt;&lt;td&gt;-0.045&lt;/td&gt;&lt;td&gt;48&lt;/td&gt;&lt;td&gt;14&lt;/td&gt;&lt;td&gt;34&lt;/td&gt;&lt;/tr&gt;
&lt;tr align="center"&gt;&lt;td&gt;2001-04-18&lt;/td&gt;&lt;td&gt;2001-06-18&lt;/td&gt;&lt;td&gt;2001-08-10&lt;/td&gt;&lt;td&gt;-0.045&lt;/td&gt;&lt;td&gt;81&lt;/td&gt;&lt;td&gt;43&lt;/td&gt;&lt;td&gt;38&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt; &lt;/table&gt;&lt;br /&gt;
Table 3 shows the output from the PerformanceAnalytics table.DownsideRisk() function.  The ratio of gain/loss deviation is encouraging.  I have to defer to the PerformanceAnalytics documentation and vingettes to describe the rest of the table.&lt;br /&gt;
&lt;br /&gt;
&lt;table border="0" cellpadding="0" cellspacing="0" width=300px&gt;&lt;caption&gt;Table 3: RSI(2) Downside Risk - RSI steps = 5, Size steps = 0.25&lt;/caption&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;th align="left"&gt;Statistic&lt;/th&gt;&lt;th align="left"&gt;Return&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Semi Deviation&lt;/td&gt;&lt;td&gt;0.0050&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Gain Deviation&lt;/td&gt;&lt;td&gt;0.0094&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Loss Deviation&lt;/td&gt;&lt;td&gt;0.0076&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Downside Deviation (MAR=10%)&lt;/td&gt;&lt;td&gt;0.0099&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Downside Deviation (rf=0%)&lt;/td&gt;&lt;td&gt;0.0092&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Downside Deviation (0%)&lt;/td&gt;&lt;td&gt;0.0092&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Maximum Drawdown&lt;/td&gt;&lt;td&gt;-0.1572&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;VaR (99%)&lt;/td&gt;&lt;td&gt;0.0160&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Beyond VaR&lt;/td&gt;&lt;td&gt;0.0160&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Modified VaR (99%)&lt;/td&gt;&lt;td&gt;0.0705&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt; &lt;/table&gt;&lt;br /&gt;
The chart below shows the output from the PerformanceAnalytics charts.PerformanceSummary() function.  It shows the equity curves and drawdown from peak for the long and short sides of the strategy.  The middle graph shows the *daily* returns for the combined strategy.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_8iehP8a8rkE/Skglb1Rh8wI/AAAAAAAAAGY/DTfYfLDPLu0/s1600-h/20090606_rsi2_performance.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img src="http://3.bp.blogspot.com/_8iehP8a8rkE/Skglb1Rh8wI/AAAAAAAAAGY/DTfYfLDPLu0/s400/20090606_rsi2_performance.png" border="0" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
The code below has everything that created the results above.  It also contains the same results for a modified RSI(2) strategy.  The modified strategy uses RSI steps of 10 and sizing steps of 0.3 (i.e. RSI&amp;lt;10 -&amp;gt; size=1, 10&lt;rsi&gt;&amp;lt;20 -&amp;gt; size=0.7, etc.).&lt;br /&gt;
&lt;/rsi&gt;&lt;br /&gt;
&lt;blockquote  style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;# Attach packages.  You can install packages via:&lt;br /&gt;
# install.packages(c("quantmod","TTR","PerformanceAnalytics"))&lt;br /&gt;
library(quantmod)&lt;br /&gt;
library(TTR)&lt;br /&gt;
library(PerformanceAnalytics)&lt;br /&gt;
&lt;br /&gt;
# Pull S&amp;amp;P500 index data from Yahoo! Finance&lt;br /&gt;
getSymbols("^GSPC", from="2000-01-01")&lt;br /&gt;
&lt;br /&gt;
# Calculate the RSI indicator&lt;br /&gt;
rsi &amp;lt;- RSI(Cl(GSPC), 2)&lt;br /&gt;
&lt;br /&gt;
# Calculate Close-to-Close returns&lt;br /&gt;
ret &amp;lt;- ROC(Cl(GSPC))&lt;br /&gt;
ret[1] &amp;lt;- 0&lt;br /&gt;
&lt;br /&gt;
# This function gives us some standard summary&lt;br /&gt;
# statistics for our trades.&lt;br /&gt;
tradeStats &amp;lt;- function(signals, returns) {&lt;br /&gt;
# Inputs:&lt;br /&gt;
# signals : trading signals&lt;br /&gt;
# returns : returns corresponding to signals&lt;br /&gt;
&lt;br /&gt;
# Combine data and convert to data.frame&lt;br /&gt;
sysRet &amp;lt;- signals * returns * 100&lt;br /&gt;
posRet &amp;lt;- sysRet &amp;gt; 0          # Positive rule returns&lt;br /&gt;
negRet &amp;lt;- sysRet &amp;lt; 0          # Negative rule returns&lt;br /&gt;
dat &amp;lt;- cbind(signals,posRet*100,sysRet[posRet],sysRet[negRet],1)&lt;br /&gt;
dat &amp;lt;- as.data.frame(dat)&lt;br /&gt;
&lt;br /&gt;
# Aggreate data for summary statistics&lt;br /&gt;
means   &amp;lt;- aggregate(dat[,2:4], by=list(dat[,1]), mean, na.rm=TRUE)&lt;br /&gt;
medians &amp;lt;- aggregate(dat[,3:4], by=list(dat[,1]), median, na.rm=TRUE)&lt;br /&gt;
sums    &amp;lt;- aggregate(dat[,5],   by=list(dat[,1]), sum)&lt;br /&gt;
&lt;br /&gt;
colnames(means)   &amp;lt;- c("Signal","% Win","Mean Win","Mean Loss")&lt;br /&gt;
colnames(medians) &amp;lt;- c("Signal","Median Win","Median Loss")&lt;br /&gt;
colnames(sums)    &amp;lt;- c("Signal","# Trades")&lt;br /&gt;
&lt;br /&gt;
all &amp;lt;- merge(sums,means)&lt;br /&gt;
all &amp;lt;- merge(all,medians)&lt;br /&gt;
&lt;br /&gt;
wl &amp;lt;- cbind( abs(all[,"Mean Win"]/all[,"Mean Loss"]),&lt;br /&gt;
abs(all[,"Median Win"]/all[,"Median Loss"]) )&lt;br /&gt;
colnames(wl) &amp;lt;- c("Mean W/L","Median W/L")&lt;br /&gt;
&lt;br /&gt;
all &amp;lt;- cbind(all,wl)&lt;br /&gt;
return(all)&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
# This function determines position size and&lt;br /&gt;
# enables us to test several ideas with much&lt;br /&gt;
# greater speed and flexibility.&lt;br /&gt;
rsi2pos &amp;lt;- function(ind, indIncr=5, posIncr=0.25) {&lt;br /&gt;
# Inputs:&lt;br /&gt;
# ind     : indicator vector&lt;br /&gt;
# indIncr : indicator value increments/breakpoints&lt;br /&gt;
# posIncr : position value increments/breakpoints&lt;br /&gt;
&lt;br /&gt;
# Initialize result vector&lt;br /&gt;
size &amp;lt;- rep(0,NROW(ind))&lt;br /&gt;
&lt;br /&gt;
# Long&lt;br /&gt;
size &amp;lt;- ifelse(ind &amp;lt; 4*indIncr, (1-posIncr*3), size)&lt;br /&gt;
size &amp;lt;- ifelse(ind &amp;lt; 3*indIncr, (1-posIncr*2), size)&lt;br /&gt;
size &amp;lt;- ifelse(ind &amp;lt; 2*indIncr, (1-posIncr*1), size)&lt;br /&gt;
size &amp;lt;- ifelse(ind &amp;lt; 1*indIncr, (1-posIncr*0), size)&lt;br /&gt;
&lt;br /&gt;
# Short&lt;br /&gt;
size &amp;lt;- ifelse(ind &amp;gt; 100-4*indIncr, 3*posIncr-1, size)&lt;br /&gt;
size &amp;lt;- ifelse(ind &amp;gt; 100-3*indIncr, 2*posIncr-1, size)&lt;br /&gt;
size &amp;lt;- ifelse(ind &amp;gt; 100-2*indIncr, 1*posIncr-1, size)&lt;br /&gt;
size &amp;lt;- ifelse(ind &amp;gt; 100-1*indIncr, 0*posIncr-1, size)&lt;br /&gt;
&lt;br /&gt;
# Today's position ('size') is based on today's&lt;br /&gt;
# indicator, but we need to apply today's position&lt;br /&gt;
# to the Close-to-Close return at tomorrow's close.&lt;br /&gt;
size &amp;lt;- lag(size)&lt;br /&gt;
&lt;br /&gt;
# Replace missing signals with no position&lt;br /&gt;
# (generally just at beginning of series)&lt;br /&gt;
size[is.na(size)] &amp;lt;- 0&lt;br /&gt;
&lt;br /&gt;
# Return results&lt;br /&gt;
return(size)&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
# Calculate signals with the 'rsi2pos()' function,&lt;br /&gt;
# using 5 as the RSI step: 5, 10, 15, 20, 80, 85, 90, 95&lt;br /&gt;
# and 0.25 as the size step: 0.25, 0.50, 0.75, 1.00&lt;br /&gt;
sig &amp;lt;- rsi2pos(rsi, 5, 0.25)&lt;br /&gt;
&lt;br /&gt;
# Break out the long (up) and short (dn) signals&lt;br /&gt;
sigup &amp;lt;- ifelse(sig &amp;gt; 0, sig, 0)&lt;br /&gt;
sigdn &amp;lt;- ifelse(sig &amp;lt; 0, sig, 0)&lt;br /&gt;
&lt;br /&gt;
# Calculate rule returns&lt;br /&gt;
ret_up  &amp;lt;- ret * sigup&lt;br /&gt;
colnames(ret_up)  &amp;lt;- 'Long System Return'&lt;br /&gt;
ret_dn  &amp;lt;- ret * sigdn&lt;br /&gt;
colnames(ret_dn)  &amp;lt;- 'Short System Return'&lt;br /&gt;
ret_all &amp;lt;- ret * sig&lt;br /&gt;
colnames(ret_all) &amp;lt;- 'Total System Return'&lt;br /&gt;
&lt;br /&gt;
# Create performance graphs&lt;br /&gt;
png(filename="20090606_rsi2_performance.png", 720, 720)&lt;br /&gt;
charts.PerformanceSummary(cbind(ret_up,ret_dn),methods='none',&lt;br /&gt;
main='RSI(2) Performance - RSI steps = 5, Size steps = 0.25')&lt;br /&gt;
dev.off()&lt;br /&gt;
&lt;br /&gt;
# Print trade statistics table&lt;br /&gt;
cat('\nRSI(2) Trade Statistics - RSI steps = 5, Size steps = 0.25\n')&lt;br /&gt;
print(tradeStats(sig,ret))&lt;br /&gt;
&lt;br /&gt;
# Print drawdown table&lt;br /&gt;
cat('\nRSI(2) Drawdowns - RSI steps = 5, Size steps = 0.25\n')&lt;br /&gt;
print(table.Drawdowns(ret_all, top=10))&lt;br /&gt;
&lt;br /&gt;
# Print downside risk table&lt;br /&gt;
cat('\nRSI(2) Downside Risk - RSI steps = 5, Size steps = 0.25\n')&lt;br /&gt;
print(table.DownsideRisk(ret_all))&lt;br /&gt;
&lt;br /&gt;
# Calculate signals with the 'rsi2pos()' function&lt;br /&gt;
# using new RSI and size step values&lt;br /&gt;
sig &amp;lt;- rsi2pos(rsi, 10, 0.3)&lt;br /&gt;
&lt;br /&gt;
# Break out the long (up) and short (dn) signals&lt;br /&gt;
sigup &amp;lt;- ifelse(sig &amp;gt; 0, sig, 0)&lt;br /&gt;
sigdn &amp;lt;- ifelse(sig &amp;lt; 0, sig, 0)&lt;br /&gt;
&lt;br /&gt;
# Calculate rule returns&lt;br /&gt;
ret_up  &amp;lt;- ret * sigup&lt;br /&gt;
colnames(ret_up)  &amp;lt;- 'Long System Return'&lt;br /&gt;
ret_dn  &amp;lt;- ret * sigdn&lt;br /&gt;
colnames(ret_dn)  &amp;lt;- 'Short System Return'&lt;br /&gt;
ret_all &amp;lt;- ret * sig&lt;br /&gt;
colnames(ret_all) &amp;lt;- 'Total System Return'&lt;br /&gt;
&lt;br /&gt;
# Calculate performance statistics&lt;br /&gt;
png(filename="20090606_rsi2_performance_updated.png", 720, 720)&lt;br /&gt;
charts.PerformanceSummary(cbind(ret_up,ret_dn),methods='none',&lt;br /&gt;
main='RSI(2) Performance - RSI steps = 10, Size steps = 0.30')&lt;br /&gt;
dev.off()&lt;br /&gt;
&lt;br /&gt;
# Print trade statistics table&lt;br /&gt;
cat('\nRSI(2) Trade Statistics - RSI steps = 10, Size steps = 0.30\n')&lt;br /&gt;
print(tradeStats(sig,ret))&lt;br /&gt;
&lt;br /&gt;
# Print drawdown table&lt;br /&gt;
cat('\nRSI(2) Drawdowns - RSI steps = 10, Size steps = 0.30\n')&lt;br /&gt;
print(table.Drawdowns(ret_all, top=10))&lt;br /&gt;
&lt;br /&gt;
# Print downside risk table&lt;br /&gt;
cat('\nRSI(2) Downside Risk - RSI steps = 10, Size steps = 0.30\n')&lt;br /&gt;
print(table.DownsideRisk(ret_all))&lt;br /&gt;
&lt;br /&gt;
&lt;/span&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5815834906618132494-777935340186875356?l=blog.fosstrading.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/y5Nw4Bevb1_800WcBQI7Ml4cjeE/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/y5Nw4Bevb1_800WcBQI7Ml4cjeE/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/y5Nw4Bevb1_800WcBQI7Ml4cjeE/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/y5Nw4Bevb1_800WcBQI7Ml4cjeE/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/FossTrading?a=j81O1GtkBwQ:0Yiycv1fqwg:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FossTrading?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FossTrading?a=j81O1GtkBwQ:0Yiycv1fqwg:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FossTrading?i=j81O1GtkBwQ:0Yiycv1fqwg:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FossTrading?a=j81O1GtkBwQ:0Yiycv1fqwg:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FossTrading?i=j81O1GtkBwQ:0Yiycv1fqwg:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FossTrading?a=j81O1GtkBwQ:0Yiycv1fqwg:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FossTrading?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FossTrading?a=j81O1GtkBwQ:0Yiycv1fqwg:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FossTrading?i=j81O1GtkBwQ:0Yiycv1fqwg:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/FossTrading/~4/j81O1GtkBwQ" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.fosstrading.com/feeds/777935340186875356/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=5815834906618132494&amp;postID=777935340186875356" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5815834906618132494/posts/default/777935340186875356?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5815834906618132494/posts/default/777935340186875356?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/FossTrading/~3/j81O1GtkBwQ/rsi2-evaluation.html" title="RSI(2) Evaluation" /><author><name>Joshua Ulrich</name><uri>http://www.blogger.com/profile/16641971932645230429</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="12731449228814218421" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/_8iehP8a8rkE/Skglb1Rh8wI/AAAAAAAAAGY/DTfYfLDPLu0/s72-c/20090606_rsi2_performance.png" height="72" width="72" /><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://blog.fosstrading.com/2009/06/rsi2-evaluation.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0cERnw7eCp7ImA9WxJREU4.&quot;"><id>tag:blogger.com,1999:blog-5815834906618132494.post-2686191558762893458</id><published>2009-05-12T09:22:00.003-05:00</published><updated>2009-05-12T09:36:47.200-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-05-12T09:36:47.200-05:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="quantmod" /><category scheme="http://www.blogger.com/atom/ns#" term="TTR" /><category scheme="http://www.blogger.com/atom/ns#" term="Examples" /><category scheme="http://www.blogger.com/atom/ns#" term="xts" /><title>Packages featured with Inference for R</title><content type="html">&lt;a href="http://r-forge.r-project.org/projects/quantmod/"&gt;quantmod&lt;/a&gt;, &lt;a href="http://r-forge.r-project.org/projects/ttr/"&gt;TTR&lt;/a&gt;, and &lt;a href="http://r-forge.r-project.org/projects/xts/"&gt;xts&lt;/a&gt; were (not so) recently featured on the &lt;a href="http://inferenceforr.com/blog/default.aspx"&gt;Inference for R Blog&lt;/a&gt;.  &lt;a href="http://inferenceforr.com/default.aspx"&gt;Inference for R&lt;/a&gt; is a Integrated Development Environment (IDE) designed specifically for &lt;a href="http://www.r-project.org/"&gt;R&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://inferenceforr.com/blog/Lists/Posts/Post.aspx?ID=17"&gt;The post&lt;/a&gt; gives an example of how to easily perform advanced financial stock analysis using Inference in Excel.&lt;br /&gt;&lt;br /&gt;I appreciate how they're making &lt;a href="http://www.r-project.org/"&gt;R&lt;/a&gt; more accessible to a general audience, even though I like a command line interface and my preferred development environment is &lt;a href="http://www.vim.org"&gt;vim&lt;/a&gt;. :-)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5815834906618132494-2686191558762893458?l=blog.fosstrading.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/QLwGTG12DSd6C5m_Z3ZbOU64fms/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/QLwGTG12DSd6C5m_Z3ZbOU64fms/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/QLwGTG12DSd6C5m_Z3ZbOU64fms/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/QLwGTG12DSd6C5m_Z3ZbOU64fms/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/FossTrading?a=7o6eJ_3tL2M:Ai5WgVkEgBw:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FossTrading?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FossTrading?a=7o6eJ_3tL2M:Ai5WgVkEgBw:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FossTrading?i=7o6eJ_3tL2M:Ai5WgVkEgBw:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FossTrading?a=7o6eJ_3tL2M:Ai5WgVkEgBw:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FossTrading?i=7o6eJ_3tL2M:Ai5WgVkEgBw:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FossTrading?a=7o6eJ_3tL2M:Ai5WgVkEgBw:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FossTrading?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FossTrading?a=7o6eJ_3tL2M:Ai5WgVkEgBw:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FossTrading?i=7o6eJ_3tL2M:Ai5WgVkEgBw:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/FossTrading/~4/7o6eJ_3tL2M" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.fosstrading.com/feeds/2686191558762893458/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=5815834906618132494&amp;postID=2686191558762893458" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5815834906618132494/posts/default/2686191558762893458?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5815834906618132494/posts/default/2686191558762893458?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/FossTrading/~3/7o6eJ_3tL2M/packages-featured-with-inference-for-r.html" title="Packages featured with Inference for R" /><author><name>Joshua Ulrich</name><uri>http://www.blogger.com/profile/16641971932645230429</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="12731449228814218421" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://blog.fosstrading.com/2009/05/packages-featured-with-inference-for-r.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkEDR3szfyp7ImA9WxJSFEg.&quot;"><id>tag:blogger.com,1999:blog-5815834906618132494.post-857360997083243543</id><published>2009-05-04T10:21:00.002-05:00</published><updated>2009-05-04T10:24:36.587-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-05-04T10:24:36.587-05:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Events" /><title>R/Finance 2009 Presentations Online</title><content type="html">Posted to the R-SIG-Finance mailing list today:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;For those who missed it, the slides for the R/Finance 2009 tutorials&lt;br /&gt;and presentations are now available on RinFinance.com&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.RinFinance.com/presentations"&gt;http://www.RinFinance.com/presentations&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;We want to thank everyone who traveled to Chicago to make this happen.  With nearly 200 attendees, coming from 8 countries and 20+ states in the US, the conference exceeded all of our expectations.  A very big thank you to our presenters for taking the time to join us, UIC's International Center for Futures and Derivatives for hosting the event, and our sponsors REvolution Computing and Microsoft for their support.&lt;br /&gt;&lt;br /&gt;We look forward to doing it again in the future.  Stay tuned...&lt;br /&gt;&lt;br /&gt;On behalf of the committee and sponsors.&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5815834906618132494-857360997083243543?l=blog.fosstrading.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/2FqwYl_7SRHFBp1kNko95_PkpNw/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/2FqwYl_7SRHFBp1kNko95_PkpNw/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/2FqwYl_7SRHFBp1kNko95_PkpNw/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/2FqwYl_7SRHFBp1kNko95_PkpNw/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/FossTrading?a=VDlWd0Nfbhs:1uy9b9biP0Y:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FossTrading?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FossTrading?a=VDlWd0Nfbhs:1uy9b9biP0Y:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FossTrading?i=VDlWd0Nfbhs:1uy9b9biP0Y:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FossTrading?a=VDlWd0Nfbhs:1uy9b9biP0Y:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FossTrading?i=VDlWd0Nfbhs:1uy9b9biP0Y:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FossTrading?a=VDlWd0Nfbhs:1uy9b9biP0Y:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FossTrading?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FossTrading?a=VDlWd0Nfbhs:1uy9b9biP0Y:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FossTrading?i=VDlWd0Nfbhs:1uy9b9biP0Y:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/FossTrading/~4/VDlWd0Nfbhs" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.fosstrading.com/feeds/857360997083243543/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=5815834906618132494&amp;postID=857360997083243543" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5815834906618132494/posts/default/857360997083243543?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5815834906618132494/posts/default/857360997083243543?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/FossTrading/~3/VDlWd0Nfbhs/rfinance-2009-presentations-online.html" title="R/Finance 2009 Presentations Online" /><author><name>Joshua Ulrich</name><uri>http://www.blogger.com/profile/16641971932645230429</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="12731449228814218421" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://blog.fosstrading.com/2009/05/rfinance-2009-presentations-online.html</feedburner:origLink></entry><entry gd:etag="W/&quot;Ck8ARXo4fSp7ImA9WxJSEkk.&quot;"><id>tag:blogger.com,1999:blog-5815834906618132494.post-7875282317638300993</id><published>2009-05-01T20:58:00.010-05:00</published><updated>2009-05-02T00:07:24.435-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-05-02T00:07:24.435-05:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Examples" /><category scheme="http://www.blogger.com/atom/ns#" term="Code" /><title>RSI(2) with Position Sizing</title><content type="html">Though it's more than two weeks later, here's the second post in the series that will demonstrate how to build, test, and implement a trading strategy with &lt;a href="http://www.r-project.org/"&gt;R&lt;/a&gt;.  You can find the first post &lt;a href="http://blog.fosstrading.com/2009/04/testing-rsi2-with-r.html"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;The first post replicated this &lt;a href="http://marketsci.wordpress.com/2008/12/09/trading-with-rsi2/"&gt;simple RSI(2) strategy&lt;/a&gt; from the &lt;a href="http://marketsci.wordpress.com/"&gt;MarketSci Blog&lt;/a&gt;.  This second post will demonstrate how to replicate &lt;a href="http://marketsci.wordpress.com/2008/12/14/trading-strategy-scaling-inout-of-rsi2/"&gt;this strategy&lt;/a&gt; that scales in/out of RSI(2).&lt;br /&gt;&lt;br /&gt;A couple notes before moving to the code:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;The rsi2pos() function isn't &lt;i&gt;necessary&lt;/i&gt;, but it provides an example of how to define a function.  Plus, it enables us to test several ideas with much greater speed and flexibility.&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;The ifelse() function works on entire vectors at once, avoiding costly loops (loops are costly in R because it's an interpreted language).  Since we can potentially modify the entire 'size' vector, we must be mindful of the order of the tests.&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;On to the code!&lt;br /&gt;&lt;blockquote style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;# Attach the quantmod and TTR packages.&lt;br /&gt;# You can install packages via:&lt;br /&gt;# install.packages(c("quantmod","TTR"))&lt;br /&gt;library(quantmod)&lt;br /&gt;library(TTR)&lt;br /&gt;&lt;br /&gt;# Pull S&amp;P500 index data from Yahoo! Finance&lt;br /&gt;getSymbols("^GSPC", from="2000-01-01", to="2008-12-07")&lt;br /&gt;&lt;br /&gt;# Calculate the RSI indicator&lt;br /&gt;rsi &lt;- RSI(Cl(GSPC),2)&lt;br /&gt;&lt;br /&gt;# Calculate Close-to-Close returns&lt;br /&gt;# (this assumes we open/close our positions&lt;br /&gt;# at each day's close)&lt;br /&gt;ret &lt;- ROC(Cl(GSPC))&lt;br /&gt;ret[1] &lt;- 0&lt;br /&gt;&lt;br /&gt;# Define our position-sizing function&lt;br /&gt;rsi2pos &lt;- function(ind, indIncr=5, posIncr=0.25) {&lt;br /&gt;  # Inputs:&lt;br /&gt;  # ind     : indicator vector&lt;br /&gt;  # indIncr : indicator value increments/breakpoints&lt;br /&gt;  # posIncr : position value increments/breakpoints&lt;br /&gt;&lt;br /&gt;  # Initialize result vector&lt;br /&gt;  size &lt;- rep(0,NROW(ind))&lt;br /&gt;  &lt;br /&gt;  # Long&lt;br /&gt;  size &lt;- ifelse(ind &lt; 4*indIncr, (1-posIncr*3), size)&lt;br /&gt;  size &lt;- ifelse(ind &lt; 3*indIncr, (1-posIncr*2), size)&lt;br /&gt;  size &lt;- ifelse(ind &lt; 2*indIncr, (1-posIncr*1), size)&lt;br /&gt;  size &lt;- ifelse(ind &lt; 1*indIncr, (1-posIncr*0), size)&lt;br /&gt;&lt;br /&gt;  # Short&lt;br /&gt;  size &lt;- ifelse(ind &gt; 100-4*indIncr, 3*posIncr-1, size)&lt;br /&gt;  size &lt;- ifelse(ind &gt; 100-3*indIncr, 2*posIncr-1, size)&lt;br /&gt;  size &lt;- ifelse(ind &gt; 100-2*indIncr, 1*posIncr-1, size)&lt;br /&gt;  size &lt;- ifelse(ind &gt; 100-1*indIncr, 0*posIncr-1, size)&lt;br /&gt;&lt;br /&gt;  # Today's position ('size') is based on today's&lt;br /&gt;  # indicator, but we need to apply today's position&lt;br /&gt;  # to the Close-to-Close return at tomorrow's close.&lt;br /&gt;  size &lt;- lag(size)&lt;br /&gt;  &lt;br /&gt;  # Replace missing signals with no position&lt;br /&gt;  # (generally just at beginning of series)&lt;br /&gt;  size[is.na(size)] &lt;- 0&lt;br /&gt;&lt;br /&gt;  # Return results&lt;br /&gt;  return(size)&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;# Calculate signals using the 'rsi2pos()' function&lt;br /&gt;sig &lt;- rsi2pos(rsi, 5, 0.25)&lt;br /&gt;&lt;br /&gt;# Break out the long (up) and short (dn) signals&lt;br /&gt;sigup &lt;- ifelse(sig &gt; 0, sig, 0)&lt;br /&gt;sigdn &lt;- ifelse(sig &lt; 0, sig, 0)&lt;br /&gt;&lt;br /&gt;# Calculate equity curves&lt;br /&gt;eq_up  &lt;- cumprod(1+ret*sigup)&lt;br /&gt;eq_dn  &lt;- cumprod(1+ret*sigdn)&lt;br /&gt;eq_all &lt;- cumprod(1+ret*sig)&lt;br /&gt;&lt;br /&gt;# Replicate Michael's nice chart (again)&lt;br /&gt;png(filename="20090430_rsi2_replication.png")&lt;br /&gt;plot.zoo( cbind(eq_up, eq_dn), plot.type="single",&lt;br /&gt;  ylab=c("Long","Short"), col=c("green","red"),&lt;br /&gt;  main="RSI(2) Strategy, with Position Scaling:\n 2000-01-03 through 2008-12-07" )&lt;br /&gt;dev.off()&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_8iehP8a8rkE/Sfu9TdIwbsI/AAAAAAAAAFw/XWZ3pQGHdlQ/s1600-h/20090501_rsi2_replication.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 400px;" src="http://3.bp.blogspot.com/_8iehP8a8rkE/Sfu9TdIwbsI/AAAAAAAAAFw/XWZ3pQGHdlQ/s400/20090501_rsi2_replication.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5331062725859634882" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;blockquote style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;# Calculate signals using the 'rsi2pos()' function&lt;br /&gt;# with new values&lt;br /&gt;sig &lt;- rsi2pos(rsi, 10, 0.3)&lt;br /&gt;&lt;br /&gt;# Break out the long (up) and short (dn) signals&lt;br /&gt;sigup &lt;- ifelse(sig &gt; 0, sig, 0)&lt;br /&gt;sigdn &lt;- ifelse(sig &lt; 0, sig, 0)&lt;br /&gt;&lt;br /&gt;# Calculate equity curves&lt;br /&gt;eq_up  &lt;- cumprod(1+ret*sigup)&lt;br /&gt;eq_dn  &lt;- cumprod(1+ret*sigdn)&lt;br /&gt;eq_all &lt;- cumprod(1+ret*sig)&lt;br /&gt;&lt;br /&gt;# Re-plot equity curves using updated values&lt;br /&gt;png(filename="20090501_rsi2_updated.png")&lt;br /&gt;plot.zoo( cbind(eq_up, eq_dn), plot.type="single",&lt;br /&gt;  ylab=c("Long","Short"), col=c("green","red"),&lt;br /&gt;  main="Updated RSI(2) Strategy, with Position Scaling:\n 2000-01-03 through 2008-12-07" )&lt;br /&gt;dev.off()&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_8iehP8a8rkE/Sfu-I3e_0SI/AAAAAAAAAGI/c4XOAzKk56g/s1600-h/20090501_rsi2_updated.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 400px;" src="http://4.bp.blogspot.com/_8iehP8a8rkE/Sfu-I3e_0SI/AAAAAAAAAGI/c4XOAzKk56g/s400/20090501_rsi2_updated.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5331063643465306402" /&gt;&lt;/a&gt;&lt;br /&gt;Visual inspection of the charts seems to indicate the updated RSI(2) strategy has slightly higher returns,  but more volatility and larger drawdowns.  The next post will use the &lt;a href="http://cran.r-project.org/web/packages/PerformanceAnalytics/index.html"&gt;PerformanceAnalytics&lt;/a&gt; package to evaluate the volatility, drawdowns, and related metrics associated with these strategies.  I will do my best to post it less than two weeks from now!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5815834906618132494-7875282317638300993?l=blog.fosstrading.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/VkVCcRXoIPfgK8jnMo7hayjyzsc/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/VkVCcRXoIPfgK8jnMo7hayjyzsc/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/VkVCcRXoIPfgK8jnMo7hayjyzsc/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/VkVCcRXoIPfgK8jnMo7hayjyzsc/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/FossTrading?a=omYutD_yek8:Grp2PXD45D8:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FossTrading?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FossTrading?a=omYutD_yek8:Grp2PXD45D8:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FossTrading?i=omYutD_yek8:Grp2PXD45D8:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FossTrading?a=omYutD_yek8:Grp2PXD45D8:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FossTrading?i=omYutD_yek8:Grp2PXD45D8:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FossTrading?a=omYutD_yek8:Grp2PXD45D8:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FossTrading?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FossTrading?a=omYutD_yek8:Grp2PXD45D8:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FossTrading?i=omYutD_yek8:Grp2PXD45D8:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/FossTrading/~4/omYutD_yek8" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.fosstrading.com/feeds/7875282317638300993/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=5815834906618132494&amp;postID=7875282317638300993" title="6 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5815834906618132494/posts/default/7875282317638300993?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5815834906618132494/posts/default/7875282317638300993?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/FossTrading/~3/omYutD_yek8/rsi2-with-position-sizing.html" title="RSI(2) with Position Sizing" /><author><name>Joshua Ulrich</name><uri>http://www.blogger.com/profile/16641971932645230429</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="12731449228814218421" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/_8iehP8a8rkE/Sfu9TdIwbsI/AAAAAAAAAFw/XWZ3pQGHdlQ/s72-c/20090501_rsi2_replication.png" height="72" width="72" /><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">6</thr:total><feedburner:origLink>http://blog.fosstrading.com/2009/05/rsi2-with-position-sizing.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0QBSHc7eSp7ImA9WxJTGU8.&quot;"><id>tag:blogger.com,1999:blog-5815834906618132494.post-7527749875150330056</id><published>2009-04-28T09:26:00.004-05:00</published><updated>2009-04-28T09:35:59.901-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-04-28T09:35:59.901-05:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Events" /><title>R/Finance 2009 Overview</title><content type="html">The first international R/Finance 2009 conference in Chicago, IL was a huge success!  David Smith from &lt;a href="http://www.revolution-computing.com/"&gt;REvolution Computing&lt;/a&gt; has written &lt;a href="http://blog.revolution-computing.com/2009/04/rfinance-2009-roundup.html"&gt;a great summary&lt;/a&gt; of the entire event.  I'll take the lazy route and point you to his blog post. :)&lt;br /&gt;&lt;blockquote&gt;The first international conference dedicated to the use of R in the finance industry, &lt;a href="http://www.rinfinance.com/"&gt;R/Finance 2009&lt;/a&gt;, was a great success. With over 150 attendees (my poor &lt;a href="http://twitter.com/revodavid/status/1606990522"&gt;estimation&lt;/a&gt; skills notwithstanding), sold-out tutorials, and an outstanding lineup of invited and contributing speakers from around the world, this event really demonstrated the importance of &lt;a href="http://www.revolution-computing.com/industry/finance.php"&gt;R in the world of financial analysis&lt;/a&gt;.&lt;/blockquote&gt;&lt;br /&gt;Source:&lt;br /&gt;&lt;a href="http://blog.revolution-computing.com/2009/04/rfinance-2009-roundup.html"&gt;R/Finance 2009 roundup&lt;/a&gt;&lt;br /&gt;David Smith&lt;br /&gt;&lt;a href="http://blog.revolution-computing.com/"&gt;Revolutions&lt;/a&gt;, 4/27/2009&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5815834906618132494-7527749875150330056?l=blog.fosstrading.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/EpmrvuLW38eN5wWcM3cSA-IMgrw/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/EpmrvuLW38eN5wWcM3cSA-IMgrw/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/EpmrvuLW38eN5wWcM3cSA-IMgrw/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/EpmrvuLW38eN5wWcM3cSA-IMgrw/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/FossTrading?a=mdBDXTSE4Eo:LsFLqhDbXAU:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FossTrading?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FossTrading?a=mdBDXTSE4Eo:LsFLqhDbXAU:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FossTrading?i=mdBDXTSE4Eo:LsFLqhDbXAU:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FossTrading?a=mdBDXTSE4Eo:LsFLqhDbXAU:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FossTrading?i=mdBDXTSE4Eo:LsFLqhDbXAU:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FossTrading?a=mdBDXTSE4Eo:LsFLqhDbXAU:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FossTrading?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FossTrading?a=mdBDXTSE4Eo:LsFLqhDbXAU:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FossTrading?i=mdBDXTSE4Eo:LsFLqhDbXAU:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/FossTrading/~4/mdBDXTSE4Eo" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.fosstrading.com/feeds/7527749875150330056/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=5815834906618132494&amp;postID=7527749875150330056" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5815834906618132494/posts/default/7527749875150330056?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5815834906618132494/posts/default/7527749875150330056?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/FossTrading/~3/mdBDXTSE4Eo/rfinance-2009-overview.html" title="R/Finance 2009 Overview" /><author><name>Joshua Ulrich</name><uri>http://www.blogger.com/profile/16641971932645230429</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="12731449228814218421" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://blog.fosstrading.com/2009/04/rfinance-2009-overview.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0MCRHoyfSp7ImA9WxNUFEs.&quot;"><id>tag:blogger.com,1999:blog-5815834906618132494.post-7501983836621965551</id><published>2009-04-17T14:46:00.003-05:00</published><updated>2009-11-05T19:04:25.495-06:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-11-05T19:04:25.495-06:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Data" /><title>opentick is no more</title><content type="html">After a year of "we plan to accept new subscribers shortly", &lt;a href="http://www.opentick.com/"&gt;opentick&lt;/a&gt; has shut its doors completely.  As of March 20th, the opentick service is no longer available.&lt;br /&gt;&lt;br /&gt;From &lt;a href="http://www.opentick.com/"&gt;opentick.com&lt;/a&gt;:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;3/16/2009&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;To opentick subscribers, friends, supporters, contributors and the rest of the community...&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;It has been quite a journey for opentick, and for those of you who have been with us for the ride we cannot thank you enough for the support, contributions and guidance you have given us over the course of the last 5 years. We could not have come as far as we have without you.&lt;br /&gt;&lt;br /&gt;However, we are sad to say that the time has come for us to close the doors for opentick. However, this isn't goodbye. In fact, it's a new beginning. We will be introducing a fresh service with all the bells and whistles we've been slaving on over the course of the last year under a new name, a new website and a new level of service. Check back here in the near future for more information about the forthcoming new company and service. Of course amongst all these changes, there are some things that will remain the same - we still aim to provide a reliable free market data service, with an open architecture for a wide range of software platform support.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;If you are a current paying subscriber, this March billing cycle will be your final billing cycle; at your next billing date service will be terminated. If you are a delayed or historical data user not currently paying for service, your account will be deactivated as of Friday, March 20th.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Sincerely,&lt;br /&gt;opentick Staff&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;One day, we shall come back. Yes, we shall come back. Until then, there must be no regrets, no tears, no anxieties. Just go forward in all your beliefs, and prove to us we are not mistaken in ours.&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;I'm not optimistic their new offering (most likely their sister company, &lt;a href="http://www.xasax.com/"&gt;Xasax&lt;/a&gt;) will be available anytime soon.  The managers of the two companies sub-optimally managed expectations with opentick and potential Xasax customers are sure to keep that in mind.&lt;br /&gt;&lt;br /&gt;At least I learned quite a bit creating the 'opentick' package, since it is now useless... perhaps Xasax will have a similar API, but I won't get my hopes up.&lt;br /&gt;&lt;br /&gt;Related Posts:&lt;br /&gt;&lt;a href="http://blog.fosstrading.com/2009/10/xasax-closes-shop.html"&gt;Xasax closes shop&lt;/a&gt;&lt;br /&gt;&lt;a href="http://blog.fosstrading.com/2009/11/opentick-alternatives.html"&gt;opentick alternatives&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5815834906618132494-7501983836621965551?l=blog.fosstrading.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/bkwR7amBSKSHQLfl7qa6qpUAHwE/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/bkwR7amBSKSHQLfl7qa6qpUAHwE/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/bkwR7amBSKSHQLfl7qa6qpUAHwE/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/bkwR7amBSKSHQLfl7qa6qpUAHwE/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/FossTrading?a=66sR6b1RBik:jJBBd0dJOOk:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FossTrading?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FossTrading?a=66sR6b1RBik:jJBBd0dJOOk:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FossTrading?i=66sR6b1RBik:jJBBd0dJOOk:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FossTrading?a=66sR6b1RBik:jJBBd0dJOOk:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FossTrading?i=66sR6b1RBik:jJBBd0dJOOk:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FossTrading?a=66sR6b1RBik:jJBBd0dJOOk:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FossTrading?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FossTrading?a=66sR6b1RBik:jJBBd0dJOOk:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FossTrading?i=66sR6b1RBik:jJBBd0dJOOk:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/FossTrading/~4/66sR6b1RBik" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.fosstrading.com/feeds/7501983836621965551/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=5815834906618132494&amp;postID=7501983836621965551" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5815834906618132494/posts/default/7501983836621965551?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5815834906618132494/posts/default/7501983836621965551?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/FossTrading/~3/66sR6b1RBik/opentick-is-no-more.html" title="opentick is no more" /><author><name>Joshua Ulrich</name><uri>http://www.blogger.com/profile/16641971932645230429</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="12731449228814218421" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">2</thr:total><feedburner:origLink>http://blog.fosstrading.com/2009/04/opentick-is-no-more.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUMASHo9fip7ImA9WxJTEU0.&quot;"><id>tag:blogger.com,1999:blog-5815834906618132494.post-5363003943111435813</id><published>2009-04-13T22:35:00.001-05:00</published><updated>2009-04-18T21:17:29.466-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-04-18T21:17:29.466-05:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Examples" /><category scheme="http://www.blogger.com/atom/ns#" term="Code" /><title>Testing RSI(2) with R, First Steps</title><content type="html">This is the first of a series of posts that will demonstrate how to build, test, and implement a trading strategy using my favorite FOSS, &lt;a href="http://www.r-project.org/"&gt;R&lt;/a&gt;.  I chose the RSI(2) strategy because it has gotten considerable attention on trading blogs over the past 6 months.&lt;br /&gt;&lt;br /&gt;In particular, I will be replicating and extending some of the results from Michael Stokes' excellent &lt;a href="http://marketsci.wordpress.com/"&gt;MarketSci Blog&lt;/a&gt;.  This post will focus on replicating &lt;a href="http://marketsci.wordpress.com/2008/12/09/trading-with-rsi2/"&gt;this simple RSI(2) strategy&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Without further ado, let's get to some code...&lt;br /&gt;&lt;blockquote  style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;# We will need the quantmod package for charting and pulling&lt;br /&gt;# data and the TTR package to calculate RSI(2).&lt;br /&gt;# You can install packages via: install.packages("packageName")&lt;br /&gt;# install.packages(c("quantmod","TTR"))&lt;br /&gt;library(quantmod)&lt;br /&gt;library(TTR)&lt;br /&gt;&lt;br /&gt;# Pull S&amp;amp;P500 index data from Yahoo! Finance&lt;br /&gt;getSymbols("^GSPC", from="2000-01-01", to="2008-12-07")&lt;br /&gt;&lt;br /&gt;# Calculate the RSI indicator&lt;br /&gt;rsi &lt;- RSI(Cl(GSPC),2)&lt;br /&gt;&lt;br /&gt;# Create the long (up) and short (dn) signals&lt;br /&gt;sigup &lt;- ifelse(rsi &lt; 10, 1, 0)&lt;br /&gt;sigdn &lt;- ifelse(rsi &gt; 90, -1, 0)&lt;br /&gt;&lt;br /&gt;# Lag signals to align with days in market,&lt;br /&gt;# not days signals were generated&lt;br /&gt;#sigup &lt;- Lag(sigup,1)  # Use lag() to avoid Toby's error&lt;br /&gt;#sigdn &lt;- Lag(sigdn,1)  # Use lag() to avoid Toby's error&lt;br /&gt;sigup &lt;- lag(sigup,1)  # Note k=1 implies a move *forward*&lt;br /&gt;sigdn &lt;- lag(sigdn,1)  # Note k=1 implies a move *forward*&lt;br /&gt;&lt;br /&gt;# Replace missing signals with no position&lt;br /&gt;# (generally just at beginning of series)&lt;br /&gt;sigup[is.na(sigup)] &lt;- 0&lt;br /&gt;sigdn[is.na(sigdn)] &lt;- 0&lt;br /&gt;&lt;br /&gt;# Combine both signals into one vector&lt;br /&gt;sig &lt;- sigup + sigdn&lt;br /&gt;&lt;br /&gt;# Calculate Close-to-Close returns&lt;br /&gt;ret &lt;- ROC(Cl(GSPC))&lt;br /&gt;ret[1] &lt;- 0&lt;br /&gt;&lt;br /&gt;# Calculate equity curves&lt;br /&gt;eq_up &lt;- cumprod(1+ret*sigup)&lt;br /&gt;eq_dn &lt;- cumprod(1+ret*sigdn*-1)&lt;br /&gt;eq_all &lt;- cumprod(1+ret*sig)&lt;br /&gt;&lt;br /&gt;# Replicate Michael's nice chart&lt;br /&gt;plot.zoo( cbind(eq_up, eq_dn),&lt;br /&gt;ylab=c("Long","Short"), col=c("green","red"),&lt;br /&gt;main="Simple RSI(2) Strategy: 2000-01-02 through 2008-12-07" )&lt;br /&gt;&lt;br /&gt;# Wait a few seconds before making next chart...&lt;br /&gt;#Sys.sleep(5)&lt;br /&gt;&lt;br /&gt;# Create a chart showing the S&amp;amp;P500&lt;br /&gt;#chartSeries(GSPC, type="line")&lt;br /&gt;&lt;br /&gt;# Add the total equity line&lt;br /&gt;#addTA(eq_all)&lt;br /&gt;&lt;/span&gt;&lt;/blockquote&gt;My version of Michael's chart is below.  Up next, scaling in/out of positions with RSI(2).&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_8iehP8a8rkE/SeQUBhHOk3I/AAAAAAAAAFo/nGn5pkD_8Lg/s1600-h/20090413_rsi2_long_short.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 400px;" src="http://3.bp.blogspot.com/_8iehP8a8rkE/SeQUBhHOk3I/AAAAAAAAAFo/nGn5pkD_8Lg/s400/20090413_rsi2_long_short.png" alt="" id="BLOGGER_PHOTO_ID_5324402675759879026" border="0" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5815834906618132494-5363003943111435813?l=blog.fosstrading.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/gn3NVGJFTEb6b9AerS2tmNkGa1U/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/gn3NVGJFTEb6b9AerS2tmNkGa1U/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/gn3NVGJFTEb6b9AerS2tmNkGa1U/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/gn3NVGJFTEb6b9AerS2tmNkGa1U/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/FossTrading?a=gLJ3QL8_Ar8:rruftCb0vGI:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FossTrading?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FossTrading?a=gLJ3QL8_Ar8:rruftCb0vGI:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FossTrading?i=gLJ3QL8_Ar8:rruftCb0vGI:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FossTrading?a=gLJ3QL8_Ar8:rruftCb0vGI:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FossTrading?i=gLJ3QL8_Ar8:rruftCb0vGI:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FossTrading?a=gLJ3QL8_Ar8:rruftCb0vGI:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FossTrading?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FossTrading?a=gLJ3QL8_Ar8:rruftCb0vGI:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FossTrading?i=gLJ3QL8_Ar8:rruftCb0vGI:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/FossTrading/~4/gLJ3QL8_Ar8" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.fosstrading.com/feeds/5363003943111435813/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=5815834906618132494&amp;postID=5363003943111435813" title="11 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5815834906618132494/posts/default/5363003943111435813?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5815834906618132494/posts/default/5363003943111435813?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/FossTrading/~3/gLJ3QL8_Ar8/testing-rsi2-with-r.html" title="Testing RSI(2) with R, First Steps" /><author><name>Joshua Ulrich</name><uri>http://www.blogger.com/profile/16641971932645230429</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="12731449228814218421" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/_8iehP8a8rkE/SeQUBhHOk3I/AAAAAAAAAFo/nGn5pkD_8Lg/s72-c/20090413_rsi2_long_short.png" height="72" width="72" /><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">11</thr:total><feedburner:origLink>http://blog.fosstrading.com/2009/04/testing-rsi2-with-r.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0EHSHgyfCp7ImA9WxVWE08.&quot;"><id>tag:blogger.com,1999:blog-5815834906618132494.post-2242536125998867987</id><published>2009-02-20T12:20:00.000-06:00</published><updated>2009-02-22T12:00:39.694-06:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-02-22T12:00:39.694-06:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Events" /><title>Registration for R/Finance 2009 is Open!</title><content type="html">The &lt;a href="http://rinfinance.quantmod.com/"&gt;conference website&lt;/a&gt; has details on:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;the &lt;a href="http://rinfinance.quantmod.com/agenda"&gt;agenda&lt;/a&gt; and &lt;a href="http://rinfinance.quantmod.com/speakers"&gt;speakers&lt;/a&gt;,&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://rinfinance.quantmod.com/travel"&gt;travel accommodations&lt;/a&gt;,&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://rinfinance.quantmod.com/register/"&gt;registration&lt;/a&gt;, and&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://rinfinance.quantmod.com/sponsors"&gt;sponsors&lt;/a&gt;, who made the conference possible.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;Hope to see you there!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5815834906618132494-2242536125998867987?l=blog.fosstrading.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/R80NdchkRM5to0R96w81eweXyAY/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/R80NdchkRM5to0R96w81eweXyAY/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/R80NdchkRM5to0R96w81eweXyAY/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/R80NdchkRM5to0R96w81eweXyAY/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~f/FossTrading?a=FRgAQH97"&gt;&lt;img src="http://feeds.feedburner.com/~f/FossTrading?d=41" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/FossTrading?a=LJuJDR0c"&gt;&lt;img src="http://feeds.feedburner.com/~f/FossTrading?i=LJuJDR0c" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/FossTrading?a=MIgzcebC"&gt;&lt;img src="http://feeds.feedburner.com/~f/FossTrading?i=MIgzcebC" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/FossTrading?a=N3wC4tZt"&gt;&lt;img src="http://feeds.feedburner.com/~f/FossTrading?d=52" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/FossTrading?a=yFTvdcOh"&gt;&lt;img src="http://feeds.feedburner.com/~f/FossTrading?i=yFTvdcOh" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/FossTrading/~4/J0Qlf6j8oh0" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.fosstrading.com/feeds/2242536125998867987/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=5815834906618132494&amp;postID=2242536125998867987" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5815834906618132494/posts/default/2242536125998867987?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5815834906618132494/posts/default/2242536125998867987?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/FossTrading/~3/J0Qlf6j8oh0/registration-for-r-finance-2009-is-open.html" title="Registration for R/Finance 2009 is Open!" /><author><name>Joshua Ulrich</name><uri>http://www.blogger.com/profile/16641971932645230429</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="12731449228814218421" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://blog.fosstrading.com/2009/02/registration-for-r-finance-2009-is-open.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0IARnw4fSp7ImA9WxVXF0k.&quot;"><id>tag:blogger.com,1999:blog-5815834906618132494.post-3125543071755701083</id><published>2009-02-15T18:51:00.000-06:00</published><updated>2009-02-15T18:52:27.235-06:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-02-15T18:52:27.235-06:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="TTR" /><category scheme="http://www.blogger.com/atom/ns#" term="Releases" /><title>TTR_0.2 on CRAN</title><content type="html">I am happy to announce a long-overdue update to the TTR package (version 0.2) is now on CRAN.&lt;br /&gt;&lt;br /&gt;This update represents a major milestone, as TTR useRs are no longer restricted to using matrix objects.  TTR 0.2 uses xts internally, so all major time series classes are now supported.&lt;br /&gt;&lt;br /&gt;NEW FEATURES:&lt;br /&gt;&lt;br /&gt;- Added the zig zag indicator: ZigZag()&lt;br /&gt;&lt;br /&gt;- Added volatility estimators/indicators: volatility(), with the following calculations&lt;br /&gt;  - Close-to-Close&lt;br /&gt;  - Garman Klass&lt;br /&gt;  - Parkinson&lt;br /&gt;  - Rogers Satchell&lt;br /&gt;&lt;br /&gt;- Added Money Flow Index: MFI()&lt;br /&gt;&lt;br /&gt;- Added Donchian channel: DonchianChannel()&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;CHANGES:&lt;br /&gt;&lt;br /&gt;- All functions now use xts internally, adding support for all major time series classes.  If try.xts() fails on the input object(s), they will be converted to a matrix and a matrix object will be returned.&lt;br /&gt;&lt;br /&gt;- Added 'bounded' arg to stoch() and SMI(), which includes the current period in the calculation.&lt;br /&gt;&lt;br /&gt;- Added naCheck() and implemented it in the moving average functions.&lt;br /&gt;&lt;br /&gt;- Moved maType argument default values from function formals to function body for the following functions:&lt;br /&gt;    ADX, ATR, CCI, DPO, EMV, KST, MACD, RSI, TRIX, BBands, chaikinVolatility, stoch, SMI&lt;br /&gt;&lt;br /&gt;- momentum() in CMO() no longer sets na=100&lt;br /&gt;&lt;br /&gt;- Replaced 'na' argument in momentum() and ROC() with 'na.pad'&lt;br /&gt;&lt;br /&gt;- Added 'multiple' argument to TDI(), allowing more user control&lt;br /&gt;&lt;br /&gt;- getYahooData() now returns an xts object&lt;br /&gt;&lt;br /&gt;- Added colnames to output for ADX, EMV, and CLV (for xts)&lt;br /&gt;&lt;br /&gt;- Added unit tests using the RUnit package&lt;br /&gt;  - Used checkEquals on object attributes as well as values&lt;br /&gt;&lt;br /&gt;- Removed .First.lib function and added .onLoad with package version.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;BUG FIXES:&lt;br /&gt;&lt;br /&gt;- Corrected NaN replacement in CLV()&lt;br /&gt;&lt;br /&gt;- Corrected williamsAD(): AD=0 if C(t)=C(t-1)&lt;br /&gt;&lt;br /&gt;- Corrected runMedian() and runMAD().  The argument controlling which type of median to calculate for even-numbered samples wasn't being passed to the Fortran routine.&lt;br /&gt;&lt;br /&gt;- aroon() calculation starts at period n+1, instead of n&lt;br /&gt;&lt;br /&gt;- Added NA to first element of closeLag of ATR()&lt;br /&gt;&lt;br /&gt;- Corrected BBands() and CCI() for rowMeans use on xts objects&lt;br /&gt;&lt;br /&gt;- Made changes to Rd files to pass R CMD check on R-devel (2.9.0)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Please do contact me with any questions, concerns, bug reports, etc.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5815834906618132494-3125543071755701083?l=blog.fosstrading.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/jgYWQzvhfOeXShiLs3aajzLE_uw/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/jgYWQzvhfOeXShiLs3aajzLE_uw/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/jgYWQzvhfOeXShiLs3aajzLE_uw/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/jgYWQzvhfOeXShiLs3aajzLE_uw/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~f/FossTrading?a=nh9uZ1O2"&gt;&lt;img src="http://feeds.feedburner.com/~f/FossTrading?d=41" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/FossTrading?a=UkNmffTS"&gt;&lt;img src="http://feeds.feedburner.com/~f/FossTrading?i=UkNmffTS" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/FossTrading?a=AXnmHVFQ"&gt;&lt;img src="http://feeds.feedburner.com/~f/FossTrading?i=AXnmHVFQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/FossTrading?a=QDW36Xny"&gt;&lt;img src="http://feeds.feedburner.com/~f/FossTrading?d=52" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/FossTrading?a=kYZZ9qkE"&gt;&lt;img src="http://feeds.feedburner.com/~f/FossTrading?i=kYZZ9qkE" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/FossTrading/~4/5gY-DN2vpg4" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.fosstrading.com/feeds/3125543071755701083/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=5815834906618132494&amp;postID=3125543071755701083" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5815834906618132494/posts/default/3125543071755701083?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5815834906618132494/posts/default/3125543071755701083?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/FossTrading/~3/5gY-DN2vpg4/ttr02-on-cran.html" title="TTR_0.2 on CRAN" /><author><name>Joshua Ulrich</name><uri>http://www.blogger.com/profile/16641971932645230429</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="12731449228814218421" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://blog.fosstrading.com/2009/02/ttr02-on-cran.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0IDQ3w5eip7ImA9WxVXF0k.&quot;"><id>tag:blogger.com,1999:blog-5815834906618132494.post-5733687255507448996</id><published>2009-01-17T09:01:00.000-06:00</published><updated>2009-02-15T18:52:52.222-06:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-02-15T18:52:52.222-06:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="IBrokers" /><title>IBrokers Featured on Quantitative Trading</title><content type="html">Jeff Ryan's IBrokers package was mentioned on Ernie Chan's blog, &lt;a href="http://epchan.blogspot.com/"&gt;Quantitative Trading&lt;/a&gt;.  Though the package is still in &lt;span style="font-style: italic;"&gt;pre-alpha&lt;/span&gt; stage, it is generating quite a bit of interest.&lt;br /&gt;&lt;br /&gt;Source:&lt;br /&gt;Ernie Chan&lt;br /&gt;Friday, January 16, 2009&lt;br /&gt;&lt;a href="http://epchan.blogspot.com/2009/01/algorithmic-trading-technology-update.html"&gt;Quantitative Trading: Algorithmic Trading Technology Update&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5815834906618132494-5733687255507448996?l=blog.fosstrading.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/_KbZMMqJ98tgeTbBV7Ijl8EuzWg/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/_KbZMMqJ98tgeTbBV7Ijl8EuzWg/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/_KbZMMqJ98tgeTbBV7Ijl8EuzWg/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/_KbZMMqJ98tgeTbBV7Ijl8EuzWg/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~f/FossTrading?a=bohBki8p"&gt;&lt;img src="http://feeds.feedburner.com/~f/FossTrading?d=41" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/FossTrading?a=j0QwQln1"&gt;&lt;img src="http://feeds.feedburner.com/~f/FossTrading?i=j0QwQln1" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/FossTrading?a=VP8R5h7U"&gt;&lt;img src="http://feeds.feedburner.com/~f/FossTrading?i=VP8R5h7U" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/FossTrading?a=mfJ6zM7G"&gt;&lt;img src="http://feeds.feedburner.com/~f/FossTrading?d=52" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/FossTrading?a=H8Oe2gpb"&gt;&lt;img src="http://feeds.feedburner.com/~f/FossTrading?i=H8Oe2gpb" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/FossTrading/~4/-D71m0BInp4" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.fosstrading.com/feeds/5733687255507448996/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=5815834906618132494&amp;postID=5733687255507448996" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5815834906618132494/posts/default/5733687255507448996?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5815834906618132494/posts/default/5733687255507448996?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/FossTrading/~3/-D71m0BInp4/ibrokers-featured-on-quantitative.html" title="IBrokers Featured on Quantitative Trading" /><author><name>Joshua Ulrich</name><uri>http://www.blogger.com/profile/16641971932645230429</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="12731449228814218421" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://blog.fosstrading.com/2009/01/ibrokers-featured-on-quantitative.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0INSX06fip7ImA9WxVXF0k.&quot;"><id>tag:blogger.com,1999:blog-5815834906618132494.post-2487271000790717982</id><published>2008-12-30T23:54:00.000-06:00</published><updated>2009-02-15T18:53:18.316-06:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-02-15T18:53:18.316-06:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Events" /><title>R/Finance 2009: Applied Finance with R</title><content type="html">Call for Papers&lt;br /&gt;&lt;br /&gt;The Finance Department of the University of Illinois at Chicago (UIC),&lt;br /&gt;the International Center for Futures and Derivatives at UIC, and&lt;br /&gt;members of the R finance community are pleased to announce&lt;br /&gt;&lt;br /&gt;R/Finance 2009: Applied Finance with R&lt;br /&gt;&lt;br /&gt;on April 24 and 25, 2009, in Chicago, IL, USA&lt;br /&gt;&lt;br /&gt;Confirmed keynote speakers include:&lt;br /&gt;&lt;br /&gt;Patrick Burns (Burns Statistics)&lt;br /&gt;David Kane (Kane Capital)&lt;br /&gt;Roger Koenker (U of Illinois at Urbana/Champaign)&lt;br /&gt;David Ruppert (Cornell)&lt;br /&gt;Diethelm Wuertz (ETH Zürich)&lt;br /&gt;Eric Zivot (U of Washington)&lt;br /&gt;&lt;br /&gt;We invite all users of R in Finance to submit one-page abstracts or&lt;br /&gt;complete papers (in txt/pdf/doc format). We encourage papers both on&lt;br /&gt;academic research topics and related to use of R by Finance practitioners.&lt;br /&gt;&lt;br /&gt;Presenters are strongly encouraged to provide working R code to accompany&lt;br /&gt;the presentation/paper. Datasets need not be made public.&lt;br /&gt;&lt;br /&gt;Please send submissions to committee@RinFinance.com.&lt;br /&gt;The submission deadline is January 31st, 2009.&lt;br /&gt;Submissions will be evaluated and submitters notified via email&lt;br /&gt;on a rolling basis.&lt;br /&gt;&lt;br /&gt;Additional details about the conference will be announced as available.&lt;br /&gt;&lt;br /&gt;For the program committee:&lt;br /&gt;Gib Bassett, Peter Carl, Dirk Eddelbuettel, John Miller,&lt;br /&gt;Brian Peterson, Dale Rosenthal, Jeffrey Ryan&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5815834906618132494-2487271000790717982?l=blog.fosstrading.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/pdUnRqxtGRnu5k-5u9zubiWNC2o/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/pdUnRqxtGRnu5k-5u9zubiWNC2o/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/pdUnRqxtGRnu5k-5u9zubiWNC2o/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/pdUnRqxtGRnu5k-5u9zubiWNC2o/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~f/FossTrading?a=uX1FaM0t"&gt;&lt;img src="http://feeds.feedburner.com/~f/FossTrading?d=41" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/FossTrading?a=UyubiilA"&gt;&lt;img src="http://feeds.feedburner.com/~f/FossTrading?i=UyubiilA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/FossTrading?a=V9nujf0z"&gt;&lt;img src="http://feeds.feedburner.com/~f/FossTrading?i=V9nujf0z" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/FossTrading?a=gJdfMfWS"&gt;&lt;img src="http://feeds.feedburner.com/~f/FossTrading?d=52" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/FossTrading?a=eM0YJL5n"&gt;&lt;img src="http://feeds.feedburner.com/~f/FossTrading?i=eM0YJL5n" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/FossTrading/~4/smIn2-z7hv4" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.fosstrading.com/feeds/2487271000790717982/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=5815834906618132494&amp;postID=2487271000790717982" title="5 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5815834906618132494/posts/default/2487271000790717982?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5815834906618132494/posts/default/2487271000790717982?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/FossTrading/~3/smIn2-z7hv4/rfinance-2009-applied-finance-with-r.html" title="R/Finance 2009: Applied Finance with R" /><author><name>Joshua Ulrich</name><uri>http://www.blogger.com/profile/16641971932645230429</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="12731449228814218421" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">5</thr:total><feedburner:origLink>http://blog.fosstrading.com/2008/12/rfinance-2009-applied-finance-with-r.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0EESXY8fSp7ImA9WxVXF0k.&quot;"><id>tag:blogger.com,1999:blog-5815834906618132494.post-5398616398854250799</id><published>2008-12-05T20:39:00.000-06:00</published><updated>2009-02-15T18:53:28.875-06:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-02-15T18:53:28.875-06:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Events" /><title>Computational Finance with R</title><content type="html">Krishna Kumar, Jan Vecer and the great folks at &lt;a href="http://www.revolution-computing.com/"&gt;REvolution computing&lt;/a&gt; put on &lt;a href="http://www.stat.columbia.edu/pages/ComputationalFinance/index.html"&gt;a great event&lt;/a&gt; at the beautiful &lt;a href="http://www.columbia.edu/"&gt;Columbia University&lt;/a&gt; campus on the Upper West Side of New York.&lt;br /&gt;&lt;br /&gt;Presentations by Whit Armstrong, Anthony Brockwell, Bryan Lewis, Scott Payseur, Peter Carl, Brian Peterson, and our own Jeff Ryan made for an impressive display of the power of R in quant finance.  Jeff's presentation slides can be found &lt;a href="http://www.quantmod.com/Columbia2008"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Some great things are happening in this community, and we are certainly glad to be part of them.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5815834906618132494-5398616398854250799?l=blog.fosstrading.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/4Q5EcNKHdbvsskDnLgHLDbfsacQ/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/4Q5EcNKHdbvsskDnLgHLDbfsacQ/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/4Q5EcNKHdbvsskDnLgHLDbfsacQ/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/4Q5EcNKHdbvsskDnLgHLDbfsacQ/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~f/FossTrading?a=kOr98te3"&gt;&lt;img src="http://feeds.feedburner.com/~f/FossTrading?d=41" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/FossTrading?a=uwwzH6yh"&gt;&lt;img src="http://feeds.feedburner.com/~f/FossTrading?i=uwwzH6yh" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/FossTrading?a=kLiC6ruI"&gt;&lt;img src="http://feeds.feedburner.com/~f/FossTrading?i=kLiC6ruI" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/FossTrading?a=wgiz2NrZ"&gt;&lt;img src="http://feeds.feedburner.com/~f/FossTrading?d=52" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/FossTrading?a=DK5tDIjC"&gt;&lt;img src="http://feeds.feedburner.com/~f/FossTrading?i=DK5tDIjC" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/FossTrading/~4/l63KkW0zh7s" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.fosstrading.com/feeds/5398616398854250799/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=5815834906618132494&amp;postID=5398616398854250799" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5815834906618132494/posts/default/5398616398854250799?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5815834906618132494/posts/default/5398616398854250799?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/FossTrading/~3/l63KkW0zh7s/computational-finance-with-r.html" title="Computational Finance with R" /><author><name>Joshua Ulrich</name><uri>http://www.blogger.com/profile/16641971932645230429</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="12731449228814218421" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">1</thr:total><feedburner:origLink>http://blog.fosstrading.com/2008/12/computational-finance-with-r.html</feedburner:origLink></entry><entry gd:etag="W/&quot;Dk4AQXo6fCp7ImA9WxJQGUo.&quot;"><id>tag:blogger.com,1999:blog-5815834906618132494.post-9008818692381712583</id><published>2008-09-28T15:51:00.001-05:00</published><updated>2009-06-02T15:35:40.414-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-06-02T15:35:40.414-05:00</app:edited><title>Welcome to FOSS Trading</title><content type="html">This blog will highlight the development and use of free open-source software to research, test, and trade financial markets.&lt;br /&gt;&lt;br /&gt;Meet the authors:&lt;br /&gt;&lt;br /&gt;Joshua Ulrich is currently the author and maintainer of four R packages:&lt;ul&gt;&lt;li&gt;&lt;a href="http://cran.r-project.org/web/packages/TTR/index.html"&gt;&lt;b&gt;TTR&lt;/b&gt;&lt;/a&gt; - Technical Trading Rules - a suite of technical analysis functions&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://cran.r-project.org/web/packages/opentick/index.html"&gt;&lt;b&gt;opentick&lt;/b&gt;&lt;/a&gt; - an R API to the opentick databases&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://cran.r-project.org/web/packages/xts/index.html"&gt;&lt;b&gt;xts&lt;/b&gt;&lt;/a&gt; - eXtensible Time Series - a time-based data class that integrates all of the current time-series classes (co-authored with Jeff Ryan)&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://cran.r-project.org/web/packages/pack/index.html"&gt;&lt;b&gt;pack&lt;/b&gt;&lt;/a&gt; - convert binary to and from formats other programs and machines can understand&lt;/li&gt;&lt;/ul&gt;Jeff Ryan is currently the author and maintainer of four R packages:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.quantmod.com/"&gt;&lt;b&gt;quantmod&lt;/b&gt;&lt;/a&gt; - specify, build, trade, and analyse quantitative financial trading strategies &lt;/li&gt;&lt;li&gt;&lt;a href="http://cran.r-project.org/web/packages/IBrokers/index.html"&gt;&lt;b&gt;IBrokers&lt;/b&gt;&lt;/a&gt; - provides native R access to Interactive Brokers Trader Workstation API&lt;/li&gt;&lt;li&gt;&lt;a href="http://cran.r-project.org/web/packages/xts/index.html"&gt;&lt;b&gt;xts&lt;/b&gt;&lt;/a&gt; - eXtensible Time Series - a time-based data class that integrates all of the current time-series classes (co-authored with Joshua Ulrich)&lt;/li&gt;&lt;li&gt;&lt;a style="font-weight: bold;" href="http://cran.wustl.edu/web/packages/Defaults/index.html"&gt;Defaults&lt;/a&gt; - create global function defaults&lt;/li&gt;&lt;/ul&gt;As you may have guessed, most of the software we develop is in the R language/environment, but we also write code in C and Fortran for efficiency.  There are several reasons we use R:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;R allows for rapid prototyping, since it is a scripted language.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;The list of &lt;a href="http://cran.r-project.org/web/views/Finance.html"&gt;finance-oriented R packages&lt;/a&gt; is large and growing.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;The &lt;a href="https://stat.ethz.ch/mailman/listinfo/r-sig-finance"&gt;R-Finance community&lt;/a&gt; continues to grow rapidly.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;A multitude of statistical routines are available in &lt;a href="http://cran.r-project.org/web/packages/"&gt;contributed packages&lt;/a&gt;.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;We hope, with your help, this blog advances the use of free open source software in the finance / trading community!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5815834906618132494-9008818692381712583?l=blog.fosstrading.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/kHNKu_YjxldPQ47sAMjC_vcqaEU/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/kHNKu_YjxldPQ47sAMjC_vcqaEU/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/kHNKu_YjxldPQ47sAMjC_vcqaEU/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/kHNKu_YjxldPQ47sAMjC_vcqaEU/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~f/FossTrading?a=8RNqmBOh"&gt;&lt;img src="http://feeds.feedburner.com/~f/FossTrading?d=41" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/FossTrading?a=FkKgBu3J"&gt;&lt;img src="http://feeds.feedburner.com/~f/FossTrading?i=FkKgBu3J" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/FossTrading?a=I4QzmdKy"&gt;&lt;img src="http://feeds.feedburner.com/~f/FossTrading?i=I4QzmdKy" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/FossTrading?a=ccM3t4tR"&gt;&lt;img src="http://feeds.feedburner.com/~f/FossTrading?d=52" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/FossTrading?a=GkHMiflL"&gt;&lt;img src="http://feeds.feedburner.com/~f/FossTrading?i=GkHMiflL" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/FossTrading/~4/cZ4m9PCQDDY" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.fosstrading.com/feeds/9008818692381712583/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=5815834906618132494&amp;postID=9008818692381712583" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5815834906618132494/posts/default/9008818692381712583?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5815834906618132494/posts/default/9008818692381712583?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/FossTrading/~3/cZ4m9PCQDDY/welcome-to-foss-trading.html" title="Welcome to FOSS Trading" /><author><name>Joshua Ulrich</name><uri>http://www.blogger.com/profile/16641971932645230429</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="12731449228814218421" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://blog.fosstrading.com/2008/09/welcome-to-foss-trading.html</feedburner:origLink></entry></feed>
