Dark Theme
Light Theme
Trading Articles
Article Categories
Article Tools
Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to
register in order to view the content of the threads and start contributing to our community.
It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
Pimp your Sierra with R
Updated November 29, 2014
trending_up
2,202 views
thumb_up
8 thanks given
group
2 followers
forum
3 posts
attach_file
0 attachments
Pimp your Sierra with R
September 27th, 2014, 01:15 PM
zurich
Experience: Advanced
Platform: Sierra ahRrrr CQG ...
Trading: Bund, ES, ...
Posts: 964 since Aug 2010
Thanks Given: 7,273
Thanks Received: 1,507
One can use R and data from e.g quandl.com to feed sierra (EoD ).
This way you can turn your little Sierra into an economics machine.
(fuck you Bloomberg ! )
Here is an example/template for the Baltic Dry Index.
(I am not a coder - so feel free to better this embarrassing script)
Code
### Baltic Dry Index
### via quandl
### v0.1 share
### ----
#
#
#_____________________________________________________________________________
### Meta data ----
name1 <- "bender is great"
stamp.date <- Sys.Date()
description <- "Baltic Dry Index. Source: DryShips Inc."
#
#______________________________________________________________________________
### set variables ----
quandl.auth <- 'GetThisFromYourQuandlAccount' #https://www.quandl.com
quandl.symbol <- "OFDP/INDEX_BDI_1"
path.to.sierra.data <- "F:/Programme/aaaa Trading/SierraChart5/Data/r.BDI.dly"
#_____________________________________________________________________________
### Libraries -------------------------------------------------------------
library("Quandl")
library("xts")
library("sqldf")
#______________________________________________________________________________
### Auth for Quandl ----
Quandl.auth(quandl.auth)
#
#_____________________________________________________________________________
### DL from quandl ------------------------------------------------------------
d = Quandl(quandl.symbol,
collapse=NULL, # NULL for Daily
start_date="1900-01-01",
type="xts")
#plot(qdata[,1])
#______________________________________________________________________________
### opti data for sierra ----
# convert xts 2 df
d.df <- as.data.frame(d)
rn <- row.names(d.df)
# opti Date
rn <- sapply(rn,
function(x)
{as.character(gsub("-","/", as.character(x)))})
# write back opti row names
row.names(d.df) <- rn
# make pseudo OHLC
d.df[,2] <- d.df[,1]
d.df[,3] <- d.df[,1]
d.df[,4] <- d.df[,1]
d.df[,5] <- d.df[,1]
d.df[,1] <- rn
# rename col
names(d.df) <- c("Date","Open","High","Low","Close")
#_____________________________________________________________________________
### merge with data in (txt-) DB ----
# this preserves the data downloaded earlier -
# in case there is more data in local DB, than in the web-source
# get downloaded quandl data
d_DL <- d.df
rm(d.df)
# get current data in DB
if (file.exists(path.to.sierra.data)){
d_DB <- read.table(path.to.sierra.data,
header=T,
sep=",",
colClasses=c("character","numeric","numeric","numeric",
"numeric"))
d_DB[,1] <- sapply(d_DB[,1],
function(x)
{as.character(gsub("-","/", as.character(x)))})
} else {
d_DB <- d_DL
}
# Only the rows which are NOT in both data frames:
d_update <- sqldf('SELECT * FROM d_DL EXCEPT SELECT * FROM d_DB')
# merge into updated DB
d_DBnew <- merge(d_update, d_DB, all.x=T, all=T)
rm(d_DB)
rm(d_DL)
rm(d_update)
#_____________________________________________________________________________
### write to file ----
write.table(d_DBnew,path.to.sierra.data,sep=",",row.names=FALSE, quote=F)
#_____________________________________________________________________________
### clean ----
rm(list=ls())
#_____________________________________________________________________________
Can you help answer these questions from other members on NexusFi?
Best Threads (Most Thanked) in the last 7 days on NexusFi
September 27th, 2014, 02:46 PM
Manta, Ecuador
Site Administrator Developer Swing Trader
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,463 since Jun 2009
Thanks Given: 33,236
Thanks Received: 101,661
I believe @Nicolas11 also posted a lot of R/Sierra code for manipulating data.
Mike
September 27th, 2014, 02:58 PM
zurich
Experience: Advanced
Platform: Sierra ahRrrr CQG ...
Trading: Bund, ES, ...
Posts: 964 since Aug 2010
Thanks Given: 7,273
Thanks Received: 1,507
Big Mike
I believe @
Nicolas11 also posted a lot of R/Sierra code for manipulating data.
Mike
TY , I will have a look
November 29th, 2014, 05:26 AM
zurich
Experience: Advanced
Platform: Sierra ahRrrr CQG ...
Trading: Bund, ES, ...
Posts: 964 since Aug 2010
Thanks Given: 7,273
Thanks Received: 1,507
quandl changed the symbol to:
OFDP/INDEX_BDI
Last Updated on November 29, 2014