<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-4234070235858016856</id><updated>2024-08-28T12:49:55.330-07:00</updated><category term="R"/><category term="General"/><category term="rapidminer"/><category term="strategies"/><category term="trading"/><category term="tutorial"/><category term="Algorithms"/><category term="books"/><category term="tools"/><category term="video"/><title type='text'>a Physicist in Wall Street</title><subtitle type='html'>For Trading Beginners</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://www.aphysicistinwallstreet.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4234070235858016856/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://www.aphysicistinwallstreet.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>12</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-4234070235858016856.post-3557564931783162611</id><published>2011-11-12T14:48:00.000-08:00</published><updated>2011-11-13T13:51:13.186-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="books"/><category scheme="http://www.blogger.com/atom/ns#" term="General"/><category scheme="http://www.blogger.com/atom/ns#" term="R"/><title type='text'>5 Interesting Free Books for R from beginner to experts</title><content type='html'>&lt;div class=&quot;MsoNormal&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; margin-bottom: 7.5pt; margin-left: 0cm; margin-right: 0cm; margin-top: 7.5pt;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-family: inherit; font-size: 12px;&quot;&gt;Always new software language in one technical activity is difficult, normally a good documentation can help, these are three book to use R software for beginner and for experts:&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; margin-bottom: 7.5pt; margin-left: 0cm; margin-right: 0cm; margin-top: 7.5pt;&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;color: #333333; font-family: inherit; font-size: 9pt;&quot;&gt;  &lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpFirst&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; margin-bottom: 7.5pt; margin-left: 18pt; margin-right: 0cm; margin-top: 7.5pt; text-indent: -18pt;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;&lt;span class=&quot;apple-style-span&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-size: 10pt;&quot;&gt;·&lt;span style=&quot;font: normal normal normal 7pt/normal &#39;Times New Roman&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-size: 9pt;&quot;&gt;“Introduction to the R Project for Statistical Computing for Use at the&lt;/span&gt;&lt;strong&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: black; font-size: 9pt;&quot;&gt; &lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: black; font-size: 9pt; font-weight: normal;&quot;&gt;ITC&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: black; font-size: 9pt;&quot;&gt;”&lt;/span&gt;&lt;/strong&gt;&lt;span class=&quot;apple-converted-space&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: black; font-size: 9pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;apple-style-span&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: black; font-size: 9pt;&quot;&gt;&lt;span style=&quot;float: none;&quot;&gt;by David Rossiter (&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;u&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;color: #003366; font-size: 9pt;&quot;&gt;&lt;a href=&quot;http://cran.r-project.org/doc/contrib/Rossiter-RIntro-ITC.pdf&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;&quot;&gt;&lt;span style=&quot;color: #003366; text-decoration: none;&quot;&gt;PDF&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;float: none;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/u&gt;&lt;span class=&quot;apple-style-span&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: black; font-size: 9pt;&quot;&gt; 2010-11-21).&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;apple-style-span&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-size: 9pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; margin-bottom: 7.5pt; margin-left: 18pt; margin-right: 0cm; margin-top: 7.5pt; text-indent: -18pt;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-size: 10pt;&quot;&gt;·&lt;span style=&quot;font: normal normal normal 7pt/normal &#39;Times New Roman&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;strong&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: black; font-size: 9pt; font-weight: normal;&quot;&gt;“R for Beginners”&lt;/span&gt;&lt;/strong&gt;&lt;span class=&quot;apple-converted-space&quot;&gt;&lt;b&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: black; font-size: 9pt;&quot;&gt;&lt;span style=&quot;float: none;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span class=&quot;apple-style-span&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: black; font-size: 9pt;&quot;&gt;by Emmanuel Paradis (&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 9pt;&quot;&gt;&lt;a href=&quot;http://cran.r-project.org/doc/contrib/Paradis-rdebuts_en.pdf&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial;&quot;&gt;PDF&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-size: 9pt;&quot;&gt;&lt;span style=&quot;float: none;&quot;&gt;,10 pages&lt;span class=&quot;apple-style-span&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: black;&quot;&gt;).&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;b&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-size: 9pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; margin-left: 18pt; text-indent: -18pt;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-size: 10pt;&quot;&gt;·&lt;span style=&quot;font: normal normal normal 7pt/normal &#39;Times New Roman&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 9pt;&quot;&gt;&lt;a href=&quot;http://little-book-of-r-for-multivariate-analysis.readthedocs.org/en/latest/index.html&quot; target=&quot;_self&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;color: #003366;&quot;&gt;A Little Book of R for Multivariate Analysis&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-size: 9pt;&quot;&gt;&amp;nbsp;(&lt;/span&gt;&lt;span style=&quot;font-size: 9pt;&quot;&gt;&lt;a href=&quot;https://github.com/avrilcoghlan/LittleBookofRMultivariateAnalysis/raw/master/_build/latex/MultivariateAnalysis.pdf&quot; target=&quot;_self&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;color: #003366;&quot;&gt;pdf&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-size: 9pt;&quot;&gt;, 49 pages) is a&amp;nbsp;simple introduction to multivariate analysis using the R statistics software. It covers topics such as reading and plotting multivariate data, principal components analysis, and linear discriminant analysis.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; margin-left: 18pt; text-indent: -18pt;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-size: 10pt;&quot;&gt;·&lt;span style=&quot;font: normal normal normal 7pt/normal &#39;Times New Roman&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 9pt;&quot;&gt;&lt;a href=&quot;http://a-little-book-of-r-for-biomedical-statistics.readthedocs.org/en/latest/index.html&quot; target=&quot;_self&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;color: #003366;&quot;&gt;A Little Book of R for Biomedical Statistics&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-size: 9pt;&quot;&gt;&amp;nbsp;(&lt;/span&gt;&lt;span style=&quot;font-size: 9pt;&quot;&gt;&lt;a href=&quot;https://github.com/avrilcoghlan/LittleBookofRBiomedicalStats/raw/master/_build/latex/BiomedicalStats.pdf&quot; target=&quot;_self&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;color: #003366;&quot;&gt;pdf&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-size: 9pt;&quot;&gt;, 33 pages) is a simple introduction to biomedical statistics using the R statistics software, with sections on relative risks and odds ratios, dose-response analysis, clinical trial design and meta-analysis.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpLast&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; margin-left: 18pt; text-indent: -18pt;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-size: 10pt;&quot;&gt;·&lt;span style=&quot;font: normal normal normal 7pt/normal &#39;Times New Roman&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 9pt;&quot;&gt;&lt;a href=&quot;http://a-little-book-of-r-for-time-series.readthedocs.org/en/latest/index.html&quot; target=&quot;_self&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;color: #003366;&quot;&gt;A Little Book of R for Time Series&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-size: 9pt;&quot;&gt;&amp;nbsp;(&lt;/span&gt;&lt;span style=&quot;font-size: 9pt;&quot;&gt;&lt;a href=&quot;https://github.com/avrilcoghlan/LittleBookofRTimeSeries/raw/master/_build/latex/TimeSeries.pdf&quot; target=&quot;_self&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;color: #003366;&quot;&gt;pdf&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-size: 9pt;&quot;&gt;, 71 pages) is a&amp;nbsp;simple introduction to time series analysis using the R statistics software (have you spotted the pattern yet?). It includes instruction on how to read and plot time series, time series decomposition, forecasting, and ARIMA models.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; margin-bottom: 7.5pt; margin-left: 0cm; margin-right: 0cm; margin-top: 7.5pt;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-size: 9pt;&quot;&gt;All books are free to use, share and remix under a&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-size: 9pt;&quot;&gt;&lt;a href=&quot;http://creativecommons.org/licenses/by/3.0/&quot; target=&quot;_self&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;color: #003366;&quot;&gt;Creative Commons license&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-size: 9pt;&quot;&gt;, and are available:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit; font-size: x-small;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; line-height: 115%;&quot;&gt;UPDATE: I updated the title,&lt;/span&gt; that&#39;s only five free books that I think interesting for R, Also there is another one that I forgot &amp;nbsp;&lt;a href=&quot;http://cran.r-project.org/doc/contrib/Hiebeler-matlabR.pdf&quot;&gt;Matlab for R programmer&amp;nbsp;&lt;/a&gt; I used Matlab from university till now (for me is always easier Matlab, but it is not free), both languages are similar but you always need a help (small tips).&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit; font-size: x-small;&quot;&gt;via: &lt;a href=&quot;http://blog.revolutionanalytics.com/2011/11/three-free-books-on-r-for-statistics.html&quot;&gt;Revolutions&lt;/a&gt;&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.aphysicistinwallstreet.com/feeds/3557564931783162611/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.aphysicistinwallstreet.com/2011/11/free-books-for-r.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4234070235858016856/posts/default/3557564931783162611'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4234070235858016856/posts/default/3557564931783162611'/><link rel='alternate' type='text/html' href='http://www.aphysicistinwallstreet.com/2011/11/free-books-for-r.html' title='5 Interesting Free Books for R from beginner to experts'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4234070235858016856.post-7890080004185603863</id><published>2011-11-06T12:36:00.000-08:00</published><updated>2011-11-06T12:36:13.853-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Algorithms"/><category scheme="http://www.blogger.com/atom/ns#" term="General"/><category scheme="http://www.blogger.com/atom/ns#" term="video"/><title type='text'>Machine trading Algorithms shape our world |</title><content type='html'>&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
Interesting Video where Kevin Slavin argues that we&#39;re living in a world designed for -- and increasingly controlled by -- algorithms. I agree, now algorithms executed in computers are changing the world, however that is the tip of the iceberg.&lt;br /&gt;
&lt;br /&gt;
&lt;table cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;float: left; margin-right: 1em; text-align: justify;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: left;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt; &lt;br /&gt;
&lt;object height=&quot;374&quot; width=&quot;526&quot;&gt; &lt;param name=&quot;movie&quot; value=&quot;http://video.ted.com/assets/player/swf/EmbedPlayer.swf&quot;&gt;&lt;/param&gt;&lt;param name=&quot;allowFullScreen&quot; value=&quot;true&quot; /&gt;&lt;param name=&quot;allowScriptAccess&quot; value=&quot;always&quot;/&gt;&lt;param name=&quot;wmode&quot; value=&quot;transparent&quot;&gt;&lt;/param&gt;&lt;param name=&quot;bgColor&quot; value=&quot;#ffffff&quot;&gt;&lt;/param&gt;&lt;param name=&quot;flashvars&quot; value=&quot;vu=http://video.ted.com/talk/stream/2011G/Blank/KevinSlavin_2011G-320k.mp4&amp;su=http://images.ted.com/images/ted/tedindex/embed-posters/KevinSlavin-2011G.embed_thumbnail.jpg&amp;vw=512&amp;vh=288&amp;ap=0&amp;ti=1194&amp;lang=&amp;introDuration=15330&amp;adDuration=4000&amp;postAdDuration=830&amp;adKeys=talk=kevin_slavin_how_algorithms_shape_our_world;year=2011;theme=what_s_next_in_tech;theme=to_boldly_go;event=TEDGlobal+2011;tag=Technology;tag=complexity;tag=computers;tag=social+change;&amp;preAdTag=tconf.ted/embed;tile=1;sz=512x288;&quot; /&gt;&lt;embed src=&quot;http://video.ted.com/assets/player/swf/EmbedPlayer.swf&quot; pluginspace=&quot;http://www.macromedia.com/go/getflashplayer&quot; type=&quot;application/x-shockwave-flash&quot; wmode=&quot;transparent&quot; bgColor=&quot;#ffffff&quot; width=&quot;526&quot; height=&quot;374&quot; allowFullScreen=&quot;true&quot; allowScriptAccess=&quot;always&quot; flashvars=&quot;vu=http://video.ted.com/talk/stream/2011G/Blank/KevinSlavin_2011G-320k.mp4&amp;su=http://images.ted.com/images/ted/tedindex/embed-posters/KevinSlavin-2011G.embed_thumbnail.jpg&amp;vw=512&amp;vh=288&amp;ap=0&amp;ti=1194&amp;lang=&amp;introDuration=15330&amp;adDuration=4000&amp;postAdDuration=830&amp;adKeys=talk=kevin_slavin_how_algorithms_shape_our_world;year=2011;theme=what_s_next_in_tech;theme=to_boldly_go;event=TEDGlobal+2011;tag=Technology;tag=complexity;tag=computers;tag=social+change;&amp;preAdTag=tconf.ted/embed;tile=1;sz=512x288;&quot;&gt;&lt;/embed&gt; &lt;/object&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;a href=&quot;http://www.ted.com/talks/kevin_slavin_how_algorithms_shape_our_world.html#.TrbrBlipxQo.blogger&quot;&gt;Kevin Slavin: How algorithms shape our world | Video on TED.com&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.aphysicistinwallstreet.com/feeds/7890080004185603863/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.aphysicistinwallstreet.com/2011/11/machine-trading-algorithms-shape-our.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4234070235858016856/posts/default/7890080004185603863'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4234070235858016856/posts/default/7890080004185603863'/><link rel='alternate' type='text/html' href='http://www.aphysicistinwallstreet.com/2011/11/machine-trading-algorithms-shape-our.html' title='Machine trading Algorithms shape our world |'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4234070235858016856.post-6569890526097602223</id><published>2011-03-08T11:18:00.000-08:00</published><updated>2011-03-08T11:18:00.867-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="R"/><category scheme="http://www.blogger.com/atom/ns#" term="rapidminer"/><category scheme="http://www.blogger.com/atom/ns#" term="strategies"/><category scheme="http://www.blogger.com/atom/ns#" term="trading"/><title type='text'>Blackbox trading Strategy using Rapidminer and R II</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgvmYQU3T1agREpxGqbEoNaenz_tUIzsrr1jxUdP3VKy8eVgRyVRIvDgKWdWDTm0EacVBhg7gA6XSkLR2I6uCiPVSrWp8QzGdk8aSg_DIZEeitQE_osVQ9pC_3ZC17njwGpsiuwDv6hd6Ri/s1600/image.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;345&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgvmYQU3T1agREpxGqbEoNaenz_tUIzsrr1jxUdP3VKy8eVgRyVRIvDgKWdWDTm0EacVBhg7gA6XSkLR2I6uCiPVSrWp8QzGdk8aSg_DIZEeitQE_osVQ9pC_3ZC17njwGpsiuwDv6hd6Ri/s640/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US; mso-fareast-language: ES;&quot;&gt;Long time without updating the blog for lack of time (again) due to new professional and personal challenges. Continuing with the strategy of Black Box, thanks to recommendations made by several readers and the lack of time to make a good tutorial of the model, I’m going to make available the file with a new version expecting new interesting and rewarding comments in order to improve the model. Actually the main problems in the strategy (commented by the users) are:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoListParagraphCxSpFirst&quot; style=&quot;mso-list: l0 level1 lfo1; text-indent: -18.0pt;&quot;&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US; mso-ascii-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: Calibri; mso-fareast-language: ES; mso-hansi-font-family: Calibri;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;-&lt;span style=&quot;font: 7.0pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US; mso-fareast-language: ES;&quot;&gt;The overlapping between test, and evaluation, (solution, avoid this overlapping reduce test time)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US; mso-ascii-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: Calibri; mso-fareast-language: ES; mso-hansi-font-family: Calibri;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;-&lt;span style=&quot;font: 7.0pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US; mso-fareast-language: ES;&quot;&gt;The function maximization is based on profits (other possibilities are possible, working on it)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US; mso-ascii-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: Calibri; mso-fareast-language: ES; mso-hansi-font-family: Calibri;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;-&lt;span style=&quot;font: 7.0pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US; mso-fareast-language: ES;&quot;&gt;Risk management (related)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US; mso-ascii-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: Calibri; mso-fareast-language: ES; mso-hansi-font-family: Calibri;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;-&lt;span style=&quot;font: 7.0pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US; mso-fareast-language: ES;&quot;&gt;You cannot&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;select in an easy way the stock name (working on it)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US; mso-ascii-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: Calibri; mso-fareast-language: ES; mso-hansi-font-family: Calibri;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;-&lt;span style=&quot;font: 7.0pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US; mso-fareast-language: ES;&quot;&gt;No portfolio management&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US; mso-ascii-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: Calibri; mso-fareast-language: ES; mso-hansi-font-family: Calibri;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;-&lt;span style=&quot;font: 7.0pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US; mso-fareast-language: ES;&quot;&gt;Low success in the prediction.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;!--[if !supportLists]--&gt;&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US; mso-fareast-language: ES;&quot;&gt;The archive can be downloaded free in this &lt;a href=&quot;http://dl.dropbox.com/u/5233081/BlackboxTradingStrategy_lite.zip&quot;&gt;link&lt;/a&gt;. Please send me your comments, your modifications and suggestion …&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;a href=&quot;javascript:void(0)&quot;&gt;Publicar entrada&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.aphysicistinwallstreet.com/feeds/6569890526097602223/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.aphysicistinwallstreet.com/2011/03/blackbox-trading-strategy-using.html#comment-form' title='9 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4234070235858016856/posts/default/6569890526097602223'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4234070235858016856/posts/default/6569890526097602223'/><link rel='alternate' type='text/html' href='http://www.aphysicistinwallstreet.com/2011/03/blackbox-trading-strategy-using.html' title='Blackbox trading Strategy using Rapidminer and R II'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgvmYQU3T1agREpxGqbEoNaenz_tUIzsrr1jxUdP3VKy8eVgRyVRIvDgKWdWDTm0EacVBhg7gA6XSkLR2I6uCiPVSrWp8QzGdk8aSg_DIZEeitQE_osVQ9pC_3ZC17njwGpsiuwDv6hd6Ri/s72-c/image.png" height="72" width="72"/><thr:total>9</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4234070235858016856.post-8595343802395303304</id><published>2011-01-23T11:01:00.001-08:00</published><updated>2011-01-24T11:58:02.781-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="R"/><category scheme="http://www.blogger.com/atom/ns#" term="rapidminer"/><category scheme="http://www.blogger.com/atom/ns#" term="strategies"/><category scheme="http://www.blogger.com/atom/ns#" term="trading"/><title type='text'>Blackbox trading Strategy using Rapidminer and R</title><content type='html'>This my first post in 2011. this post has cost me a bit more than usual, but I hope it meets expectations. The aim of this tutorial is to generate an algorithm based on black box trading, with all the necessary elements for evaluation. That is a first post of several, in order to explore the problems, features of this strategy.&lt;br /&gt;
In recent posts we have explored the performance assessment of a simple strategy. To improve this kind of evaluation and to enhance the capabilities of the use of R and RapidMiner for trading we have included the blotter library possibilities into the model evaluation (that not was simple due to the limitations of R extension). Blotter is an R 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 the blackbox trading strategy and it will allows us to manage different profiles with Rapidminer.&lt;br /&gt;
The basic strategy was done for GSPC and it is described in the following diagram&lt;br /&gt;
&lt;a href=&quot;http://lh3.ggpht.com/_upmtKBKjH54/TTx67_qLZ2I/AAAAAAAAAwc/XiiZvywAzQ4/s1600-h/clip_image0024.gif&quot;&gt;&lt;img alt=&quot;clip_image002&quot; border=&quot;0&quot; height=&quot;62&quot; src=&quot;http://lh4.ggpht.com/_upmtKBKjH54/TTx68vFlyNI/AAAAAAAAAwg/TKfp2ix4C0w/clip_image002_thumb1.gif?imgmax=800&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;clip_image002&quot; width=&quot;554&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
The trading strategy is divided into the generation of models, prediction and filtering spurious signals. The first step is the model generation, I tested different regression models, neural networks, SVM, etc for the prediction model generation. For spurious signals littering we have used a binary classification (bad prediction or correct prediction). The binary classification (correct or false prediction) is done using different rule extraction algorithms using as input only technical indicators. &lt;br /&gt;
&lt;a href=&quot;http://lh4.ggpht.com/_upmtKBKjH54/TTx69OdPUOI/AAAAAAAAAwk/jyOabZOzr2Q/s1600-h/clip_image0044.gif&quot;&gt;&lt;img alt=&quot;clip_image004&quot; border=&quot;0&quot; height=&quot;687&quot; src=&quot;http://lh4.ggpht.com/_upmtKBKjH54/TTx69lE9AKI/AAAAAAAAAwo/36KOSebPw9M/clip_image004_thumb1.gif?imgmax=800&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;clip_image004&quot; width=&quot;278&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
The second step is the Evaluation of the strategy using the models generated in the previous step&lt;br /&gt;
&lt;a href=&quot;http://lh6.ggpht.com/_upmtKBKjH54/TTx6-Y5YpgI/AAAAAAAAAws/zV4iYaHe9fg/s1600-h/clip_image0064.gif&quot;&gt;&lt;img alt=&quot;clip_image006&quot; border=&quot;0&quot; height=&quot;623&quot; src=&quot;http://lh4.ggpht.com/_upmtKBKjH54/TTx6-_3k1SI/AAAAAAAAAww/Lg-GktU7tko/clip_image006_thumb1.gif?imgmax=800&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: block; float: none; margin-left: auto; margin-right: auto; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;clip_image006&quot; width=&quot;418&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
To implement this strategy we have used Rapidminer and R plugin, you can see the complexity of the algorithm in the following picture. The main requirement is Blotter, however it is not yet in the cran repository, so you need to install from R-forge &lt;br /&gt;
&lt;code&gt;&lt;b&gt;install.packages(&quot;blotter&quot;, repos=&quot;http://R-Forge.R-project.org&quot;)&lt;/b&gt;&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;&lt;b&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;you can see more information in:&lt;/span&gt; &lt;/b&gt;&lt;/code&gt;&lt;a href=&quot;https://r-forge.r-project.org/R/?group_id=316&quot;&gt;https://r-forge.r-project.org/R/?group_id=316&lt;/a&gt;&lt;br /&gt;
To use the last version of blotter you need to update R to the last one in that moment 2.12 version.&lt;br /&gt;
&lt;a href=&quot;http://lh4.ggpht.com/_upmtKBKjH54/TTx7AD-v_WI/AAAAAAAAAw0/5xZRiViw7rw/s1600-h/image34.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;357&quot; src=&quot;http://lh6.ggpht.com/_upmtKBKjH54/TTx7AzsK1II/AAAAAAAAAw4/o8dKGbJBt4g/image_thumb18.png?imgmax=800&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;634&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
I will describe the most important R models, and in a future post I will describe, inside one video, all elements of the architecture.&lt;br /&gt;
The main elements are:&lt;br /&gt;
- Obtain Technical Data for Training model&lt;br /&gt;
- Evaluation Strategy&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;Obtain Technical Data for Training module&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
&lt;strong&gt;&lt;u&gt;&lt;/u&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;div id=&quot;codeSnippetWrapper&quot; style=&quot;background-color: #f4f4f4; border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; cursor: text; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 20px 0px 10px; max-height: 200px; overflow: auto; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;&quot;&gt;&lt;div id=&quot;codeSnippet&quot; style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum1&quot; style=&quot;color: #606060;&quot;&gt;   1:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum2&quot; style=&quot;color: #606060;&quot;&gt;   2:&lt;/span&gt; library(quantmod)&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum3&quot; style=&quot;color: #606060;&quot;&gt;   3:&lt;/span&gt; library(TTR)&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum4&quot; style=&quot;color: #606060;&quot;&gt;   4:&lt;/span&gt; library(PerformanceAnalytics)&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum5&quot; style=&quot;color: #606060;&quot;&gt;   5:&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;# Parameters&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum6&quot; style=&quot;color: #606060;&quot;&gt;   6:&lt;/span&gt; SymbolName=&lt;span style=&quot;color: #006080;&quot;&gt;&quot;^GSPC&quot;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum7&quot; style=&quot;color: #606060;&quot;&gt;   7:&lt;/span&gt; initDate=&lt;span style=&quot;color: #006080;&quot;&gt;&quot;2003-01-01&quot;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum8&quot; style=&quot;color: #606060;&quot;&gt;   8:&lt;/span&gt; secondDate=&lt;span style=&quot;color: #006080;&quot;&gt;&quot;2006-01-01::&quot;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum9&quot; style=&quot;color: #606060;&quot;&gt;   9:&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;# pull stock data from Yahoo Finance&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum10&quot; style=&quot;color: #606060;&quot;&gt;  10:&lt;/span&gt; symbol&amp;lt;-getSymbols(SymbolName,from=initDate)&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum11&quot; style=&quot;color: #606060;&quot;&gt;  11:&lt;/span&gt; stock&amp;lt;-xts(get(symbol))&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum12&quot; style=&quot;color: #606060;&quot;&gt;  12:&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;#remove stock name&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum13&quot; style=&quot;color: #606060;&quot;&gt;  13:&lt;/span&gt; names(stock)[names(stock)==paste(symbol,&lt;span style=&quot;color: #006080;&quot;&gt;&#39;.Open&#39;&lt;/span&gt;,sep=&lt;span style=&quot;color: #006080;&quot;&gt;&quot;&quot;&lt;/span&gt;)] &amp;lt;- &lt;span style=&quot;color: #006080;&quot;&gt;&#39;Open&#39;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum14&quot; style=&quot;color: #606060;&quot;&gt;  14:&lt;/span&gt; names(stock)[names(stock)==paste(symbol,&lt;span style=&quot;color: #006080;&quot;&gt;&#39;.Close&#39;&lt;/span&gt;,sep=&lt;span style=&quot;color: #006080;&quot;&gt;&quot;&quot;&lt;/span&gt;)] &amp;lt;- &lt;span style=&quot;color: #006080;&quot;&gt;&#39;Close&#39;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum15&quot; style=&quot;color: #606060;&quot;&gt;  15:&lt;/span&gt; names(stock)[names(stock)==paste(symbol,&lt;span style=&quot;color: #006080;&quot;&gt;&#39;.Volume&#39;&lt;/span&gt;,sep=&lt;span style=&quot;color: #006080;&quot;&gt;&quot;&quot;&lt;/span&gt;)] &amp;lt;- &lt;span style=&quot;color: #006080;&quot;&gt;&#39;Volume&#39;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum16&quot; style=&quot;color: #606060;&quot;&gt;  16:&lt;/span&gt; names(stock)[names(stock)==paste(symbol,&lt;span style=&quot;color: #006080;&quot;&gt;&#39;.Adjusted&#39;&lt;/span&gt;,sep=&lt;span style=&quot;color: #006080;&quot;&gt;&quot;&quot;&lt;/span&gt;)] &amp;lt;- &lt;span style=&quot;color: #006080;&quot;&gt;&#39;Adjusted&#39;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum17&quot; style=&quot;color: #606060;&quot;&gt;  17:&lt;/span&gt; names(stock)[names(stock)==paste(symbol,&lt;span style=&quot;color: #006080;&quot;&gt;&#39;.High&#39;&lt;/span&gt;,sep=&lt;span style=&quot;color: #006080;&quot;&gt;&quot;&quot;&lt;/span&gt;)] &amp;lt;- &lt;span style=&quot;color: #006080;&quot;&gt;&#39;High&#39;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum18&quot; style=&quot;color: #606060;&quot;&gt;  18:&lt;/span&gt; names(stock)[names(stock)==paste(symbol,&lt;span style=&quot;color: #006080;&quot;&gt;&#39;.Low&#39;&lt;/span&gt;,sep=&lt;span style=&quot;color: #006080;&quot;&gt;&quot;&quot;&lt;/span&gt;)] &amp;lt;- &lt;span style=&quot;color: #006080;&quot;&gt;&#39;Low&#39;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum19&quot; style=&quot;color: #606060;&quot;&gt;  19:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum20&quot; style=&quot;color: #606060;&quot;&gt;  20:&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;# Introduce RSI Indicator&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum21&quot; style=&quot;color: #606060;&quot;&gt;  21:&lt;/span&gt; stock$RSI2 = RSI(Cl(stock), 2)&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum22&quot; style=&quot;color: #606060;&quot;&gt;  22:&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;#Introduce Eponential Moving Average indicator&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum23&quot; style=&quot;color: #606060;&quot;&gt;  23:&lt;/span&gt; stock$EMA7=EMA(Cl(stock), n=7, wilder=FALSE, ratio=NULL)&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum24&quot; style=&quot;color: #606060;&quot;&gt;  24:&lt;/span&gt; stock$EMA50=EMA(Cl(stock), n=50, wilder=FALSE, ratio=NULL)&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum25&quot; style=&quot;color: #606060;&quot;&gt;  25:&lt;/span&gt; stock$EMA200=EMA(Cl(stock), n=200, wilder=FALSE, ratio=NULL)&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum26&quot; style=&quot;color: #606060;&quot;&gt;  26:&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;#Introduce MACD indicator&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum27&quot; style=&quot;color: #606060;&quot;&gt;  27:&lt;/span&gt; stock$MACD26=MACD(Cl(stock), nFast=12, nSlow=26, nSig=9)&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum28&quot; style=&quot;color: #606060;&quot;&gt;  28:&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;#Introduce ADX indicator &lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum29&quot; style=&quot;color: #606060;&quot;&gt;  29:&lt;/span&gt; stock$ADX14=ADX(stock, n=14)&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum30&quot; style=&quot;color: #606060;&quot;&gt;  30:&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;#Introduce AROON indicator&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum31&quot; style=&quot;color: #606060;&quot;&gt;  31:&lt;/span&gt; stock$AROON = aroon(Cl(stock), n=20 )&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum32&quot; style=&quot;color: #606060;&quot;&gt;  32:&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;#Introduce ATR indicator  &lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum33&quot; style=&quot;color: #606060;&quot;&gt;  33:&lt;/span&gt; stock$ATR=ATR(stock, n=14)&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum34&quot; style=&quot;color: #606060;&quot;&gt;  34:&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;#Introduce BOLLINGER indicator&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum35&quot; style=&quot;color: #606060;&quot;&gt;  35:&lt;/span&gt; stock$bbands = BBands(Cl(stock))&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum36&quot; style=&quot;color: #606060;&quot;&gt;  36:&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;#Introduce Commodity Channel Index indicator&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum37&quot; style=&quot;color: #606060;&quot;&gt;  37:&lt;/span&gt; stock$Commodity =  CCI(Cl(stock))&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum38&quot; style=&quot;color: #606060;&quot;&gt;  38:&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;#Introduce Chaikin Accumulation  Distribution indicator&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum39&quot; style=&quot;color: #606060;&quot;&gt;  39:&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;#stock$chaikin =  chaikinAD(stock, stock$Volume)&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum40&quot; style=&quot;color: #606060;&quot;&gt;  40:&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;#Introduce chaikinVolatility Chaikin Volatilit indicator&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum41&quot; style=&quot;color: #606060;&quot;&gt;  41:&lt;/span&gt; stock$chaikinVolatility = chaikinVolatility(stock)&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum42&quot; style=&quot;color: #606060;&quot;&gt;  42:&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;#Introduce Close Location Value indicator&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum43&quot; style=&quot;color: #606060;&quot;&gt;  43:&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;#stock$clv = CLV(stock) # infinites values&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum44&quot; style=&quot;color: #606060;&quot;&gt;  44:&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;#Introduce Chaikin Money Flow indicator&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum45&quot; style=&quot;color: #606060;&quot;&gt;  45:&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;#stock$cmf = CMF(stock, stock$Volume)&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum46&quot; style=&quot;color: #606060;&quot;&gt;  46:&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;#LAG&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum47&quot; style=&quot;color: #606060;&quot;&gt;  47:&lt;/span&gt; stock$label=lag(stock$Adjusted,-1)&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum48&quot; style=&quot;color: #606060;&quot;&gt;  48:&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;#&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum49&quot; style=&quot;color: #606060;&quot;&gt;  49:&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;# remove 2003,2004,2005 in order to avoid NaN from EMA indicators&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum50&quot; style=&quot;color: #606060;&quot;&gt;  50:&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;# To maintain time it is necessary to conver in texts&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum51&quot; style=&quot;color: #606060;&quot;&gt;  51:&lt;/span&gt; results &amp;lt;-data.frame(stock[secondDate],TIME=&lt;span style=&quot;color: blue;&quot;&gt;as&lt;/span&gt;.character(index(stock[secondDate])))&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum52&quot; style=&quot;color: #606060;&quot;&gt;  52:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;
&lt;b&gt;&lt;u&gt;Evaluation Strategy&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
This module define, using blotter, the strategy described before.&lt;br /&gt;
&lt;div id=&quot;codeSnippetWrapper&quot; style=&quot;background-color: #f4f4f4; border-bottom-color: silver; border-bottom-style: solid; border-bottom-width: 1px; border-left-color: silver; border-left-style: solid; border-left-width: 1px; border-right-color: silver; border-right-style: solid; border-right-width: 1px; border-top-color: silver; border-top-style: solid; border-top-width: 1px; cursor: text; direction: ltr; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 20px; max-height: 200px; overflow-x: auto; overflow-y: auto; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;&quot;&gt;&lt;div style=&quot;text-align: -webkit-auto;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div id=&quot;codeSnippet&quot; style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; overflow-x: visible; overflow-y: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum1&quot; style=&quot;color: #606060;&quot;&gt;   1:&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;# Load required libraries&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum2&quot; style=&quot;color: #606060;&quot;&gt;   2:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum3&quot; style=&quot;color: #606060;&quot;&gt;   3:&lt;/span&gt; library(quantmod)&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum4&quot; style=&quot;color: #606060;&quot;&gt;   4:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum5&quot; style=&quot;color: #606060;&quot;&gt;   5:&lt;/span&gt; library(TTR)&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum6&quot; style=&quot;color: #606060;&quot;&gt;   6:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum7&quot; style=&quot;color: #606060;&quot;&gt;   7:&lt;/span&gt; library(xts)&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum8&quot; style=&quot;color: #606060;&quot;&gt;   8:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum9&quot; style=&quot;color: #606060;&quot;&gt;   9:&lt;/span&gt; library(FinancialInstrument)&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum10&quot; style=&quot;color: #606060;&quot;&gt;  10:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum11&quot; style=&quot;color: #606060;&quot;&gt;  11:&lt;/span&gt; library(zoo)&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum12&quot; style=&quot;color: #606060;&quot;&gt;  12:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum13&quot; style=&quot;color: #606060;&quot;&gt;  13:&lt;/span&gt; library(blotter) &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum14&quot; style=&quot;color: #606060;&quot;&gt;  14:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum15&quot; style=&quot;color: #606060;&quot;&gt;  15:&lt;/span&gt; library(PerformanceAnalytics)&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum16&quot; style=&quot;color: #606060;&quot;&gt;  16:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum17&quot; style=&quot;color: #606060;&quot;&gt;  17:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum18&quot; style=&quot;color: #606060;&quot;&gt;  18:&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;# Try to clean up in case the demo was run previously&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum19&quot; style=&quot;color: #606060;&quot;&gt;  19:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum20&quot; style=&quot;color: #606060;&quot;&gt;  20:&lt;/span&gt; try(rm(&lt;span style=&quot;color: #006080;&quot;&gt;&quot;account.rapidminer&quot;&lt;/span&gt;,&lt;span style=&quot;color: #006080;&quot;&gt;&quot;portfolio.rapidminer&quot;&lt;/span&gt;,pos=.blotter),silent=TRUE)&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum21&quot; style=&quot;color: #606060;&quot;&gt;  21:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum22&quot; style=&quot;color: #606060;&quot;&gt;  22:&lt;/span&gt; try(rm(&lt;span style=&quot;color: #006080;&quot;&gt;&quot;ltaccount&quot;&lt;/span&gt;,&lt;span style=&quot;color: #006080;&quot;&gt;&quot;ltportfolio&quot;&lt;/span&gt;,&lt;span style=&quot;color: #006080;&quot;&gt;&quot;ClosePrice&quot;&lt;/span&gt;,&lt;span style=&quot;color: #006080;&quot;&gt;&quot;CurrentDate&quot;&lt;/span&gt;,&lt;span style=&quot;color: #006080;&quot;&gt;&quot;equity&quot;&lt;/span&gt;,&lt;span style=&quot;color: #006080;&quot;&gt;&quot;Symbol&quot;&lt;/span&gt;,&lt;span style=&quot;color: #006080;&quot;&gt;&quot;i&quot;&lt;/span&gt;,&lt;span style=&quot;color: #006080;&quot;&gt;&quot;initDate&quot;&lt;/span&gt;,&lt;span style=&quot;color: #006080;&quot;&gt;&quot;initEq&quot;&lt;/span&gt;,&lt;span style=&quot;color: #006080;&quot;&gt;&quot;Posn&quot;&lt;/span&gt;,&lt;span style=&quot;color: #006080;&quot;&gt;&quot;UnitSize&quot;&lt;/span&gt;,&lt;span style=&quot;color: #006080;&quot;&gt;&quot;verbose&quot;&lt;/span&gt;),silent=TRUE)&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum23&quot; style=&quot;color: #606060;&quot;&gt;  23:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum24&quot; style=&quot;color: #606060;&quot;&gt;  24:&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;# Set initial values you can change to reduce the test period&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum25&quot; style=&quot;color: #606060;&quot;&gt;  25:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum26&quot; style=&quot;color: #606060;&quot;&gt;  26:&lt;/span&gt; initDate=&lt;span style=&quot;color: #006080;&quot;&gt;&#39;2009-01-27&#39;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum27&quot; style=&quot;color: #606060;&quot;&gt;  27:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum28&quot; style=&quot;color: #606060;&quot;&gt;  28:&lt;/span&gt; initEq=100000&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum29&quot; style=&quot;color: #606060;&quot;&gt;  29:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum30&quot; style=&quot;color: #606060;&quot;&gt;  30:&lt;/span&gt; stopLoss=0.005 &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum31&quot; style=&quot;color: #606060;&quot;&gt;  31:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum32&quot; style=&quot;color: #606060;&quot;&gt;  32:&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;# it is important to introduc this sentence to work using blotter&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum33&quot; style=&quot;color: #606060;&quot;&gt;  33:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum34&quot; style=&quot;color: #606060;&quot;&gt;  34:&lt;/span&gt; Sys.setenv(TZ=&lt;span style=&quot;color: #006080;&quot;&gt;&quot;GMT&quot;&lt;/span&gt;)&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum35&quot; style=&quot;color: #606060;&quot;&gt;  35:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum36&quot; style=&quot;color: #606060;&quot;&gt;  36:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum37&quot; style=&quot;color: #606060;&quot;&gt;  37:&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;# Load data with quantmod&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum38&quot; style=&quot;color: #606060;&quot;&gt;  38:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum39&quot; style=&quot;color: #606060;&quot;&gt;  39:&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;print&lt;/span&gt;(&lt;span style=&quot;color: #006080;&quot;&gt;&quot;Loading data&quot;&lt;/span&gt;)&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum40&quot; style=&quot;color: #606060;&quot;&gt;  40:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum41&quot; style=&quot;color: #606060;&quot;&gt;  41:&lt;/span&gt; currency(&lt;span style=&quot;color: #006080;&quot;&gt;&quot;USD&quot;&lt;/span&gt;)&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum42&quot; style=&quot;color: #606060;&quot;&gt;  42:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum43&quot; style=&quot;color: #606060;&quot;&gt;  43:&lt;/span&gt; stock(&lt;span style=&quot;color: #006080;&quot;&gt;&quot;Symbol&quot;&lt;/span&gt;,currency=&lt;span style=&quot;color: #006080;&quot;&gt;&quot;USD&quot;&lt;/span&gt;,multiplier=1)&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum44&quot; style=&quot;color: #606060;&quot;&gt;  44:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum45&quot; style=&quot;color: #606060;&quot;&gt;  45:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum46&quot; style=&quot;color: #606060;&quot;&gt;  46:&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;# Set up a portfolio object and an account object in blotter&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum47&quot; style=&quot;color: #606060;&quot;&gt;  47:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum48&quot; style=&quot;color: #606060;&quot;&gt;  48:&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;print&lt;/span&gt;(&lt;span style=&quot;color: #006080;&quot;&gt;&quot;Initializing portfolio and account structure&quot;&lt;/span&gt;)&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum49&quot; style=&quot;color: #606060;&quot;&gt;  49:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum50&quot; style=&quot;color: #606060;&quot;&gt;  50:&lt;/span&gt; ltportfolio=&lt;span style=&quot;color: #006080;&quot;&gt;&#39;rapidminer&#39;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum51&quot; style=&quot;color: #606060;&quot;&gt;  51:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum52&quot; style=&quot;color: #606060;&quot;&gt;  52:&lt;/span&gt; ltaccount=&lt;span style=&quot;color: #006080;&quot;&gt;&#39;rapidminer&#39;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum53&quot; style=&quot;color: #606060;&quot;&gt;  53:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum54&quot; style=&quot;color: #606060;&quot;&gt;  54:&lt;/span&gt; initPortf(ltportfolio,&lt;span style=&quot;color: #006080;&quot;&gt;&#39;Symbol&#39;&lt;/span&gt;, initDate=initDate)&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum55&quot; style=&quot;color: #606060;&quot;&gt;  55:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum56&quot; style=&quot;color: #606060;&quot;&gt;  56:&lt;/span&gt; initAcct(ltaccount,portfolios=&lt;span style=&quot;color: #006080;&quot;&gt;&#39;rapidminer&#39;&lt;/span&gt;, initDate=initDate, initEq=initEq)&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum57&quot; style=&quot;color: #606060;&quot;&gt;  57:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum58&quot; style=&quot;color: #606060;&quot;&gt;  58:&lt;/span&gt; verbose=TRUE&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum59&quot; style=&quot;color: #606060;&quot;&gt;  59:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum60&quot; style=&quot;color: #606060;&quot;&gt;  60:&lt;/span&gt; datos &amp;lt;- data &lt;span style=&quot;color: green;&quot;&gt;# for output data &lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum61&quot; style=&quot;color: #606060;&quot;&gt;  61:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum62&quot; style=&quot;color: #606060;&quot;&gt;  62:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum63&quot; style=&quot;color: #606060;&quot;&gt;  63:&lt;/span&gt; dates &amp;lt;- &lt;span style=&quot;color: blue;&quot;&gt;as&lt;/span&gt;.Date(data$TIME)&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum64&quot; style=&quot;color: #606060;&quot;&gt;  64:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum65&quot; style=&quot;color: #606060;&quot;&gt;  65:&lt;/span&gt; data$TIME=NULL &lt;span style=&quot;color: green;&quot;&gt;# remove string information&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum66&quot; style=&quot;color: #606060;&quot;&gt;  66:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum67&quot; style=&quot;color: #606060;&quot;&gt;  67:&lt;/span&gt; data$correct_prediction=NULL &lt;span style=&quot;color: green;&quot;&gt;# remove information from data&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum68&quot; style=&quot;color: #606060;&quot;&gt;  68:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum69&quot; style=&quot;color: #606060;&quot;&gt;  69:&lt;/span&gt; Symbol &amp;lt;- xts(data,order.by=&lt;span style=&quot;color: blue;&quot;&gt;as&lt;/span&gt;.POSIXct(dates),index.&lt;span style=&quot;color: blue;&quot;&gt;class&lt;/span&gt;=c(&lt;span style=&quot;color: #006080;&quot;&gt;&quot;POSIXt&quot;&lt;/span&gt;,&lt;span style=&quot;color: #006080;&quot;&gt;&quot;POSIXct&quot;&lt;/span&gt;))&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum70&quot; style=&quot;color: #606060;&quot;&gt;  70:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum71&quot; style=&quot;color: #606060;&quot;&gt;  71:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum72&quot; style=&quot;color: #606060;&quot;&gt;  72:&lt;/span&gt; PREDICTION = data$prediction&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum73&quot; style=&quot;color: #606060;&quot;&gt;  73:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum74&quot; style=&quot;color: #606060;&quot;&gt;  74:&lt;/span&gt; close_ROC &amp;lt;- ROC(data$label)&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum75&quot; style=&quot;color: #606060;&quot;&gt;  75:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum76&quot; style=&quot;color: #606060;&quot;&gt;  76:&lt;/span&gt; prediction_ROC &amp;lt;-ROC(data$prediction)&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum77&quot; style=&quot;color: #606060;&quot;&gt;  77:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum78&quot; style=&quot;color: #606060;&quot;&gt;  78:&lt;/span&gt; close_ROC[1] &amp;lt;- 0&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum79&quot; style=&quot;color: #606060;&quot;&gt;  79:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum80&quot; style=&quot;color: #606060;&quot;&gt;  80:&lt;/span&gt; prediction_ROC[1] &amp;lt;- 0&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum81&quot; style=&quot;color: #606060;&quot;&gt;  81:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum82&quot; style=&quot;color: #606060;&quot;&gt;  82:&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;#generate signals from prediction values&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum83&quot; style=&quot;color: #606060;&quot;&gt;  83:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum84&quot; style=&quot;color: #606060;&quot;&gt;  84:&lt;/span&gt; sigup &amp;lt;- ifelse(prediction_ROC &amp;gt; 0, 1, 0)&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum85&quot; style=&quot;color: #606060;&quot;&gt;  85:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum86&quot; style=&quot;color: #606060;&quot;&gt;  86:&lt;/span&gt; sigdn &amp;lt;- ifelse(prediction_ROC &amp;lt; 0, -1, 0)&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum87&quot; style=&quot;color: #606060;&quot;&gt;  87:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum88&quot; style=&quot;color: #606060;&quot;&gt;  88:&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;# Replace missing signals with no position&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum89&quot; style=&quot;color: #606060;&quot;&gt;  89:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum90&quot; style=&quot;color: #606060;&quot;&gt;  90:&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;# (generally just at beginning of series)&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum91&quot; style=&quot;color: #606060;&quot;&gt;  91:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum92&quot; style=&quot;color: #606060;&quot;&gt;  92:&lt;/span&gt; sigup[is.na(sigup)] &amp;lt;- 0&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum93&quot; style=&quot;color: #606060;&quot;&gt;  93:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum94&quot; style=&quot;color: #606060;&quot;&gt;  94:&lt;/span&gt; sigdn[is.na(sigdn)] &amp;lt;- 0&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum95&quot; style=&quot;color: #606060;&quot;&gt;  95:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum96&quot; style=&quot;color: #606060;&quot;&gt;  96:&lt;/span&gt; sig &amp;lt;- sigup + sigdn&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum97&quot; style=&quot;color: #606060;&quot;&gt;  97:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum98&quot; style=&quot;color: #606060;&quot;&gt;  98:&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;# Create trades&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum99&quot; style=&quot;color: #606060;&quot;&gt;  99:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum100&quot; style=&quot;color: #606060;&quot;&gt; 100:&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;for&lt;/span&gt;( i in 2:NROW(prediction_ROC) ) { &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum101&quot; style=&quot;color: #606060;&quot;&gt; 101:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum102&quot; style=&quot;color: #606060;&quot;&gt; 102:&lt;/span&gt; CurrentDate=dates[i]&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum103&quot; style=&quot;color: #606060;&quot;&gt; 103:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum104&quot; style=&quot;color: #606060;&quot;&gt; 104:&lt;/span&gt; cat(&lt;span style=&quot;color: #006080;&quot;&gt;&quot;.&quot;&lt;/span&gt;)&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum105&quot; style=&quot;color: #606060;&quot;&gt; 105:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum106&quot; style=&quot;color: #606060;&quot;&gt; 106:&lt;/span&gt; equity = getEndEq(ltaccount, CurrentDate)&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum107&quot; style=&quot;color: #606060;&quot;&gt; 107:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum108&quot; style=&quot;color: #606060;&quot;&gt; 108:&lt;/span&gt; ClosePrice = &lt;span style=&quot;color: blue;&quot;&gt;as&lt;/span&gt;.numeric(Symbol$Adjusted[i])&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum109&quot; style=&quot;color: #606060;&quot;&gt; 109:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum110&quot; style=&quot;color: #606060;&quot;&gt; 110:&lt;/span&gt; OpenPrice = &lt;span style=&quot;color: blue;&quot;&gt;as&lt;/span&gt;.numeric(Symbol$Open[i])&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum111&quot; style=&quot;color: #606060;&quot;&gt; 111:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum112&quot; style=&quot;color: #606060;&quot;&gt; 112:&lt;/span&gt; LowPrice = &lt;span style=&quot;color: blue;&quot;&gt;as&lt;/span&gt;.numeric(Symbol$Low[i])&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum113&quot; style=&quot;color: #606060;&quot;&gt; 113:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum114&quot; style=&quot;color: #606060;&quot;&gt; 114:&lt;/span&gt; HighPrice = &lt;span style=&quot;color: blue;&quot;&gt;as&lt;/span&gt;.numeric(Symbol$High[i])&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum115&quot; style=&quot;color: #606060;&quot;&gt; 115:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum116&quot; style=&quot;color: #606060;&quot;&gt; 116:&lt;/span&gt; filter&amp;lt;-data$filter[i-1]&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum117&quot; style=&quot;color: #606060;&quot;&gt; 117:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum118&quot; style=&quot;color: #606060;&quot;&gt; 118:&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;# filter&amp;lt;-1 #if you want to remove filter un-comment this line&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum119&quot; style=&quot;color: #606060;&quot;&gt; 119:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum120&quot; style=&quot;color: #606060;&quot;&gt; 120:&lt;/span&gt; Posn = getPosQty(ltportfolio, Symbol=&lt;span style=&quot;color: #006080;&quot;&gt;&#39;Symbol&#39;&lt;/span&gt;, Date=CurrentDate)&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum121&quot; style=&quot;color: #606060;&quot;&gt; 121:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum122&quot; style=&quot;color: #606060;&quot;&gt; 122:&lt;/span&gt; UnitSize = &lt;span style=&quot;color: blue;&quot;&gt;as&lt;/span&gt;.numeric(trunc(equity/ClosePrice))&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum123&quot; style=&quot;color: #606060;&quot;&gt; 123:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum124&quot; style=&quot;color: #606060;&quot;&gt; 124:&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;#print(paste(&quot;UnitSize&quot;,UnitSize))&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum125&quot; style=&quot;color: #606060;&quot;&gt; 125:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum126&quot; style=&quot;color: #606060;&quot;&gt; 126:&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;# Position Entry (assume fill at close)&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum127&quot; style=&quot;color: #606060;&quot;&gt; 127:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum128&quot; style=&quot;color: #606060;&quot;&gt; 128:&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;if&lt;/span&gt;( Posn == 0 ) { &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum129&quot; style=&quot;color: #606060;&quot;&gt; 129:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum130&quot; style=&quot;color: #606060;&quot;&gt; 130:&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;# No position, so start Long position&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum131&quot; style=&quot;color: #606060;&quot;&gt; 131:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum132&quot; style=&quot;color: #606060;&quot;&gt; 132:&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;if&lt;/span&gt;( prediction_ROC[i-1] &amp;gt;0 &amp;amp;&amp;amp; filter==1 ) { &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum133&quot; style=&quot;color: #606060;&quot;&gt; 133:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum134&quot; style=&quot;color: #606060;&quot;&gt; 134:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum135&quot; style=&quot;color: #606060;&quot;&gt; 135:&lt;/span&gt; StopPrice = OpenPrice *(1-stopLoss)&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum136&quot; style=&quot;color: #606060;&quot;&gt; 136:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum137&quot; style=&quot;color: #606060;&quot;&gt; 137:&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;# Store trade with blotter&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum138&quot; style=&quot;color: #606060;&quot;&gt; 138:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum139&quot; style=&quot;color: #606060;&quot;&gt; 139:&lt;/span&gt; addTxn(ltportfolio, Symbol=&lt;span style=&quot;color: #006080;&quot;&gt;&#39;Symbol&#39;&lt;/span&gt;, TxnDate=CurrentDate, TxnPrice=OpenPrice, TxnQty = UnitSize , TxnFees=0)&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum140&quot; style=&quot;color: #606060;&quot;&gt; 140:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum141&quot; style=&quot;color: #606060;&quot;&gt; 141:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum142&quot; style=&quot;color: #606060;&quot;&gt; 142:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum143&quot; style=&quot;color: #606060;&quot;&gt; 143:&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;if&lt;/span&gt; (LowPrice&amp;lt;StopPrice){&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum144&quot; style=&quot;color: #606060;&quot;&gt; 144:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum145&quot; style=&quot;color: #606060;&quot;&gt; 145:&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;# Exit&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum146&quot; style=&quot;color: #606060;&quot;&gt; 146:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum147&quot; style=&quot;color: #606060;&quot;&gt; 147:&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;print&lt;/span&gt;(paste(&lt;span style=&quot;color: #006080;&quot;&gt;&quot;Exit&quot;&lt;/span&gt;,CurrentDate))&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum148&quot; style=&quot;color: #606060;&quot;&gt; 148:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum149&quot; style=&quot;color: #606060;&quot;&gt; 149:&lt;/span&gt; addTxn(ltportfolio, Symbol=&lt;span style=&quot;color: #006080;&quot;&gt;&#39;Symbol&#39;&lt;/span&gt;, TxnDate=CurrentDate, TxnPrice=StopPrice, TxnQty = -UnitSize , TxnFees=0)&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum150&quot; style=&quot;color: #606060;&quot;&gt; 150:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum151&quot; style=&quot;color: #606060;&quot;&gt; 151:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum152&quot; style=&quot;color: #606060;&quot;&gt; 152:&lt;/span&gt; }&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum153&quot; style=&quot;color: #606060;&quot;&gt; 153:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum154&quot; style=&quot;color: #606060;&quot;&gt; 154:&lt;/span&gt; }&lt;span style=&quot;color: blue;&quot;&gt;else&lt;/span&gt;{&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum155&quot; style=&quot;color: #606060;&quot;&gt; 155:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum156&quot; style=&quot;color: #606060;&quot;&gt; 156:&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;if&lt;/span&gt;( prediction_ROC[i-1] &amp;lt;0 &amp;amp;&amp;amp; filter==1) { &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum157&quot; style=&quot;color: #606060;&quot;&gt; 157:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum158&quot; style=&quot;color: #606060;&quot;&gt; 158:&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;#print(&quot;Prediction_ROC is SHELL&quot;)&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum159&quot; style=&quot;color: #606060;&quot;&gt; 159:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum160&quot; style=&quot;color: #606060;&quot;&gt; 160:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum161&quot; style=&quot;color: #606060;&quot;&gt; 161:&lt;/span&gt; StopPrice = OpenPrice *(1+stopLoss)&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum162&quot; style=&quot;color: #606060;&quot;&gt; 162:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum163&quot; style=&quot;color: #606060;&quot;&gt; 163:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum164&quot; style=&quot;color: #606060;&quot;&gt; 164:&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;# Store trade with blotter&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum165&quot; style=&quot;color: #606060;&quot;&gt; 165:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum166&quot; style=&quot;color: #606060;&quot;&gt; 166:&lt;/span&gt; addTxn(ltportfolio, Symbol=&lt;span style=&quot;color: #006080;&quot;&gt;&#39;Symbol&#39;&lt;/span&gt;, TxnDate=CurrentDate, TxnPrice=OpenPrice, TxnQty = -UnitSize , TxnFees=0)&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum167&quot; style=&quot;color: #606060;&quot;&gt; 167:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum168&quot; style=&quot;color: #606060;&quot;&gt; 168:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum169&quot; style=&quot;color: #606060;&quot;&gt; 169:&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;if&lt;/span&gt; (HighPrice&amp;gt;StopPrice){&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum170&quot; style=&quot;color: #606060;&quot;&gt; 170:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum171&quot; style=&quot;color: #606060;&quot;&gt; 171:&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;# Exit&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum172&quot; style=&quot;color: #606060;&quot;&gt; 172:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum173&quot; style=&quot;color: #606060;&quot;&gt; 173:&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;print&lt;/span&gt;(paste(&lt;span style=&quot;color: #006080;&quot;&gt;&quot;Exit&quot;&lt;/span&gt;,CurrentDate))&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum174&quot; style=&quot;color: #606060;&quot;&gt; 174:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum175&quot; style=&quot;color: #606060;&quot;&gt; 175:&lt;/span&gt; addTxn(ltportfolio, Symbol=&lt;span style=&quot;color: #006080;&quot;&gt;&#39;Symbol&#39;&lt;/span&gt;, TxnDate=CurrentDate, TxnPrice=StopPrice, TxnQty = UnitSize , TxnFees=0)&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum176&quot; style=&quot;color: #606060;&quot;&gt; 176:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum177&quot; style=&quot;color: #606060;&quot;&gt; 177:&lt;/span&gt; }&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum178&quot; style=&quot;color: #606060;&quot;&gt; 178:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum179&quot; style=&quot;color: #606060;&quot;&gt; 179:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum180&quot; style=&quot;color: #606060;&quot;&gt; 180:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum181&quot; style=&quot;color: #606060;&quot;&gt; 181:&lt;/span&gt; }&lt;span style=&quot;color: blue;&quot;&gt;else&lt;/span&gt;{&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum182&quot; style=&quot;color: #606060;&quot;&gt; 182:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum183&quot; style=&quot;color: #606060;&quot;&gt; 183:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum184&quot; style=&quot;color: #606060;&quot;&gt; 184:&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;#print(&quot;Prediction_ROC is 0&quot;)&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum185&quot; style=&quot;color: #606060;&quot;&gt; 185:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum186&quot; style=&quot;color: #606060;&quot;&gt; 186:&lt;/span&gt; }&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum187&quot; style=&quot;color: #606060;&quot;&gt; 187:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum188&quot; style=&quot;color: #606060;&quot;&gt; 188:&lt;/span&gt; }&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum189&quot; style=&quot;color: #606060;&quot;&gt; 189:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum190&quot; style=&quot;color: #606060;&quot;&gt; 190:&lt;/span&gt; }&lt;span style=&quot;color: blue;&quot;&gt;else&lt;/span&gt;{ &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum191&quot; style=&quot;color: #606060;&quot;&gt; 191:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum192&quot; style=&quot;color: #606060;&quot;&gt; 192:&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;if&lt;/span&gt;(Posn &amp;gt;0) {&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum193&quot; style=&quot;color: #606060;&quot;&gt; 193:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum194&quot; style=&quot;color: #606060;&quot;&gt; 194:&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;# Have a position, so check exit&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum195&quot; style=&quot;color: #606060;&quot;&gt; 195:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum196&quot; style=&quot;color: #606060;&quot;&gt; 196:&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;if&lt;/span&gt;( prediction_ROC[i-1] &amp;lt; 0 &amp;amp;&amp;amp; filter==1) { &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum197&quot; style=&quot;color: #606060;&quot;&gt; 197:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum198&quot; style=&quot;color: #606060;&quot;&gt; 198:&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;print&lt;/span&gt;(&lt;span style=&quot;color: #006080;&quot;&gt;&quot;Prediction_ROC is SHELL&quot;&lt;/span&gt;)&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum199&quot; style=&quot;color: #606060;&quot;&gt; 199:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum200&quot; style=&quot;color: #606060;&quot;&gt; 200:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum201&quot; style=&quot;color: #606060;&quot;&gt; 201:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum202&quot; style=&quot;color: #606060;&quot;&gt; 202:&lt;/span&gt; StopPrice = OpenPrice *(1+stopLoss)&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum203&quot; style=&quot;color: #606060;&quot;&gt; 203:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum204&quot; style=&quot;color: #606060;&quot;&gt; 204:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum205&quot; style=&quot;color: #606060;&quot;&gt; 205:&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;# Store trade with blotter&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum206&quot; style=&quot;color: #606060;&quot;&gt; 206:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum207&quot; style=&quot;color: #606060;&quot;&gt; 207:&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;print&lt;/span&gt;(&lt;span style=&quot;color: #006080;&quot;&gt;&quot;close position&quot;&lt;/span&gt;)&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum208&quot; style=&quot;color: #606060;&quot;&gt; 208:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum209&quot; style=&quot;color: #606060;&quot;&gt; 209:&lt;/span&gt; addTxn(ltportfolio, Symbol=&lt;span style=&quot;color: #006080;&quot;&gt;&#39;Symbol&#39;&lt;/span&gt;, TxnDate=CurrentDate, TxnPrice=OpenPrice, TxnQty = -2*abs(Posn) , TxnFees=0)&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum210&quot; style=&quot;color: #606060;&quot;&gt; 210:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum211&quot; style=&quot;color: #606060;&quot;&gt; 211:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum212&quot; style=&quot;color: #606060;&quot;&gt; 212:&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;if&lt;/span&gt; (HighPrice&amp;gt;StopPrice){&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum213&quot; style=&quot;color: #606060;&quot;&gt; 213:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum214&quot; style=&quot;color: #606060;&quot;&gt; 214:&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;# Exit&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum215&quot; style=&quot;color: #606060;&quot;&gt; 215:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum216&quot; style=&quot;color: #606060;&quot;&gt; 216:&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;print&lt;/span&gt;(paste(&lt;span style=&quot;color: #006080;&quot;&gt;&quot;Exit&quot;&lt;/span&gt;,CurrentDate))&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum217&quot; style=&quot;color: #606060;&quot;&gt; 217:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum218&quot; style=&quot;color: #606060;&quot;&gt; 218:&lt;/span&gt; addTxn(ltportfolio, Symbol=&lt;span style=&quot;color: #006080;&quot;&gt;&#39;Symbol&#39;&lt;/span&gt;, TxnDate=CurrentDate, TxnPrice=StopPrice, TxnQty = 2*abs(Posn) , TxnFees=0)&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum219&quot; style=&quot;color: #606060;&quot;&gt; 219:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum220&quot; style=&quot;color: #606060;&quot;&gt; 220:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum221&quot; style=&quot;color: #606060;&quot;&gt; 221:&lt;/span&gt; }&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum222&quot; style=&quot;color: #606060;&quot;&gt; 222:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum223&quot; style=&quot;color: #606060;&quot;&gt; 223:&lt;/span&gt; }&lt;span style=&quot;color: blue;&quot;&gt;else&lt;/span&gt;{&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum224&quot; style=&quot;color: #606060;&quot;&gt; 224:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum225&quot; style=&quot;color: #606060;&quot;&gt; 225:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum226&quot; style=&quot;color: #606060;&quot;&gt; 226:&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;if&lt;/span&gt; (LowPrice&amp;lt;StopPrice){&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum227&quot; style=&quot;color: #606060;&quot;&gt; 227:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum228&quot; style=&quot;color: #606060;&quot;&gt; 228:&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;# Exit&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum229&quot; style=&quot;color: #606060;&quot;&gt; 229:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum230&quot; style=&quot;color: #606060;&quot;&gt; 230:&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;print&lt;/span&gt;(paste(&lt;span style=&quot;color: #006080;&quot;&gt;&quot;Exit&quot;&lt;/span&gt;,CurrentDate))&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum231&quot; style=&quot;color: #606060;&quot;&gt; 231:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum232&quot; style=&quot;color: #606060;&quot;&gt; 232:&lt;/span&gt; addTxn(ltportfolio, Symbol=&lt;span style=&quot;color: #006080;&quot;&gt;&#39;Symbol&#39;&lt;/span&gt;, TxnDate=CurrentDate, TxnPrice=StopPrice, TxnQty = -abs(Posn) , TxnFees=0)&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum233&quot; style=&quot;color: #606060;&quot;&gt; 233:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum234&quot; style=&quot;color: #606060;&quot;&gt; 234:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum235&quot; style=&quot;color: #606060;&quot;&gt; 235:&lt;/span&gt; }&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum236&quot; style=&quot;color: #606060;&quot;&gt; 236:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum237&quot; style=&quot;color: #606060;&quot;&gt; 237:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum238&quot; style=&quot;color: #606060;&quot;&gt; 238:&lt;/span&gt; }&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum239&quot; style=&quot;color: #606060;&quot;&gt; 239:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum240&quot; style=&quot;color: #606060;&quot;&gt; 240:&lt;/span&gt; }&lt;span style=&quot;color: blue;&quot;&gt;else&lt;/span&gt;{&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum241&quot; style=&quot;color: #606060;&quot;&gt; 241:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum242&quot; style=&quot;color: #606060;&quot;&gt; 242:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum243&quot; style=&quot;color: #606060;&quot;&gt; 243:&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;if&lt;/span&gt;( prediction_ROC[i-1] &amp;gt; 0 &amp;amp;&amp;amp; filter==1) { &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum244&quot; style=&quot;color: #606060;&quot;&gt; 244:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum245&quot; style=&quot;color: #606060;&quot;&gt; 245:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum246&quot; style=&quot;color: #606060;&quot;&gt; 246:&lt;/span&gt; StopPrice = OpenPrice *(1-stopLoss)&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum247&quot; style=&quot;color: #606060;&quot;&gt; 247:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum248&quot; style=&quot;color: #606060;&quot;&gt; 248:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum249&quot; style=&quot;color: #606060;&quot;&gt; 249:&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;# Store trade with blotter&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum250&quot; style=&quot;color: #606060;&quot;&gt; 250:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum251&quot; style=&quot;color: #606060;&quot;&gt; 251:&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;#print(&quot;close position&quot;)&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum252&quot; style=&quot;color: #606060;&quot;&gt; 252:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum253&quot; style=&quot;color: #606060;&quot;&gt; 253:&lt;/span&gt; addTxn(ltportfolio, Symbol=&lt;span style=&quot;color: #006080;&quot;&gt;&#39;Symbol&#39;&lt;/span&gt;, TxnDate=CurrentDate, TxnPrice=OpenPrice, TxnQty = 2*abs(Posn) , TxnFees=0)&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum254&quot; style=&quot;color: #606060;&quot;&gt; 254:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum255&quot; style=&quot;color: #606060;&quot;&gt; 255:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum256&quot; style=&quot;color: #606060;&quot;&gt; 256:&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;if&lt;/span&gt; (LowPrice&amp;lt;StopPrice){&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum257&quot; style=&quot;color: #606060;&quot;&gt; 257:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum258&quot; style=&quot;color: #606060;&quot;&gt; 258:&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;# Exit&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum259&quot; style=&quot;color: #606060;&quot;&gt; 259:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum260&quot; style=&quot;color: #606060;&quot;&gt; 260:&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;print&lt;/span&gt;(paste(&lt;span style=&quot;color: #006080;&quot;&gt;&quot;Exit&quot;&lt;/span&gt;,CurrentDate))&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum261&quot; style=&quot;color: #606060;&quot;&gt; 261:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum262&quot; style=&quot;color: #606060;&quot;&gt; 262:&lt;/span&gt; addTxn(ltportfolio, Symbol=&lt;span style=&quot;color: #006080;&quot;&gt;&#39;Symbol&#39;&lt;/span&gt;, TxnDate=CurrentDate, TxnPrice=StopPrice, TxnQty = -2*abs(Posn) , TxnFees=0)&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum263&quot; style=&quot;color: #606060;&quot;&gt; 263:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum264&quot; style=&quot;color: #606060;&quot;&gt; 264:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum265&quot; style=&quot;color: #606060;&quot;&gt; 265:&lt;/span&gt; }&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum266&quot; style=&quot;color: #606060;&quot;&gt; 266:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum267&quot; style=&quot;color: #606060;&quot;&gt; 267:&lt;/span&gt; }&lt;span style=&quot;color: blue;&quot;&gt;else&lt;/span&gt;{&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum268&quot; style=&quot;color: #606060;&quot;&gt; 268:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum269&quot; style=&quot;color: #606060;&quot;&gt; 269:&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;# we maintain short position except exit&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum270&quot; style=&quot;color: #606060;&quot;&gt; 270:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum271&quot; style=&quot;color: #606060;&quot;&gt; 271:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum272&quot; style=&quot;color: #606060;&quot;&gt; 272:&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;if&lt;/span&gt; (HighPrice&amp;gt;StopPrice){&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum273&quot; style=&quot;color: #606060;&quot;&gt; 273:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum274&quot; style=&quot;color: #606060;&quot;&gt; 274:&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;# Exit&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum275&quot; style=&quot;color: #606060;&quot;&gt; 275:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum276&quot; style=&quot;color: #606060;&quot;&gt; 276:&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;print&lt;/span&gt;(paste(&lt;span style=&quot;color: #006080;&quot;&gt;&quot;Exit&quot;&lt;/span&gt;,CurrentDate))&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum277&quot; style=&quot;color: #606060;&quot;&gt; 277:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum278&quot; style=&quot;color: #606060;&quot;&gt; 278:&lt;/span&gt; addTxn(ltportfolio, Symbol=&lt;span style=&quot;color: #006080;&quot;&gt;&#39;Symbol&#39;&lt;/span&gt;, TxnDate=CurrentDate, TxnPrice=StopPrice, TxnQty = abs(Posn) , TxnFees=0)&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum279&quot; style=&quot;color: #606060;&quot;&gt; 279:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum280&quot; style=&quot;color: #606060;&quot;&gt; 280:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum281&quot; style=&quot;color: #606060;&quot;&gt; 281:&lt;/span&gt; }&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum282&quot; style=&quot;color: #606060;&quot;&gt; 282:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum283&quot; style=&quot;color: #606060;&quot;&gt; 283:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum284&quot; style=&quot;color: #606060;&quot;&gt; 284:&lt;/span&gt; }&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum285&quot; style=&quot;color: #606060;&quot;&gt; 285:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum286&quot; style=&quot;color: #606060;&quot;&gt; 286:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum287&quot; style=&quot;color: #606060;&quot;&gt; 287:&lt;/span&gt; }&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum288&quot; style=&quot;color: #606060;&quot;&gt; 288:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum289&quot; style=&quot;color: #606060;&quot;&gt; 289:&lt;/span&gt; } &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum290&quot; style=&quot;color: #606060;&quot;&gt; 290:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum291&quot; style=&quot;color: #606060;&quot;&gt; 291:&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;# Calculate P&amp;amp;L and resulting equity with blotter&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum292&quot; style=&quot;color: #606060;&quot;&gt; 292:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum293&quot; style=&quot;color: #606060;&quot;&gt; 293:&lt;/span&gt; updatePortf(ltportfolio, Dates = CurrentDate,Prices= Symbol$Adjusted)&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum294&quot; style=&quot;color: #606060;&quot;&gt; 294:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum295&quot; style=&quot;color: #606060;&quot;&gt; 295:&lt;/span&gt; updateAcct(ltaccount, Dates = CurrentDate)&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum296&quot; style=&quot;color: #606060;&quot;&gt; 296:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum297&quot; style=&quot;color: #606060;&quot;&gt; 297:&lt;/span&gt; updateEndEq(ltaccount, Dates = CurrentDate)&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum298&quot; style=&quot;color: #606060;&quot;&gt; 298:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum299&quot; style=&quot;color: #606060;&quot;&gt; 299:&lt;/span&gt; } &lt;span style=&quot;color: green;&quot;&gt;# End dates loop&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum300&quot; style=&quot;color: #606060;&quot;&gt; 300:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum301&quot; style=&quot;color: #606060;&quot;&gt; 301:&lt;/span&gt; cat(&lt;span style=&quot;color: #006080;&quot;&gt;&#39;\n&#39;&lt;/span&gt;)&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum302&quot; style=&quot;color: #606060;&quot;&gt; 302:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum303&quot; style=&quot;color: #606060;&quot;&gt; 303:&lt;/span&gt; transactions=getTxns(Portfolio=&lt;span style=&quot;color: #006080;&quot;&gt;&quot;rapidminer&quot;&lt;/span&gt;, Symbol=&lt;span style=&quot;color: #006080;&quot;&gt;&quot;Symbol&quot;&lt;/span&gt;)&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum304&quot; style=&quot;color: #606060;&quot;&gt; 304:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum305&quot; style=&quot;color: #606060;&quot;&gt; 305:&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;# Copy the results into the local environment&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum306&quot; style=&quot;color: #606060;&quot;&gt; 306:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum307&quot; style=&quot;color: #606060;&quot;&gt; 307:&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;print&lt;/span&gt;(&lt;span style=&quot;color: #006080;&quot;&gt;&quot;Retrieving resulting portfolio&quot;&lt;/span&gt;)&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum308&quot; style=&quot;color: #606060;&quot;&gt; 308:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum309&quot; style=&quot;color: #606060;&quot;&gt; 309:&lt;/span&gt; ltportfolio = getPortfolio(&lt;span style=&quot;color: #006080;&quot;&gt;&quot;rapidminer&quot;&lt;/span&gt;)&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum310&quot; style=&quot;color: #606060;&quot;&gt; 310:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum311&quot; style=&quot;color: #606060;&quot;&gt; 311:&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;print&lt;/span&gt;(&lt;span style=&quot;color: #006080;&quot;&gt;&quot;Retrieving resulting account&quot;&lt;/span&gt;)&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum312&quot; style=&quot;color: #606060;&quot;&gt; 312:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum313&quot; style=&quot;color: #606060;&quot;&gt; 313:&lt;/span&gt; ltaccount = getAccount(&lt;span style=&quot;color: #006080;&quot;&gt;&quot;rapidminer&quot;&lt;/span&gt;)&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum314&quot; style=&quot;color: #606060;&quot;&gt; 314:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum315&quot; style=&quot;color: #606060;&quot;&gt; 315:&lt;/span&gt; results &amp;lt;-data.frame(ltaccount$summary)&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum316&quot; style=&quot;color: #606060;&quot;&gt; 316:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum317&quot; style=&quot;color: #606060;&quot;&gt; 317:&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;# generate buy and hold&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum318&quot; style=&quot;color: #606060;&quot;&gt; 318:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum319&quot; style=&quot;color: #606060;&quot;&gt; 319:&lt;/span&gt; buyhold = ROC(Symbol$Adjusted)&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum320&quot; style=&quot;color: #606060;&quot;&gt; 320:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum321&quot; style=&quot;color: #606060;&quot;&gt; 321:&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;# Plot Strategy Summary &lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum322&quot; style=&quot;color: #606060;&quot;&gt; 322:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum323&quot; style=&quot;color: #606060;&quot;&gt; 323:&lt;/span&gt; png(filename=&lt;span style=&quot;color: #006080;&quot;&gt;&quot;20110109_blotter_strategy.png&quot;&lt;/span&gt;, 1000, 1000, units = &lt;span style=&quot;color: #006080;&quot;&gt;&quot;px&quot;&lt;/span&gt;, pointsize = 12, bg = &lt;span style=&quot;color: #006080;&quot;&gt;&quot;white&quot;&lt;/span&gt;, res = 200, restoreConsole = TRUE)&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum324&quot; style=&quot;color: #606060;&quot;&gt; 324:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum325&quot; style=&quot;color: #606060;&quot;&gt; 325:&lt;/span&gt; Eq&amp;lt;-ROC(getAccount(&lt;span style=&quot;color: #006080;&quot;&gt;&#39;rapidminer&#39;&lt;/span&gt;)$summary$End.Eq)&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum326&quot; style=&quot;color: #606060;&quot;&gt; 326:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum327&quot; style=&quot;color: #606060;&quot;&gt; 327:&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;#names(stock)[names(stock)==paste(symbol,&#39;.Low&#39;,sep=&quot;&quot;)] &amp;lt;- &#39;Low&#39;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum328&quot; style=&quot;color: #606060;&quot;&gt; 328:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum329&quot; style=&quot;color: #606060;&quot;&gt; 329:&lt;/span&gt; buyhold$Blackbox &amp;lt;- Eq&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum330&quot; style=&quot;color: #606060;&quot;&gt; 330:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum331&quot; style=&quot;color: #606060;&quot;&gt; 331:&lt;/span&gt; charts.PerformanceSummary(buyhold,colorset=rich6equal, lwd=2, ylog=TRUE)&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum332&quot; style=&quot;color: #606060;&quot;&gt; 332:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum333&quot; style=&quot;color: #606060;&quot;&gt; 333:&lt;/span&gt; AnnualizedReturns &amp;lt;- table.AnnualizedReturns(buyhold)&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum334&quot; style=&quot;color: #606060;&quot;&gt; 334:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum335&quot; style=&quot;color: #606060;&quot;&gt; 335:&lt;/span&gt; Stats &amp;lt;- table.Stats(buyhold)&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum336&quot; style=&quot;color: #606060;&quot;&gt; 336:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum337&quot; style=&quot;color: #606060;&quot;&gt; 337:&lt;/span&gt; DownsideRisk &amp;lt;- table.DownsideRisk(buyhold)&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum338&quot; style=&quot;color: #606060;&quot;&gt; 338:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum339&quot; style=&quot;color: #606060;&quot;&gt; 339:&lt;/span&gt; dev.off()&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum340&quot; style=&quot;color: #606060;&quot;&gt; 340:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;
It was defined three time interval, one for training (800 days), one for evaluation genetic space search (300 days) and finally the rest of the days for testing ( &amp;gt;200 days)&lt;br /&gt;
&lt;br /&gt;
Several tests have been done using Neural Networks and SVM, obtaining diverse results, however always positive results. You can see in the following image the results obtained &lt;br /&gt;
&lt;br /&gt;
Using neural network we have improved the performance of the strategy in the training and evaluation data, during 7 hours, 100 generations we obtain the following improvement (figure). We use the same technique than in previous post. It is not possible to use for evaluation Blotter due to the time consumption of this package.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://lh5.ggpht.com/_upmtKBKjH54/TTx7Breu5EI/AAAAAAAAAw8/MHaEc7VeKCw/s1600-h/image4.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;337&quot; src=&quot;http://lh6.ggpht.com/_upmtKBKjH54/TTx7Cb6wVMI/AAAAAAAAAxA/ergFdupL-gY/image_thumb2.png?imgmax=800&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;625&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
The results obtained using this strategy, without filter can be observed in the following graph, the comparison was done with buy&amp;amp;hold strategy. Although backtesting is no guarantee of future performance, it gives the trader confidence that the strategy has worked in the past. If the strategy is not over-optimized, data-mined, or based on random coincidences, it might have a good chance of working in the future. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://lh6.ggpht.com/_upmtKBKjH54/TTx9ePnJnHI/AAAAAAAAAxU/YHaqYVfnOGs/s1600-h/image%5B5%5D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;636&quot; src=&quot;http://lh4.ggpht.com/_upmtKBKjH54/TTx9fXUe1FI/AAAAAAAAAxY/b6ijTjQoJ8M/image_thumb%5B2%5D.png?imgmax=800&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;636&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;The Sharpe Ratio (Rf=0%) of this strategy is 2.46.&lt;/strong&gt; &lt;br /&gt;
&lt;br /&gt;
On the other hand if we use the filter &lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://lh3.ggpht.com/_upmtKBKjH54/TTx9gZCxFmI/AAAAAAAAAxg/2dA3FQlO5S4/s1600-h/image%5B10%5D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;638&quot; src=&quot;http://lh4.ggpht.com/_upmtKBKjH54/TTx9hcFSbYI/AAAAAAAAAxk/uQ-JgixBXyw/image_thumb%5B5%5D.png?imgmax=800&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;638&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Using the filter, we reduce the drawdown peak; however we obtained lower return and a &lt;strong&gt;Sharpe Ratio of 2.18&lt;/strong&gt;. Currently I’m doing several test with different filters however the Sharpe Ratio of the prediction algorithm without filter is very high for this index.&lt;br /&gt;
&lt;br /&gt;
Also, you can modify the type of filter, for example you can see the filter obtained using J48 algorithm. The idea is to auto-generate and understand&amp;nbsp; filters using technical indicators.&lt;br /&gt;
&lt;br /&gt;
&lt;em&gt;&lt;strong&gt;J48 pruned tree&lt;/strong&gt;&lt;/em&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;em&gt;&lt;strong&gt;------------------&lt;/strong&gt;&lt;/em&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;em&gt;&lt;strong&gt;RSI2-0 &amp;lt;= 44.156798: false (409.0/168.0)&lt;/strong&gt;&lt;/em&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;em&gt;&lt;strong&gt;RSI2-0 &amp;gt; 44.156798&lt;/strong&gt;&lt;/em&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;em&gt;&lt;strong&gt;| DX-0 &amp;lt;= 5.179328&lt;/strong&gt;&lt;/em&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;em&gt;&lt;strong&gt;| | DX-0 &amp;lt;= 2.667342&lt;/strong&gt;&lt;/em&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;em&gt;&lt;strong&gt;| | | tr-1 &amp;lt;= 4.81: false (10.33/2.33)&lt;/strong&gt;&lt;/em&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;em&gt;&lt;strong&gt;| | | tr-1 &amp;gt; 4.81: true (20.67/3.0)&lt;/strong&gt;&lt;/em&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;em&gt;&lt;strong&gt;| | DX-0 &amp;gt; 2.667342: true (24.0/1.0)&lt;/strong&gt;&lt;/em&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;em&gt;&lt;strong&gt;| DX-0 &amp;gt; 5.179328: true (536.0/255.0)&lt;/strong&gt;&lt;/em&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;em&gt;&lt;strong&gt;Number of Leaves : 5&lt;/strong&gt;&lt;/em&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;em&gt;&lt;strong&gt;Size of the tree : 9&lt;/strong&gt;&lt;/em&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The current problems of the model are:&lt;br /&gt;
&lt;br /&gt;
- The accuracy of the long and short position prediction, it is not good should be improved.&lt;br /&gt;
&lt;br /&gt;
- My objective is to reduce the risk of the strategy, so the the filter should be improved in order to reduce false signals. &lt;br /&gt;
&lt;br /&gt;
- Reduce the number of variable to adjust for the strategy… &lt;br /&gt;
&lt;br /&gt;
In the following post, I will describe in a video the model with all elements of the architecture, and I will try to discuss about the problems discovered in the strategy.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://uploadnsell.com/buy/AcHBcD&quot;&gt;&lt;img alt=&quot;clip_image012&quot; border=&quot;0&quot; height=&quot;82&quot; src=&quot;http://lh6.ggpht.com/_upmtKBKjH54/TTx7FaGk6HI/AAAAAAAAAxo/fOdeL8SeA90/clip_image012%5B1%5D.jpg?imgmax=800&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;clip_image012&quot; width=&quot;170&quot; /&gt;&lt;/a&gt;&lt;strong&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;We do not guarantee that those strategies will give you profits or have mistakes. It is important to remember that each trading situation is unique. You can never copy a strategy and think that it will always work. It is allot factors to take consideration too. For example, how the game looks like, how the odds are moving etc. This blog is a research activity to share knowledge related to datamining and trading algorithms. All code described in this blog is GPL v3, We try to put all information about the model and how to generate the results obtained and also if you have any doubt about the model you will receive the answer by email or comments in the blog. If you don¡t have patient and you want to obtain the files you can, paying one small donation to improve the website, &lt;/span&gt;&lt;/strong&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.aphysicistinwallstreet.com/feeds/8595343802395303304/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.aphysicistinwallstreet.com/2011/01/blackbox-trading-strategy-using.html#comment-form' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4234070235858016856/posts/default/8595343802395303304'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4234070235858016856/posts/default/8595343802395303304'/><link rel='alternate' type='text/html' href='http://www.aphysicistinwallstreet.com/2011/01/blackbox-trading-strategy-using.html' title='Blackbox trading Strategy using Rapidminer and R'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh4.ggpht.com/_upmtKBKjH54/TTx68vFlyNI/AAAAAAAAAwg/TKfp2ix4C0w/s72-c/clip_image002_thumb1.gif?imgmax=800" height="72" width="72"/><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4234070235858016856.post-477163351335096474</id><published>2010-12-26T15:01:00.001-08:00</published><updated>2010-12-26T15:01:26.251-08:00</updated><title type='text'>merry christmas and a happy new year</title><content type='html'>&lt;p&gt;Merry Christmas and a Happy New Year to all of my new friends in this blog. Wishing you a very fruitful financial and trading year ahead. I Hope you all will wish the same for me and my family. In 2010 we have got new Ideas using Rapidminer and R, however we expect a new year with new ideas and possibilities in this trading World. &lt;p&gt;&lt;a href=&quot;http://lh4.ggpht.com/_upmtKBKjH54/TRfJOcFDbNI/AAAAAAAAAwU/RoIAvk5gcHw/s1600-h/image%5B9%5D.png&quot;&gt;&lt;img style=&quot;background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px; padding-top: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;http://lh6.ggpht.com/_upmtKBKjH54/TRfJRPI6RCI/AAAAAAAAAwY/b5ACm2JvPdU/image_thumb%5B5%5D.png?imgmax=800&quot; width=&quot;442&quot; height=&quot;361&quot;&gt;&lt;/a&gt;  </content><link rel='replies' type='application/atom+xml' href='http://www.aphysicistinwallstreet.com/feeds/477163351335096474/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.aphysicistinwallstreet.com/2010/12/merry-christmas-and-happy-new-year.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4234070235858016856/posts/default/477163351335096474'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4234070235858016856/posts/default/477163351335096474'/><link rel='alternate' type='text/html' href='http://www.aphysicistinwallstreet.com/2010/12/merry-christmas-and-happy-new-year.html' title='merry christmas and a happy new year'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh6.ggpht.com/_upmtKBKjH54/TRfJRPI6RCI/AAAAAAAAAwY/b5ACm2JvPdU/s72-c/image_thumb%5B5%5D.png?imgmax=800" height="72" width="72"/><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4234070235858016856.post-4573872091335337199</id><published>2010-12-05T02:46:00.000-08:00</published><updated>2010-12-05T02:46:15.801-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="R"/><category scheme="http://www.blogger.com/atom/ns#" term="rapidminer"/><category scheme="http://www.blogger.com/atom/ns#" term="strategies"/><category scheme="http://www.blogger.com/atom/ns#" term="trading"/><category scheme="http://www.blogger.com/atom/ns#" term="tutorial"/><title type='text'>Genetic optimization for Trading Strategies using Rapidminer and R</title><content type='html'>That is the second tutorial of Rapidminer and R extension for Trading and the first in Video. In the last example the ROC obtained is not as good as it should be to make money in this business, To improve the strategy we will try to optimize the trading strategy. Different methods of &lt;a href=&quot;http://en.wikipedia.org/wiki/Category:Optimization_algorithms&quot;&gt;optimization&lt;/a&gt; and &lt;a href=&quot;http://www.dinosaurtech.com/2007/genetic-optimization-and-maximization-%25%20E2%25%2080%20%25%2093-fitness-function%20/&quot;&gt;objective functions for trading&lt;/a&gt; can be studied in the literature, Finally we will use a genetic non-multiobjetive to optimize our simple strategy. &lt;br /&gt;
&lt;br /&gt;
The simple strategy defined is the following: &lt;br /&gt;
&lt;ul&gt;&lt;li&gt;The symbol used is “IBM” (you can use any other symbol)&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;A SVM (Support Vector Machine) predicts the close value of the next day, and when the value is mayor than the previous day, we obtain a buy signal and otherwise a shell signal.&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;The training data used are historical prizes (close, high, volumen) from 2006 to 2009&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;The validation is done with historical information from 2010&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;It is calculated the following indicators RSI, EMA 7, EMA 50, EMA 200, MACD y ADX.&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;It is created a two days delay temporal window for all historical values.&lt;/li&gt;

&lt;/ul&gt;For the optimization of the strategy it is used a genetic algorithm. The genetic algorithm will modify the input data by removing any entries (for example indicators) in order to maximize the ROC of the strategy .   You can watch in the video the model generated:  &lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;wlWriterEditableSmartContent&quot; id=&quot;scid:5737277B-5D6D-4f48-ABFC-DD9C333F4C5D:a1296594-4c31-4060-bc56-400fab1496a8&quot; style=&quot;display: inline; float: none; margin: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;div id=&quot;be0c234f-f48d-442a-bc92-91dd20d2874e&quot; style=&quot;display: inline; margin: 0px; padding: 0px;&quot;&gt;&lt;div&gt;&lt;object height=&quot;252&quot; width=&quot;448&quot;&gt;&lt;param name=&quot;movie&quot; value=&quot;http://www.youtube.com/v/dKpx4FCn2XQ?hl=en&amp;amp;hd=1&quot;&gt;&lt;embed src=&quot;http://www.youtube.com/v/dKpx4FCn2XQ?hl=en&amp;amp;hd=1&quot; type=&quot;application/x-shockwave-flash&quot; width=&quot;448&quot; height=&quot;252&quot;&gt;&lt;/object&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
The results are:   Initial ROC of the past tutorial&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;  &lt;a href=&quot;http://lh4.ggpht.com/_upmtKBKjH54/TPrBqj_PwbI/AAAAAAAAAvA/JHV3a8p1JY4/s1600-h/clip_image002%5B4%5D.gif&quot;&gt;&lt;img alt=&quot;clip_image002&quot; border=&quot;0&quot; height=&quot;305&quot; src=&quot;http://lh4.ggpht.com/_upmtKBKjH54/TPrBrWSc_EI/AAAAAAAAAvE/FTm5WlcIQUQ/clip_image002_thumb%5B1%5D.gif?imgmax=800&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;clip_image002&quot; width=&quot;568&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;The trading % win in the past strategy:&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;  &lt;a href=&quot;http://lh5.ggpht.com/_upmtKBKjH54/TPrBsVYVhMI/AAAAAAAAAvI/XbljY39VAQE/s1600-h/clip_image004%5B4%5D.jpg&quot;&gt;&lt;img alt=&quot;clip_image004&quot; border=&quot;0&quot; height=&quot;61&quot; src=&quot;http://lh6.ggpht.com/_upmtKBKjH54/TPrBtK0nCuI/AAAAAAAAAvM/Yd0YXD1hlQ4/clip_image004_thumb%5B1%5D.jpg?imgmax=800&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; cursor: move; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;clip_image004&quot; width=&quot;494&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;Evolving feature selection in 40 generation, the final ROC performance is improved.  &amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://lh6.ggpht.com/_upmtKBKjH54/TPrBuLdbDlI/AAAAAAAAAvQ/tNa1_L_sqIw/s1600-h/clip_image006%5B4%5D.gif&quot;&gt;&lt;img alt=&quot;clip_image006&quot; border=&quot;0&quot; height=&quot;315&quot; src=&quot;http://lh3.ggpht.com/_upmtKBKjH54/TPrBuwz9y-I/AAAAAAAAAvU/URmhMXgkFT4/clip_image006_thumb%5B1%5D.gif?imgmax=800&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;clip_image006&quot; width=&quot;567&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://lh6.ggpht.com/_upmtKBKjH54/TPrBuLdbDlI/AAAAAAAAAvQ/tNa1_L_sqIw/s1600-h/clip_image006%5B4%5D.gif&quot;&gt;&lt;/a&gt; The ROC funtion improved is the following:&lt;br /&gt;
&amp;nbsp;  &lt;a href=&quot;http://lh6.ggpht.com/_upmtKBKjH54/TPrBveXS60I/AAAAAAAAAvY/6LwThsb1oog/s1600-h/clip_image008%5B4%5D.gif&quot;&gt;&lt;img alt=&quot;clip_image008&quot; border=&quot;0&quot; height=&quot;317&quot; src=&quot;http://lh3.ggpht.com/_upmtKBKjH54/TPrBwLrkg0I/AAAAAAAAAvc/LiWypP-8nhA/clip_image008_thumb%5B1%5D.gif?imgmax=800&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;clip_image008&quot; width=&quot;567&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;The % win trades is also improved&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;  &lt;a href=&quot;http://lh3.ggpht.com/_upmtKBKjH54/TPrBw3chtwI/AAAAAAAAAvg/RrO35YM2G6Y/s1600-h/clip_image010%5B4%5D.jpg&quot;&gt;&lt;img alt=&quot;clip_image010&quot; border=&quot;0&quot; height=&quot;78&quot; src=&quot;http://lh4.ggpht.com/_upmtKBKjH54/TPrBxj9vSXI/AAAAAAAAAvk/yYe1zqRPYzA/clip_image010_thumb%5B1%5D.jpg?imgmax=800&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;clip_image010&quot; width=&quot;556&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://lh3.ggpht.com/_upmtKBKjH54/TPrBw3chtwI/AAAAAAAAAvg/RrO35YM2G6Y/s1600-h/clip_image010%5B4%5D.jpg&quot;&gt;&lt;/a&gt;    It is possible to select other kind of optimization algorithm and to maximize or minimize other value like drawdown or other type of ratios like Kelly or sharpen ratio.  In the next tutorial, I will improve the trading operation in order to make as real as possible and to incorporate as XML configuration files the symbols.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://uploadnsell.com/buy/7C7nFn&quot;&gt;&lt;img alt=&quot;PayPal - The safer, easier way to pay online!&quot; src=&quot;https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;http://uploadnsell.com/buy/7C7nFn&quot;&gt;DOWNLOAD FILES&lt;/a&gt;&amp;nbsp; &lt;strong&gt;2$&lt;/strong&gt; &amp;lt; &lt;a href=&quot;http://lh5.ggpht.com/_upmtKBKjH54/TPrBze4Z-QI/AAAAAAAAAvw/k45Rv5qAf1U/s1600-h/clip_image014%5B6%5D.jpg&quot;&gt;&lt;img alt=&quot;clip_image014&quot; border=&quot;0&quot; height=&quot;52&quot; src=&quot;http://lh5.ggpht.com/_upmtKBKjH54/TPrB0dWxtrI/AAAAAAAAAv0/hGwj7AUBcus/clip_image014_thumb%5B3%5D.jpg?imgmax=800&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;clip_image014&quot; width=&quot;43&quot; /&gt;&lt;/a&gt;&lt;strong&gt;TO IMPROVE THE BLOG &lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;&lt;br /&gt;
&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;&lt;br /&gt;
&lt;/strong&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.aphysicistinwallstreet.com/feeds/4573872091335337199/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.aphysicistinwallstreet.com/2010/12/genetic-optimization-for-trading-using.html#comment-form' title='13 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4234070235858016856/posts/default/4573872091335337199'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4234070235858016856/posts/default/4573872091335337199'/><link rel='alternate' type='text/html' href='http://www.aphysicistinwallstreet.com/2010/12/genetic-optimization-for-trading-using.html' title='Genetic optimization for Trading Strategies using Rapidminer and R'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh4.ggpht.com/_upmtKBKjH54/TPrBrWSc_EI/AAAAAAAAAvE/FTm5WlcIQUQ/s72-c/clip_image002_thumb%5B1%5D.gif?imgmax=800" height="72" width="72"/><thr:total>13</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4234070235858016856.post-8150783295481273266</id><published>2010-11-23T13:06:00.001-08:00</published><updated>2010-11-23T13:06:14.397-08:00</updated><title type='text'>Trading Resources in R</title><content type='html'>&lt;p&gt;&lt;a href=&quot;http://lh4.ggpht.com/_upmtKBKjH54/TOwswIVveSI/AAAAAAAAAu0/wVtS5t7i9nc/s1600-h/clip_image002%5B4%5D.jpg&quot;&gt;&lt;img style=&quot;background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px 10px 0px 29px; padding-left: 0px; padding-right: 0px; display: inline; float: right; border-top: 0px; border-right: 0px; padding-top: 0px&quot; title=&quot;clip_image002&quot; border=&quot;0&quot; alt=&quot;clip_image002&quot; align=&quot;right&quot; src=&quot;http://lh6.ggpht.com/_upmtKBKjH54/TOwsxPx1ueI/AAAAAAAAAu4/cYfy7xoECoM/clip_image002_thumb%5B1%5D.jpg?imgmax=800&quot; width=&quot;177&quot; height=&quot;240&quot;&gt;&lt;/a&gt; &lt;p&gt;First apologize for the problem with the feed, I was playing with feedburner options. I am working on a new more advanced tutorial, that I hope to publish in the following days. &lt;p&gt;As a rookie in the life of the trading in R I made a collection of resources on topics related to finance in R. &lt;p&gt;The first place to see what packages exists in R for finance proposes is the CRAN R repository. CRAN Task Views allow you to browse packages by topic and Provide tools to Automatically install all packages for special areas of Interest. In special the finance view (a compilation of finance packages) This CRAN Task View contains a list of packages Useful for Empirical work in Finance,&amp;nbsp; group by topic: &lt;p&gt;1. Standard regression models &lt;p&gt;2. Time series &lt;p&gt;3. Finance &lt;p&gt;4. Risk management &lt;p&gt;5. Data and date management &lt;p&gt;&lt;b&gt;&lt;/b&gt; &lt;p&gt;Some of the most important packages are; the Rmetric suite, the quantmod package (offers a number of functions for quantitative modelling in finance as well as data acqusition, plotting and other utilities) and TTR (contains functions to construct technical trading rules in R). There are important information and examples inside each packages.  &lt;p&gt;In partiacular &lt;p&gt;&lt;a href=&quot;http://www.quantmod.com/&quot;&gt;http://www.quantmod.com&lt;/a&gt; &lt;p&gt;Where you can find several examples and documentation of this package. &lt;p&gt;Some of the websites where I can find examples of using R for Quant are: &lt;p&gt;&lt;a href=&quot;http://intelligenttradingtech.blogspot.com/&quot;&gt;http://intelligenttradingtech.blogspot.com/&lt;/a&gt; &lt;p&gt;One of the best. &lt;p&gt;&lt;a href=&quot;http://blog.fosstrading.com/&quot;&gt;http://blog.fosstrading.com/&lt;/a&gt; &lt;p&gt;Other inspiration blog. &lt;p&gt;&lt;a href=&quot;http://epchan.blogspot.com/&quot;&gt;http://epchan.blogspot.com&lt;/a&gt; &lt;p&gt;One place with good examples. &lt;p&gt;&lt;a href=&quot;http://www.r-chart.com/2010/06/stock-analysis-using-r.html&quot;&gt;http://www.r-chart.com/2010/06/stock-analysis-using-r.html&lt;/a&gt; &lt;p&gt;One place for Quant Finance &lt;p&gt;&lt;a href=&quot;http://quantumfinancier.wordpress.com/&quot;&gt;http://quantumfinancier.wordpress.com/&lt;/a&gt; &lt;p&gt;The best conference for R in finance is &lt;a href=&quot;http://www.rinfinance.com/&quot;&gt;http://www.rinfinance.com/&lt;/a&gt; &lt;p&gt;The two-day conference will cover portfolio management, time series analysis, advanced risk tools, high-performance computing, econometrics and more. All will be discussed within the context of using R as a primary tool for financial risk management, analysis and trading. &lt;p&gt;More Information is comming…..   </content><link rel='replies' type='application/atom+xml' href='http://www.aphysicistinwallstreet.com/feeds/8150783295481273266/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.aphysicistinwallstreet.com/2010/11/trading-resources-in-r.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4234070235858016856/posts/default/8150783295481273266'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4234070235858016856/posts/default/8150783295481273266'/><link rel='alternate' type='text/html' href='http://www.aphysicistinwallstreet.com/2010/11/trading-resources-in-r.html' title='Trading Resources in R'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh6.ggpht.com/_upmtKBKjH54/TOwsxPx1ueI/AAAAAAAAAu4/cYfy7xoECoM/s72-c/clip_image002_thumb%5B1%5D.jpg?imgmax=800" height="72" width="72"/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4234070235858016856.post-8517342673992325765</id><published>2010-11-21T12:34:00.001-08:00</published><updated>2010-11-21T12:34:39.745-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="General"/><category scheme="http://www.blogger.com/atom/ns#" term="trading"/><title type='text'>Impact of the RapidMiner + R First Tutorial</title><content type='html'>&lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;The first tutorial of RapidMiner and R extension has been a success. The most impotant blogs of this topic have links to a physicist in wallstreet blog.&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;&lt;a href=&quot;http://rapid-i.com/component/option,com_myblog/show,RapidMiner-and-R-for-Trading.html/Itemid,172/lang,en/&quot;&gt;Rapid - I - RapidMiner and R for Trading&lt;/a&gt; &lt;p&gt;&amp;nbsp; &lt;p&gt;&lt;a href=&quot;http://www.neuralmarkettrends.com/2010/11/20/an-example-of-r-and-rapidminer-for-trading/&quot;&gt;NeuralMarketTrends&lt;/a&gt; &lt;p&gt;&amp;nbsp; &lt;p&gt;&lt;a href=&quot;http://www.analyticbridge.com/group/OpenSourceDataMining/forum/topics/rapidminer-and-r-for-trading-1?xg_source=activity&quot;&gt;http://www.analyticbridge.com/&lt;/a&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;Thanks to all I hope to have the same impact in the coming entries.&lt;/p&gt;  </content><link rel='replies' type='application/atom+xml' href='http://www.aphysicistinwallstreet.com/feeds/8517342673992325765/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.aphysicistinwallstreet.com/2010/11/impact-of-rapidminer-r-first-tutorial.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4234070235858016856/posts/default/8517342673992325765'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4234070235858016856/posts/default/8517342673992325765'/><link rel='alternate' type='text/html' href='http://www.aphysicistinwallstreet.com/2010/11/impact-of-rapidminer-r-first-tutorial.html' title='Impact of the RapidMiner + R First Tutorial'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4234070235858016856.post-6377253503860417318</id><published>2010-11-18T13:56:00.001-08:00</published><updated>2010-11-25T13:02:10.939-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="R"/><category scheme="http://www.blogger.com/atom/ns#" term="rapidminer"/><category scheme="http://www.blogger.com/atom/ns#" term="strategies"/><category scheme="http://www.blogger.com/atom/ns#" term="tutorial"/><title type='text'>Rapidminer + R Example for Trading</title><content type='html'>RapidMiner + R is an advanced tool that can be used to analyze trading strategies, In order to check its power I made a simple example using an algorithm based on a support vector machine for predicting the next day&#39;s price and based on it I generated buying and selling signals. I have integrated quant indicators, SVM, and inally the strategy is evaluated.  &lt;br /&gt;
The requirements needed to build the model are, of course, RapidMiner, Weka extension, time series extension and the R extension. This requires installing R with quantmod, TTR and PerformanceAnalytics packages. There is a thread to solve any problem &lt;a href=&quot;http://rapid-i.com/rapidforum/index.php/topic,2612.0.html&quot;&gt;here &lt;/a&gt; &lt;br /&gt;
To be able to reproduce my results I will detail each of the modules of the following figure:  &lt;br /&gt;
&lt;a href=&quot;http://lh5.ggpht.com/_upmtKBKjH54/TOWpGy1A48I/AAAAAAAAAt8/CsrDhISd_AE/s1600-h/flow%5B4%5D.png&quot;&gt;&lt;img alt=&quot;flow&quot; border=&quot;0&quot; height=&quot;379&quot; src=&quot;http://lh5.ggpht.com/_upmtKBKjH54/TOWpH6hU-KI/AAAAAAAAAuA/cGZ5ZWldl40/flow_thumb%5B2%5D.png?imgmax=800&quot; style=&quot;background-image: none; border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;flow&quot; width=&quot;636&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;b&gt;&lt;u&gt;1. R Process.&lt;/u&gt;&lt;/b&gt;  &lt;br /&gt;
The objective is to process data from Yahoo finance and build the most common indicators to add to the series, these indicators have been taken considering the following article.To this end, &lt;a href=&quot;http://www.eecs.berkeley.edu/Pubs/TechRpts/2010/EECS-2010-63.pdf&quot;&gt;here&lt;/a&gt; is a new paper written by an engineering student at UC Berkeley which uses &quot;support vector machine&quot; together with 10 simple technical indicators to predict the SPX index, purportedly with 60% accuracy  &lt;br /&gt;
The content of the process is detailled here:  &lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
***********************************************  &lt;br /&gt;
&lt;span style=&quot;background-color: #cccccc;&quot;&gt;library(quantmod)&lt;/span&gt;  &lt;br /&gt;
&lt;span style=&quot;background-color: #cccccc;&quot;&gt;library(TTR)&lt;/span&gt;  &lt;br /&gt;
&lt;span style=&quot;background-color: #cccccc;&quot;&gt;library(PerformanceAnalytics)&lt;/span&gt;  &lt;br /&gt;
&lt;span style=&quot;background-color: #cccccc;&quot;&gt;# pull IBM data from Yahoo Finance&lt;/span&gt;  &lt;br /&gt;
&lt;span style=&quot;background-color: #cccccc;&quot;&gt;getSymbols(&quot;IBM&quot;,from=&quot;2003-01-01&quot;)&lt;/span&gt;  &lt;br /&gt;
&lt;span style=&quot;background-color: #cccccc;&quot;&gt;# Introduce RSI Indicator&lt;/span&gt;  &lt;br /&gt;
&lt;span style=&quot;background-color: #cccccc;&quot;&gt;IBM$RSI2 = RSI(Cl(IBM), 2)&lt;/span&gt;  &lt;br /&gt;
&lt;span style=&quot;background-color: #cccccc;&quot;&gt;#Introduce Eponential Moving Average indicator&lt;/span&gt;  &lt;br /&gt;
&lt;span style=&quot;background-color: #cccccc;&quot;&gt;IBM$EMA7=EMA(Cl(IBM), n=7, wilder=FALSE, ratio=NULL)&lt;/span&gt;  &lt;br /&gt;
&lt;span style=&quot;background-color: #cccccc;&quot;&gt;IBM$EMA50=EMA(Cl(IBM), n=50, wilder=FALSE, ratio=NULL)&lt;/span&gt;  &lt;br /&gt;
&lt;span style=&quot;background-color: #cccccc;&quot;&gt;IBM$EMA200=EMA(Cl(IBM), n=200, wilder=FALSE, ratio=NULL)&lt;/span&gt;  &lt;br /&gt;
&lt;span style=&quot;background-color: #cccccc;&quot;&gt;#Introduce MACD indicator&lt;/span&gt;  &lt;br /&gt;
&lt;span style=&quot;background-color: #cccccc;&quot;&gt;IBM$MACD26=MACD(Cl(IBM), nFast=12, nSlow=26, nSig=9)&lt;/span&gt;  &lt;br /&gt;
&lt;span style=&quot;background-color: #cccccc;&quot;&gt;#Introduce ADX indicator &lt;/span&gt; &lt;br /&gt;
&lt;span style=&quot;background-color: #cccccc;&quot;&gt;IBM$ADX14=ADX(IBM, n=14)&lt;/span&gt;  &lt;br /&gt;
&lt;span style=&quot;background-color: #cccccc;&quot;&gt;#results &amp;lt;-transform(IBM,RSI.IBM=RSI(Cl(IBM), 2),RETURN=ret ,TIME=as.character(index(IBM)))&lt;/span&gt;  &lt;br /&gt;
&lt;span style=&quot;background-color: #cccccc;&quot;&gt;# remove 2003,2004,2005 in order to avoid NaN from EMA indicators&lt;/span&gt;  &lt;br /&gt;
&lt;span style=&quot;background-color: #cccccc;&quot;&gt;# To maintain time it is necessary to conver in texts&lt;/span&gt;  &lt;br /&gt;
&lt;span style=&quot;background-color: #cccccc;&quot;&gt;results &amp;lt;-transform(IBM[&quot;2006-01-01::2009-01-01&quot;],TIME=as.character(index(IBM[&quot;2006-01-01::2009-01-01&quot;])))&lt;/span&gt;  &lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
***********************************************&lt;br /&gt;
&lt;span style=&quot;background-color: #cccccc;&quot;&gt;&lt;/span&gt;&amp;nbsp; &lt;br /&gt;
The output of the system is:  &lt;br /&gt;
&lt;a href=&quot;http://lh6.ggpht.com/_upmtKBKjH54/TOWg4tQmGlI/AAAAAAAAArc/sLUEx7mEpic/s1600-h/clip_image004%5B4%5D.jpg&quot;&gt;&lt;img alt=&quot;clip_image004&quot; border=&quot;0&quot; height=&quot;429&quot; src=&quot;http://lh5.ggpht.com/_upmtKBKjH54/TOWg5auWj7I/AAAAAAAAArk/s8L1-Nytjto/clip_image004_thumb%5B1%5D.jpg?imgmax=800&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;clip_image004&quot; width=&quot;571&quot; /&gt;&lt;/a&gt;  &lt;br /&gt;
&lt;b&gt;&lt;u&gt;2. String to Time (Nominal to Date)&lt;/u&gt;&lt;/b&gt;  &lt;br /&gt;
We convert date string to Date.  &lt;br /&gt;
&lt;a href=&quot;http://lh5.ggpht.com/_upmtKBKjH54/TOWpI8yQDvI/AAAAAAAAAuE/UqF_wzA1Qzs/s1600-h/stringtotime%5B4%5D.png&quot;&gt;&lt;img alt=&quot;stringtotime&quot; border=&quot;0&quot; height=&quot;634&quot; src=&quot;http://lh6.ggpht.com/_upmtKBKjH54/TOWpKC_IymI/AAAAAAAAAuI/UwVl4RNTHLQ/stringtotime_thumb%5B5%5D.png?imgmax=800&quot; style=&quot;background-image: none; border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;stringtotime&quot; width=&quot;371&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;b&gt;&lt;u&gt;3. Close adjuste to Label&lt;/u&gt;&lt;/b&gt;  &lt;br /&gt;
We put label the IBM adjusted close value in order to predict one day in advance..  &lt;br /&gt;
&lt;a href=&quot;http://lh3.ggpht.com/_upmtKBKjH54/TOWpK6-OxYI/AAAAAAAAAuM/i0HbljDf1zM/s1600-h/ibmlabel%5B4%5D.png&quot;&gt;&lt;img alt=&quot;ibmlabel&quot; border=&quot;0&quot; height=&quot;655&quot; src=&quot;http://lh4.ggpht.com/_upmtKBKjH54/TOWpMCmqnVI/AAAAAAAAAuQ/11czSWf2aiw/ibmlabel_thumb%5B6%5D.png?imgmax=800&quot; style=&quot;background-image: none; border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;ibmlabel&quot; width=&quot;377&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;b&gt;&lt;u&gt;4. set Time to ID (Set Role)&lt;/u&gt;&lt;/b&gt;  &lt;br /&gt;
&lt;b&gt;&lt;u&gt;&lt;/u&gt;&lt;/b&gt; &lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
We use the TIME as ID for time serie data.  &lt;br /&gt;
&lt;b&gt;&lt;u&gt;5. Widowing&lt;/u&gt;&lt;/b&gt;  &lt;br /&gt;
We move one day in the future the variable to predict and add 2 new columns with lagged values in a time window of 2 days.  &lt;br /&gt;
&lt;a href=&quot;http://lh5.ggpht.com/_upmtKBKjH54/TOWpMysEUzI/AAAAAAAAAuU/EAL3YbX_bU0/s1600-h/widowing%5B4%5D.png&quot;&gt;&lt;img alt=&quot;widowing&quot; border=&quot;0&quot; height=&quot;683&quot; src=&quot;http://lh3.ggpht.com/_upmtKBKjH54/TOWpNxPyVEI/AAAAAAAAAuY/NI-imnJaJBg/widowing_thumb%5B5%5D.png?imgmax=800&quot; style=&quot;background-image: none; border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;widowing&quot; width=&quot;413&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;b&gt;&lt;u&gt;6. % sliding Window Validation&lt;/u&gt;&lt;/b&gt;  &lt;br /&gt;
&lt;a href=&quot;http://lh6.ggpht.com/_upmtKBKjH54/TOWpO7mt4-I/AAAAAAAAAuc/TLMQhxepCM4/s1600-h/sliding%5B4%5D.png&quot;&gt;&lt;img alt=&quot;sliding&quot; border=&quot;0&quot; height=&quot;657&quot; src=&quot;http://lh5.ggpht.com/_upmtKBKjH54/TOWpQDif3EI/AAAAAAAAAug/SUX-9crUDi4/sliding_thumb%5B5%5D.png?imgmax=800&quot; style=&quot;background-image: none; border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;sliding&quot; width=&quot;391&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
Time series validation  &lt;br /&gt;
&lt;a href=&quot;http://lh6.ggpht.com/_upmtKBKjH54/TOWpRSGLlCI/AAAAAAAAAuk/OzG6ylspaNY/s1600-h/validation%5B4%5D.png&quot;&gt;&lt;img alt=&quot;validation&quot; border=&quot;0&quot; height=&quot;340&quot; src=&quot;http://lh5.ggpht.com/_upmtKBKjH54/TOWpSTZ6wuI/AAAAAAAAAuo/wIzSC3ukEkw/validation_thumb%5B2%5D.png?imgmax=800&quot; style=&quot;background-image: none; border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;validation&quot; width=&quot;570&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
We use the Support Vector Machine Weka implementation  &lt;br /&gt;
&lt;a href=&quot;http://lh4.ggpht.com/_upmtKBKjH54/TOWpTgF0KYI/AAAAAAAAAus/ciOZSrrecmM/s1600-h/validation2%5B5%5D.png&quot;&gt;&lt;img alt=&quot;validation2&quot; border=&quot;0&quot; height=&quot;305&quot; src=&quot;http://lh6.ggpht.com/_upmtKBKjH54/TOWpUgxeYTI/AAAAAAAAAuw/617CliS0_x0/validation2_thumb%5B6%5D.png?imgmax=800&quot; style=&quot;background-image: none; border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;validation2&quot; width=&quot;738&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
You can improve the accuracy of the prediction algorithm using any parameter optimizer or attribute selection.  &lt;br /&gt;
Now Validation process  &lt;br /&gt;
&lt;b&gt;&lt;u&gt;7.. Obtain Technical Test data &lt;/u&gt;&lt;/b&gt; &lt;br /&gt;
This module is similar to the first one except we use evaluation data from the last year  &lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
***********************************************&lt;br /&gt;
library(quantmod)  &lt;br /&gt;
library(TTR)  &lt;br /&gt;
library(PerformanceAnalytics)  &lt;br /&gt;
# pull IBM data from Yahoo Finance  &lt;br /&gt;
getSymbols(&quot;IBM&quot;,from=&quot;2009-01-01&quot;)  &lt;br /&gt;
# Introduce RSI Indicator  &lt;br /&gt;
IBM$RSI2 = RSI(Cl(IBM), 2)  &lt;br /&gt;
#Introduce Eponential Moving Average indicator  &lt;br /&gt;
IBM$EMA7=EMA(Cl(IBM), n=7, wilder=FALSE, ratio=NULL)  &lt;br /&gt;
IBM$EMA50=EMA(Cl(IBM), n=50, wilder=FALSE, ratio=NULL)  &lt;br /&gt;
IBM$EMA200=EMA(Cl(IBM), n=200, wilder=FALSE, ratio=NULL)  &lt;br /&gt;
#Introduce MACD indicator  &lt;br /&gt;
IBM$MACD26=MACD(Cl(IBM), nFast=12, nSlow=26, nSig=9)  &lt;br /&gt;
#Introduce ADX indicator  &lt;br /&gt;
IBM$ADX14=ADX(IBM, n=14)  &lt;br /&gt;
#results &amp;lt;-transform(IBM,RSI.IBM=RSI(Cl(IBM), 2),RETURN=ret ,TIME=as.character(index(IBM)))  &lt;br /&gt;
# remove 2009 in order to avoid NaN from EMA indicators 2010 evaluation  &lt;br /&gt;
# To maintain time it is necessary to conver in texts  &lt;br /&gt;
results &amp;lt;-transform(IBM[&quot;2010-01-01::&quot;],TIME=as.character(index(IBM[&quot;2010-01-01::&quot;])))  &lt;br /&gt;
.  &lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
***********************************************&lt;br /&gt;
&lt;br /&gt;
We use a similar pre-process Flow..  &lt;br /&gt;
&lt;a href=&quot;http://lh5.ggpht.com/_upmtKBKjH54/TOWhE8DIH1I/AAAAAAAAAtM/VxeJCyWa43I/s1600-h/clip_image020%5B4%5D.jpg&quot;&gt;&lt;img alt=&quot;clip_image020&quot; border=&quot;0&quot; height=&quot;283&quot; src=&quot;http://lh6.ggpht.com/_upmtKBKjH54/TOWhFli6lDI/AAAAAAAAAtU/sreWGvbZ6C8/clip_image020_thumb%5B1%5D.jpg?imgmax=800&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;clip_image020&quot; width=&quot;571&quot; /&gt;&lt;/a&gt;  &lt;br /&gt;
&lt;b&gt;&lt;u&gt;11. Apply Model&lt;/u&gt;&lt;/b&gt;  &lt;br /&gt;
We will apply the model obtained before  &lt;br /&gt;
And finally we analyze the trading strategy results  &lt;br /&gt;
&lt;b&gt;&lt;u&gt;12. Prediction Lable as Regular (Set Role)&lt;/u&gt;&lt;/b&gt;  &lt;br /&gt;
It is modified the predicted label to use inside R process.  &lt;br /&gt;
&lt;b&gt;&lt;u&gt;13. Date to Nominal &lt;/u&gt;&lt;/b&gt; &lt;br /&gt;
It is modified the date to nominal to use it in R process.  &lt;br /&gt;
&lt;b&gt;&lt;u&gt;14. Set TIME as Regular (Set Role)&lt;/u&gt;&lt;/b&gt;  &lt;br /&gt;
It is modified the TIME attributte as a regular to use it in R process..  &lt;br /&gt;
&lt;b&gt;&lt;u&gt;15. Set TIME as Regular (Set Role)&lt;/u&gt;&lt;/b&gt;  &lt;br /&gt;
This script is inspired in &lt;a href=&quot;http://blog.fosstrading.com/2009/04/testing-rsi2-with-r.html&quot;&gt;FOSS trading code&lt;/a&gt;.  &lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
***********************************************&lt;br /&gt;
library(quantmod)  &lt;br /&gt;
library(TTR)  &lt;br /&gt;
library(PerformanceAnalytics)  &lt;br /&gt;
# 31 prediction close_ROCel&lt;br /&gt;
# 33 close_ROCel&lt;br /&gt;
close_ROC &amp;lt;- ROC(data[33])&lt;br /&gt;
dates = as.Date(data$TIME)&lt;br /&gt;
prediction_ROC &amp;lt;-ROC(data[31])&lt;br /&gt;
close_ROC[1] &amp;lt;- 0&lt;br /&gt;
prediction_ROC[1] &amp;lt;- 0  &lt;br /&gt;
#generate signals from prediction values  &lt;br /&gt;
sigup &amp;lt;- ifelse(prediction_ROC &amp;gt; 0, 1, 0)  &lt;br /&gt;
sigdn &amp;lt;- ifelse(prediction_ROC &amp;lt; 0, -1, 0)  &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)] &amp;lt;- 0  &lt;br /&gt;
sigdn[is.na(sigdn)] &amp;lt;- 0  &lt;br /&gt;
sig &amp;lt;- sigup + sigdn  &lt;br /&gt;
# Calculate equity curves  &lt;br /&gt;
eq_up &amp;lt;- cumprod(1+close_ROC*sigup)  &lt;br /&gt;
eq_dn &amp;lt;- cumprod(1+close_ROC*sigdn)  &lt;br /&gt;
eq_all &amp;lt;- cumprod(1+close_ROC*sig)  &lt;br /&gt;
# obtain result  &lt;br /&gt;
result &amp;lt;-transform(data,sig=sig ,ret=close_ROC, eq_up=eq_up, eq_dn=eq_dn, eq_all=eq_all)  &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;
# 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;
# 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;
colnames(means) &amp;lt;- c(&quot;Signal&quot;,&quot;% Win&quot;,&quot;Mean Win&quot;,&quot;Mean Loss&quot;)  &lt;br /&gt;
colnames(medians) &amp;lt;- c(&quot;Signal&quot;,&quot;Median Win&quot;,&quot;Median Loss&quot;)  &lt;br /&gt;
colnames(sums) &amp;lt;- c(&quot;Signal&quot;,&quot;# Trades&quot;)  &lt;br /&gt;
all &amp;lt;- merge(sums,means)  &lt;br /&gt;
all &amp;lt;- merge(all,medians)  &lt;br /&gt;
wl &amp;lt;- cbind( abs(all[,&quot;Mean Win&quot;]/all[,&quot;Mean Loss&quot;]),  &lt;br /&gt;
abs(all[,&quot;Median Win&quot;]/all[,&quot;Median Loss&quot;]) )  &lt;br /&gt;
colnames(wl) &amp;lt;- c(&quot;Mean W/L&quot;,&quot;Median W/L&quot;)  &lt;br /&gt;
all &amp;lt;- cbind(all,wl)  &lt;br /&gt;
return(all)  &lt;br /&gt;
}  &lt;br /&gt;
# trade stats  &lt;br /&gt;
stats&amp;lt;- as.data.frame(tradeStats(sig,close_ROC))  &lt;br /&gt;
ret_all&amp;lt;-close_ROC  &lt;br /&gt;
xts.ts &amp;lt;- xts(ret_all,dates)  &lt;br /&gt;
drawdownrport = table.Drawdowns(xts.ts)  &lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
***********************************************  &lt;br /&gt;
&lt;br /&gt;
In the following graph you can see the not well ROC of this strategy  &lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhLX_PUKqkN9RPVgnuJQwGe-4E9Ls1x74D2d4XlwDcdjonZZftMyM2aamEw6eKU_-jD8vxU4fJLlj6jdlBIaOny7YLQcJdzQ5daBKHsAqWChYDcjYVNiQLzsHY5qLhS4pjfypVODSLPowtl/s1600/Sin+t%25C3%25ADtulo.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;235&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhLX_PUKqkN9RPVgnuJQwGe-4E9Ls1x74D2d4XlwDcdjonZZftMyM2aamEw6eKU_-jD8vxU4fJLlj6jdlBIaOny7YLQcJdzQ5daBKHsAqWChYDcjYVNiQLzsHY5qLhS4pjfypVODSLPowtl/s400/Sin+t%25C3%25ADtulo.jpg&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
Return obtained during buy and shell signals  &lt;br /&gt;
&lt;a href=&quot;http://lh6.ggpht.com/_upmtKBKjH54/TOWhHvx25VI/AAAAAAAAAto/ZEsjaqfsuo4/s1600-h/clip_image024%5B4%5D.jpg&quot;&gt;&lt;img alt=&quot;clip_image024&quot; border=&quot;0&quot; height=&quot;74&quot; src=&quot;http://lh5.ggpht.com/_upmtKBKjH54/TOWhIZ3edqI/AAAAAAAAAt0/vZMcKcrqEEM/clip_image024_thumb%5B1%5D.jpg?imgmax=800&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;clip_image024&quot; width=&quot;575&quot; /&gt;&lt;/a&gt;  &lt;br /&gt;
This strategy is a simplification, and that should be understand as a proof of concept.  &lt;br /&gt;
All information is in this tutorial, however if you want to &lt;a href=&quot;http://uploadnsell.com/buy/pZgaFV&quot;&gt;&lt;img alt=&quot;clip_image025&quot; border=&quot;0&quot; height=&quot;25&quot; src=&quot;http://lh6.ggpht.com/_upmtKBKjH54/TOWhJLIcwpI/AAAAAAAAArQ/srRmgvtAbcQ/clip_image025%5B4%5D.jpg?imgmax=800&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;clip_image025&quot; width=&quot;25&quot; /&gt;&lt;/a&gt; an small quantity of money to improve this web you can obtain the files&lt;a href=&quot;http://uploadnsell.com/buy/pZgaFV&quot;&gt; here.&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.aphysicistinwallstreet.com/feeds/6377253503860417318/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.aphysicistinwallstreet.com/2010/11/example-rapidminer-r-for-trading.html#comment-form' title='16 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4234070235858016856/posts/default/6377253503860417318'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4234070235858016856/posts/default/6377253503860417318'/><link rel='alternate' type='text/html' href='http://www.aphysicistinwallstreet.com/2010/11/example-rapidminer-r-for-trading.html' title='Rapidminer + R Example for Trading'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh5.ggpht.com/_upmtKBKjH54/TOWpH6hU-KI/AAAAAAAAAuA/cGZ5ZWldl40/s72-c/flow_thumb%5B2%5D.png?imgmax=800" height="72" width="72"/><thr:total>16</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4234070235858016856.post-6419873218287323231</id><published>2010-10-23T16:27:00.001-07:00</published><updated>2010-10-23T16:28:32.816-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="R"/><category scheme="http://www.blogger.com/atom/ns#" term="rapidminer"/><category scheme="http://www.blogger.com/atom/ns#" term="tutorial"/><title type='text'>R &amp;amp; Rapidminer tutorial</title><content type='html'>&lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;You can see in the following video a simple tutorial of Rapidminer R plugin&lt;/p&gt;  &lt;div style=&quot;padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px&quot; id=&quot;scid:5737277B-5D6D-4f48-ABFC-DD9C333F4C5D:139178c1-1d4b-4e53-bb4d-3a9349b9e4fa&quot; class=&quot;wlWriterEditableSmartContent&quot;&gt;&lt;div id=&quot;825f3237-27e6-47e2-bfaf-872b27cf5543&quot; style=&quot;margin: 0px; padding: 0px; display: inline;&quot;&gt;&lt;div&gt;&lt;a href=&quot;http://www.youtube.com/watch?v=utKJzXc1Cow&amp;amp;feature=player_embedded&quot; target=&quot;_new&quot;&gt;&lt;img src=&quot;http://lh6.ggpht.com/_upmtKBKjH54/TMNvZ_orxeI/AAAAAAAAApg/NMThym9nD7E/video6ef0d830bc14%5B13%5D.jpg?imgmax=800&quot; style=&quot;border-style: none&quot; galleryimg=&quot;no&quot; onload=&quot;var downlevelDiv = document.getElementById(&#39;825f3237-27e6-47e2-bfaf-872b27cf5543&#39;); downlevelDiv.innerHTML = &amp;quot;&amp;lt;div&amp;gt;&amp;lt;object width=\&amp;quot;625\&amp;quot; height=\&amp;quot;351\&amp;quot;&amp;gt;&amp;lt;param name=\&amp;quot;movie\&amp;quot; value=\&amp;quot;http://www.youtube.com/v/utKJzXc1Cow?hl=en&amp;amp;hd=1\&amp;quot;&amp;gt;&amp;lt;\/param&amp;gt;&amp;lt;embed src=\&amp;quot;http://www.youtube.com/v/utKJzXc1Cow?hl=en&amp;amp;hd=1\&amp;quot; type=\&amp;quot;application/x-shockwave-flash\&amp;quot; width=\&amp;quot;625\&amp;quot; height=\&amp;quot;351\&amp;quot;&amp;gt;&amp;lt;\/embed&amp;gt;&amp;lt;\/object&amp;gt;&amp;lt;\/div&amp;gt;&amp;quot;;&quot; alt=&quot;&quot;&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;width:625px;clear:both;font-size:.8em&quot;&gt;Rapidminer R extension tutorial&lt;/div&gt;&lt;/div&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;via: &lt;a href=&quot;http://www.neuralmarkettrends.com/2010/09/03/rapidminer-r-together-at-last/&quot;&gt;neuralmarkettrends&lt;/a&gt;.&lt;/p&gt;  </content><link rel='replies' type='application/atom+xml' href='http://www.aphysicistinwallstreet.com/feeds/6419873218287323231/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.aphysicistinwallstreet.com/2010/10/r-rapidminer-tutorial.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4234070235858016856/posts/default/6419873218287323231'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4234070235858016856/posts/default/6419873218287323231'/><link rel='alternate' type='text/html' href='http://www.aphysicistinwallstreet.com/2010/10/r-rapidminer-tutorial.html' title='R &amp;amp; Rapidminer tutorial'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4234070235858016856.post-2556417032228692875</id><published>2010-10-23T15:39:00.001-07:00</published><updated>2010-10-23T15:41:43.832-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="General"/><category scheme="http://www.blogger.com/atom/ns#" term="tools"/><title type='text'>Mathematical Trading Tools</title><content type='html'>&lt;p&gt;&lt;a href=&quot;http://lh3.ggpht.com/_upmtKBKjH54/TMNkAWRmWLI/AAAAAAAAApM/GFYkxTjBkNw/s1600-h/image%5B3%5D.png&quot;&gt;&lt;img style=&quot;background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: left; border-top: 0px; border-right: 0px; padding-top: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; align=&quot;left&quot; src=&quot;http://lh6.ggpht.com/_upmtKBKjH54/TMNkBz6fGjI/AAAAAAAAApU/aMVe7y8hTw4/image_thumb%5B1%5D.png?imgmax=800&quot; width=&quot;334&quot; height=&quot;165&quot; /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;font size=&quot;3&quot;&gt;From a trading perspective, it is important to find tools or programming languages in order to generate trading strategies that will improve our chances of success. This is where you can choose different types of tools or frameworks to generate trading strategies; I will differentiate between 3 kinds of tools:&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size=&quot;3&quot;&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size=&quot;3&quot;&gt;- &lt;b&gt;Integrated Trading Tools&lt;/b&gt;: Tools for programming simple strategies, or for generating new indicators, this kinds of tools are normally integrated with commercial packages, VisualChart, MetaTrader, NinjaTrader or ProRealTime. The biggest advantage is its simplicity and its integration with traditional trading tools:&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size=&quot;3&quot;&gt;- &lt;b&gt;General Statistics or Data Mining Tools&lt;/b&gt;: In this category we find tools such as &lt;/font&gt;&lt;a href=&quot;http://www.mathworks.com/products/matlab/&quot;&gt;&lt;font size=&quot;3&quot;&gt;Matlab&lt;/font&gt;&lt;/a&gt;&lt;font size=&quot;3&quot;&gt;, &lt;/font&gt;&lt;a href=&quot;http://www.r-project.org/&quot;&gt;&lt;font size=&quot;3&quot;&gt;R&lt;/font&gt;&lt;/a&gt;&lt;font size=&quot;3&quot;&gt; o &lt;/font&gt;&lt;a href=&quot;http://rapid-i.com/content/view/181/190/lang,en/&quot;&gt;&lt;font size=&quot;3&quot;&gt;RapidMiner&lt;/font&gt;&lt;/a&gt;&lt;font size=&quot;3&quot;&gt;. These applications are characterized by strong generic mathematical packages that integrate froms statistics functions to neural networks functions. Due to its mathematical power are used widely in the field of finance.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size=&quot;3&quot;&gt;- &lt;b&gt;Programming languages&lt;/b&gt;: There are many programming languages like c / c++, Java, SQL and allow us to automate our trading strategies. We can program any strategy using multiples finance libraries in internet to obtain maximum power and flexibility, at the expense of increasing the time cost and complexity to obtain a final solution.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size=&quot;3&quot;&gt;From the different types of tools, I prefer the second type o tools, being one step ahead of the tools included in conventional trading packages. They provide a simple programming environments to create complex strategies.&amp;#160; Matlab is one of the mathematical and engineering tools most used, its computing power and libraries make it suitable from aerospace to finance sector. In Matlab, there is a specific module for finance,rom my point of view is the most complete framework. The main drawback is the high Price. Project R represents a similar framework to Matlab but from the OpenSource world. There are multiple modules for stock trading, from portfolio management to the generation of indicators. Their capacities in this sector have nothing to envy of Matlab. Finally RapidMiner is an OpenSource package focused on the pre-processing, analysis and data mining. One of its strengths is the library of classifiers and function approximators based on neural networks, Support Vector Machines, bayesians networks… that allow to be extrapolated to the world of trading (this last one can find examples &lt;/font&gt;&lt;a href=&quot;http://www.neuralmarkettrends.com/&quot;&gt;&lt;font size=&quot;3&quot;&gt;neuralmarketrends&lt;/font&gt;&lt;/a&gt;&lt;font size=&quot;3&quot;&gt;). Finally it should be noted that there is a plugin that integrates the best of RapidMiner with R. I will start usign this package to work and get results.&lt;/font&gt;&lt;/p&gt;  </content><link rel='replies' type='application/atom+xml' href='http://www.aphysicistinwallstreet.com/feeds/2556417032228692875/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.aphysicistinwallstreet.com/2010/10/mathematical-trading-tools.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4234070235858016856/posts/default/2556417032228692875'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4234070235858016856/posts/default/2556417032228692875'/><link rel='alternate' type='text/html' href='http://www.aphysicistinwallstreet.com/2010/10/mathematical-trading-tools.html' title='Mathematical Trading Tools'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh6.ggpht.com/_upmtKBKjH54/TMNkBz6fGjI/AAAAAAAAApU/aMVe7y8hTw4/s72-c/image_thumb%5B1%5D.png?imgmax=800" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4234070235858016856.post-3059394390610894741</id><published>2010-01-23T15:59:00.000-08:00</published><updated>2010-10-23T15:57:08.420-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="General"/><title type='text'>Where do I get Exchange data?</title><content type='html'>&lt;p&gt;&lt;a href=&quot;http://unfisicoenlabolsa.files.wordpress.com/2010/01/data.jpg&quot;&gt;&lt;img style=&quot;border-right-width: 0px; margin: 15px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px&quot; title=&quot;data&quot; border=&quot;0&quot; alt=&quot;data&quot; align=&quot;left&quot; src=&quot;http://unfisicoenlabolsa.files.wordpress.com/2010/01/data_thumb.jpg&quot; width=&quot;262&quot; height=&quot;244&quot; /&gt;&lt;/a&gt;    &lt;br /&gt;    &lt;br /&gt;&lt;span style=&quot;font-family: arial, sans-serif; font-size: 16px&quot; class=&quot;Apple-style-span&quot;&gt;&lt;span title=&quot;&quot;&gt;To obtain data to make trading decisions, there are two possible ways.&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: arial, sans-serif; font-size: 16px&quot; class=&quot;Apple-style-span&quot;&gt;&lt;span title=&quot;&quot;&gt;The real-time payment with different degrees of market depth, and free that are not usually in real time. The&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: arial, sans-serif; font-size: 16px&quot; class=&quot;Apple-style-span&quot;&gt;&lt;span title=&quot;&quot;&gt; payment, usually contracted throught your broker or trading platform used. &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style=&quot;font-family: arial, sans-serif; font-size: 16px&quot; class=&quot;Apple-style-span&quot;&gt;&lt;span title=&quot;&quot;&gt;For example Visual chart is one of the most famous stock market investment platform, the application is free of charge, but the data, if you want real time data is necessary to contract the service, the price is dependent on the number of markets to be monitored. On the other hand if you&#39;re an investor who do not need real time&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: arial, sans-serif; font-size: 16px&quot; class=&quot;Apple-style-span&quot;&gt;&lt;span title=&quot;&quot;&gt;, the application allows you to download the data fat the end of the session. &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style=&quot;font-family: arial, sans-serif; font-size: 16px&quot; class=&quot;Apple-style-span&quot;&gt;&lt;span title=&quot;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: arial, sans-serif; font-size: 16px&quot; class=&quot;Apple-style-span&quot;&gt;&lt;span title=&quot;&quot;&gt;Perhaps the most common internet provider that offers free data is Yahoo Finance, which allows for both historical and intraday (delayed 15 minutes.) There are m&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: arial, sans-serif; font-size: 16px&quot; class=&quot;Apple-style-span&quot;&gt;&lt;span title=&quot;&quot;&gt;ultiples&amp;#160; applications, thats allows us to&amp;#160; obtain these data, but you can simply go to yahoo page and download the historical in an excel. &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: arial, sans-serif; font-size: 16px&quot; class=&quot;Apple-style-span&quot;&gt;&lt;span title=&quot;&quot;&gt;In this service we can find any index or stock. &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: arial, sans-serif; font-size: 16px&quot; class=&quot;Apple-style-span&quot;&gt;&lt;span title=&quot;&quot;&gt;Yahoo finance allows to see graphics, with the most common indicators that we use. &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: arial, sans-serif; font-size: 16px&quot; class=&quot;Apple-style-span&quot;&gt;&lt;span title=&quot;&quot;&gt;In addition, although no historical data can be extracted most brokers offer for free the real-time data, such as Interdin in our case. &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: arial, sans-serif; font-size: 16px&quot; class=&quot;Apple-style-span&quot;&gt;&lt;span title=&quot;&quot;&gt;Analyze how I will use is the following.       &lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  </content><link rel='replies' type='application/atom+xml' href='http://www.aphysicistinwallstreet.com/feeds/3059394390610894741/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.aphysicistinwallstreet.com/2010/01/de-donde-saco-los-datos-de-bolsa.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4234070235858016856/posts/default/3059394390610894741'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4234070235858016856/posts/default/3059394390610894741'/><link rel='alternate' type='text/html' href='http://www.aphysicistinwallstreet.com/2010/01/de-donde-saco-los-datos-de-bolsa.html' title='Where do I get Exchange data?'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry></feed>