<div dir="ltr"><div>Hello all,</div><div><br></div><div>I am trying to backtest a long/short portfolio using Return.Portfolio but am running into some sort of error, or I do not fully understand how to use return.portfolio.</div><div><br></div><div>For a quarterly rebalancing of shorts, I am providing monthly returns, a set of negative</div><div>weights in an xts format on quarter dates (created by to.period), the final argument is rebalance_on="quarters".</div><div><br></div><div>The result is an set of regular zigzags where the position changes too regularly. <img width="473" height="400" alt="Inline images 2" src="cid:ii_15c53159cb6eea38"> </div><div>The code:</div><pre tabindex="0" class="gmail-GGHFMYIBMOB" id="gmail-rstudio_console_output" style="font:10pt/12.5px "Lucida Console";margin:0px;outline:invert;border:medium;color:rgb(234,234,234);text-transform:none;text-indent:0px;letter-spacing:normal;word-spacing:0px;white-space:pre-wrap;word-break:break-all;font-size-adjust:none;font-stretch:normal;background-color:rgb(44,40,40)"><span class="gmail-GGHFMYIBCOB gmail-ace_keyword" style="color:rgb(117,122,216)">head(monthly.returns[,1:3])
</span> AXA.Returns Accor.Returns Air.Liquide.Returns
1987-01-31 NA NA NA
1987-02-28 -0.039941766 -0.00311151 -0.03195942
1987-03-31 0.008723886 0.03936148 0.07320454
1987-04-30 0.005995543 -0.04579859 -0.01919371
1987-05-31 -0.055431515 -0.10515575 -0.03495027
1987-06-30 -0.145464190 -0.02607130 -0.04062429</pre><pre tabindex="0" class="gmail-GGHFMYIBMOB" style="margin:0px;outline:invert;border:medium;color:rgb(234,234,234);text-transform:none;line-height:12.5px;text-indent:0px;letter-spacing:normal;font-family:"Lucida Console";font-size:10pt;font-variant:normal;word-spacing:0px;white-space:pre-wrap;word-break:break-all;font-size-adjust:none;font-stretch:normal;background-color:rgb(44,40,40)"><pre tabindex="0" class="gmail-GGHFMYIBMOB" id="gmail-rstudio_console_output" style="font:10pt/12.5px "Lucida Console";margin:0px;outline:invert;border:medium;color:rgb(234,234,234);text-transform:none;text-indent:0px;letter-spacing:normal;word-spacing:0px;white-space:pre-wrap;word-break:break-all;font-size-adjust:none;font-stretch:normal;background-color:rgb(44,40,40)"><span class="gmail-GGHFMYIBCOB gmail-ace_keyword" style="color:rgb(117,122,216)">head(weights$short.w[,1:3])
</span> Asset 1 Asset 2 Asset 3
1987-03-31 -1 0.0 0
1987-06-30 0 -0.5 0
1987-09-30 0 0.0 0
1987-12-31 0 0.0 0
1988-03-31 0 0.0 0
1988-06-30 0 0.0 0<br><pre tabindex="0" class="gmail-GGHFMYIBMOB" id="gmail-rstudio_console_output" style="font:10pt/12.5px "Lucida Console";margin:0px;outline:invert;border:medium;color:rgb(234,234,234);text-transform:none;text-indent:0px;letter-spacing:normal;word-spacing:0px;white-space:pre-wrap;word-break:break-all;background-color:rgb(44,40,40)"><span class="gmail-GGHFMYIBCOB gmail-ace_keyword" style="color:rgb(117,122,216)">head(Port.return[1:10])
</span> portfolio.returns
1987-04-30 -2.00599554
1987-05-31 -0.05543151
1987-06-30 -0.14546419
1987-07-31 -2.01670857
1987-08-31 0.09265071
1987-09-30 -0.09907100</pre><br><br></pre><b></b></pre><div>I am not sure I understand how the short weights work? Perhaps I should just use positive weights and minus the returns afterwards?</div><div><br></div><div>Any help much appreciated.</div><div><br clear="all"></div><div><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr">Nicolas Roux<div><br></div></div></div></div></div></div></div></div>
</div>