[R-SIG-Finance] problem creating graphs
Stephen Choularton
@tephen @ending from org@nicfoodm@rket@@com@@u
Sun Jul 22 21:38:54 CEST 2018
Hi
I am having problems producing graphs with the attached code. It gets
the two symbols down from IB that I think are congregated and extracts
various features and is intended to put the data on a graph so I can
eyeball it.
I normally run the code via File > Source R Code.
The code seems to work all the way down to line 104 where the code is:
plot.new()
plot(spread, main=paste(sym1, " - ", sym2, "\n", "lookback ", lookback,
"\n", "width ", width), type="l")
lines(average,col="blue")
lines(upper,col="red")
lines(lower,col="red")
abline(h=thirty_day_mean, col="blue", lwd = 3)
abline(h=thirty_day_upper, col="red", lwd = 2)
abline(h=thirty_day_lower, col="red", lwd = 2)
all I get when I run it is the three ablines. However, I can copy and
paste this part:
plot(spread, main=paste(sym1, " - ", sym2, "\n", "lookback ", lookback,
"\n", "width ", width), type="l")
lines(average,col="blue")
lines(upper,col="red")
lines(lower,col="red")
into the console and it produces a graph! If I paste:
abline(h=thirty_day_mean, col="blue", lwd = 3)
abline(h=thirty_day_upper, col="red", lwd = 2)
abline(h=thirty_day_lower, col="red", lwd = 2)
in after nothing else appears on the graph.
I wonder if anyone can advise me how to get the script to produce the
graph with all the information on it.
Thanks.
Stephen Choularton PhD, FIoD
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: explorePairFromIB.R
URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20180723/65dd2325/attachment.ksh>
More information about the R-SIG-Finance
mailing list