Problems with charts.PerformanceSummary()











up vote
0
down vote

favorite












I am basically trying to plot a performance summary chart using a very simple trading rule as follow:



library(quantmod)
library(PerformanceAnalytics)

getSymbols("MSFT")

lagclose <- Lag(Cl(MSFT))
change <- Cl(MSFT)/lagclose
lchange <- lag(change)

delta <- 0.005
trade <- c()
trade[1:2] <- 0

for (i in 3: length(Cl(MSFT))) {
if (lchange[i] > 1+delta) {
trade[i] <- 1
} else if (lchange[i] < 1-delta) {
trade[i] <- -1
} else
trade[i] <- 0
}

buy1 <- reclass(trade,Cl(MSFT))

ret <- dailyReturn(MSFT)*buy1
charts.PerformanceSummary(ret)


However, my output summary chart seems to be missing the graph for daily return as well as the drawdown segment. Any idea why?



My chart output










share|improve this question
























  • I ran your code and my chart output shows the daily return and the drawdown lines. Try restarting your r session and see if that helps.
    – phiver
    Nov 17 at 16:46















up vote
0
down vote

favorite












I am basically trying to plot a performance summary chart using a very simple trading rule as follow:



library(quantmod)
library(PerformanceAnalytics)

getSymbols("MSFT")

lagclose <- Lag(Cl(MSFT))
change <- Cl(MSFT)/lagclose
lchange <- lag(change)

delta <- 0.005
trade <- c()
trade[1:2] <- 0

for (i in 3: length(Cl(MSFT))) {
if (lchange[i] > 1+delta) {
trade[i] <- 1
} else if (lchange[i] < 1-delta) {
trade[i] <- -1
} else
trade[i] <- 0
}

buy1 <- reclass(trade,Cl(MSFT))

ret <- dailyReturn(MSFT)*buy1
charts.PerformanceSummary(ret)


However, my output summary chart seems to be missing the graph for daily return as well as the drawdown segment. Any idea why?



My chart output










share|improve this question
























  • I ran your code and my chart output shows the daily return and the drawdown lines. Try restarting your r session and see if that helps.
    – phiver
    Nov 17 at 16:46













up vote
0
down vote

favorite









up vote
0
down vote

favorite











I am basically trying to plot a performance summary chart using a very simple trading rule as follow:



library(quantmod)
library(PerformanceAnalytics)

getSymbols("MSFT")

lagclose <- Lag(Cl(MSFT))
change <- Cl(MSFT)/lagclose
lchange <- lag(change)

delta <- 0.005
trade <- c()
trade[1:2] <- 0

for (i in 3: length(Cl(MSFT))) {
if (lchange[i] > 1+delta) {
trade[i] <- 1
} else if (lchange[i] < 1-delta) {
trade[i] <- -1
} else
trade[i] <- 0
}

buy1 <- reclass(trade,Cl(MSFT))

ret <- dailyReturn(MSFT)*buy1
charts.PerformanceSummary(ret)


However, my output summary chart seems to be missing the graph for daily return as well as the drawdown segment. Any idea why?



My chart output










share|improve this question















I am basically trying to plot a performance summary chart using a very simple trading rule as follow:



library(quantmod)
library(PerformanceAnalytics)

getSymbols("MSFT")

lagclose <- Lag(Cl(MSFT))
change <- Cl(MSFT)/lagclose
lchange <- lag(change)

delta <- 0.005
trade <- c()
trade[1:2] <- 0

for (i in 3: length(Cl(MSFT))) {
if (lchange[i] > 1+delta) {
trade[i] <- 1
} else if (lchange[i] < 1-delta) {
trade[i] <- -1
} else
trade[i] <- 0
}

buy1 <- reclass(trade,Cl(MSFT))

ret <- dailyReturn(MSFT)*buy1
charts.PerformanceSummary(ret)


However, my output summary chart seems to be missing the graph for daily return as well as the drawdown segment. Any idea why?



My chart output







r performanceanalytics






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 17 at 16:45









phiver

12k92634




12k92634










asked Nov 17 at 15:15









Daimon

92




92












  • I ran your code and my chart output shows the daily return and the drawdown lines. Try restarting your r session and see if that helps.
    – phiver
    Nov 17 at 16:46


















  • I ran your code and my chart output shows the daily return and the drawdown lines. Try restarting your r session and see if that helps.
    – phiver
    Nov 17 at 16:46
















I ran your code and my chart output shows the daily return and the drawdown lines. Try restarting your r session and see if that helps.
– phiver
Nov 17 at 16:46




I ran your code and my chart output shows the daily return and the drawdown lines. Try restarting your r session and see if that helps.
– phiver
Nov 17 at 16:46

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














 

draft saved


draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53352536%2fproblems-with-charts-performancesummary%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















 

draft saved


draft discarded



















































 


draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53352536%2fproblems-with-charts-performancesummary%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

"Incorrect syntax near the keyword 'ON'. (on update cascade, on delete cascade,)

Alcedinidae

RAC Tourist Trophy