HOME FORUMS BROKERS SOFTWARE BOOKS CONTACT US
Elite Trader Your Account  •  Become a Member  •  Help  •  Search    
    Forums ›› Technically Speaking ›› Programming ›› R for datamining/backtesting/trading  


Post A Reply
    Page 1 of 10:   1  2  3  4  5  6  7  8  9  10  
caementarius
 

Registered: Jul 2007
Posts: 475

 

03-06-12 06:40 AM

I've used a few platforms for strategy development. I always seem to come up against obstacles where I might as well write my own stuff rather than go through the gymnastics to get what I want out of the platform. For example, NinjaTrader felt weird to try to access more than 1-2 securities prices at a time (needed to wrap them into a derived indicator, if I remember correctly). With tradelink, not everything worked out of the box - so there was tweaking to be done plus data management was clunky.

With R/quantmod and other modules, there is some nice open-source work mostly approached from an academic angle.

The academic angle uses vector operations and can make for some nice succinct functional code. See this backtest in just a few lines of R script:
http://blog.fosstrading.com/2011/03...ategy-in-r.html

But, using vector operations isn't great when you want to switch to an event-driven model that responds to new bars or new ticks - like what happens when you want to run on live data and generate signals. And, more path-dependent trade logic expands the number of vectors needed until it's more messy than it's worth. The nice thing about NT and tradelink is that they are built from the ground up to run the same code whether you are backtesting or running live.

Overarching all of this is my belief that I am likely better served developing systems by first exploring relationships in data and then seeing what might be a trade.

So, I think R might be the way - but when I use it, iterating over bar data, it feels like I'm doing it wrong by introducing flow control into a functional language.

Has anyone made R their "home" for everything (mining+testing+live signals)? Or - If you've been down the same road building your own tools for the whole process, what technologies did you settle on?

    Edit/Delete Quote Complain
tradelink
 

Registered: Feb 2008
Posts: 577

 

03-06-12 04:54 PM

"Overarching all of this is my belief that I am likely better served developing systems by first exploring relationships in data and then seeing what might be a trade.

A pretty common thing among tradelinkers is to use R or matlab for analysis and modeling, then use tradelink for heavy backtesting and live trading.

this is why tradelink has R/matlab/excel hooks in every application.

"So, I think R might be the way - but when I use it, iterating over bar data, it feels like I'm doing it wrong by introducing flow control into a functional language."

It shouldn't be necessary to iterate

tlindicators<-read.csv("indicatorsFromGauntletRun.csv")

price<-tlindicators[,3]
time<-tlindicators[,1]

plot(time,price)

linearmodel <- lm(price~time)
abline(linearmodel)

    Edit/Delete Quote Complain
Rodney King
 

Registered: Apr 2006
Posts: 1725

 

03-06-12 05:13 PM


Quote from caementarius:

See this backtest in just a few lines of R script: http://bit.ly/jhvufT



This isn't really "a few lines of R," it's a script invoking the functionality of several very good finance-specific R add-on packages with their own quirks and fiddly bits, that are quite complex internally.

    Edit/Delete Quote Complain
caementarius
 

Registered: Jul 2007
Posts: 475

 

03-06-12 05:19 PM


Quote from Rodney King:

This isn't really "a few lines of R," it's a script invoking the functionality of several very good finance-specific R add-on packages with their own quirks and fiddly bits, that are quite complex internally.



correct:


Quote from caementarius:

With R/quantmod and other modules, there is ...



I like R for exploration, like how tradelink just posted. My point is that the trade logic and order matching are clunky and unnatural (that's where I'm iterating over bars, keeping orders in data frames, bleah).

What I'm trying to find, or simply just lamenting about, is exploration using nice tools and ability to deploy a model with trading logic without rewriting it in tradelink (or NT, or..) for realtime use.

    Edit/Delete Quote Complain
tradelink
 

Registered: Feb 2008
Posts: 577

 

03-06-12 05:30 PM

Once you have found a relationship that is stable and exploitable, it's fairly easy to port this to tradelink.

One option is R embed, and calling your routines via a dll in TL.

Another option is calling R routines via a scripted interface. There's a plan to import a module we use to simplify this in TL (import it into the TL project).

A third option if you really want to do actual trading in R, sent you a PM about that.

    Edit/Delete Quote Complain
Rodney King
 

Registered: Apr 2006
Posts: 1725

 

03-06-12 08:02 PM


Quote from tradelink:

A third option if you really want to do actual trading in R, sent you a PM about that.



http://cran.r-project.org/web/packa...kers/index.html, or something superspecialsecret that requires a private message?

    Edit/Delete Quote Complain
    Page 1 of 10:   1  2  3  4  5  6  7  8  9  10  
Post A Reply


Receive an email whenever a new post is added to this thread by subscribing to it.
 
Rate This Thread:

Forum Jump:
 

 

   Conduct Rules  -  Privacy Policy  -  Day Trader -  Day Trader Forum -  Best Trading Software -  Sitemap Copyright © 2013, Elite Trader. All rights reserved.    
 
WHILE YOU'RE HERE, TAKE A MINUTE TO VISIT SOME OF OUR SPONSORS:
Advantage Futures
Futures Brokerage & Clearing
AMP Global Clearing
Futures and FX Trading
Bright Trading
Professional Equities Trading
CTS
Futures Trading Software
DaytradingBias.com
Professional Trading Analytics
ECHOtrade
Professional Trading Firm
eSignal
Trading Software Provider
FXCM
Forex Trading Services
Global Futures
Futures, Options & FX Trading
Interactive Brokers
Pro Gateway to World Markets
JC Trading Group
Direct Access Trading
MB Trading
Direct Access Trading
MultiCharts
Trading Software Provider
NinjaTrader
Trading Software Provider
OANDA
Currency Trading
optionshouse
Option Trading & Education
Rithmic
Futures Trade Execution Platform
SpeedTrader
Direct Access Trading
SpreadProfessor
Spread Trading Instruction
thinkorswim by TD Ameritrade
Direct Access TradingAdvertisement
TradersStudio
System Building & Backtesting
Trading Technologies
Trading Software Provider
Trend Following
Trading Systems Provider