[R-SIG-Finance] problem creating graphs

Frank fr@nkm60606 @ending from gm@il@com
Sun Jul 22 22:56:24 CEST 2018


I have

pdf("V0_SPY_Scatter_Plot.pdf")

before I do my labels and plotting.

Best,

Frank
Chicago

-----Original Message-----
From: R-SIG-Finance <r-sig-finance-bounces using r-project.org> On Behalf Of Stephen Choularton
Sent: Sunday, July 22, 2018 2:39 PM
To: r-sig-finance <r-sig-finance using r-project.org>
Subject: [R-SIG-Finance] problem creating graphs

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



More information about the R-SIG-Finance mailing list