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
r performanceanalytics
add a comment |
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
r performanceanalytics
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
add a comment |
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
r performanceanalytics
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
r performanceanalytics
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
add a comment |
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
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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