Webinar: Ernest Chan - Comparison of Matlab, R, Python and more for trading - Matlab, R project and Python | futures io social day trading
futures io futures trading


Webinar: Ernest Chan - Comparison of Matlab, R, Python and more for trading
Updated: Views / Replies:3,838 / 25
Created: by Big Mike Attachments:0

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

Reply
 
Thread Tools Search this Thread
 

Webinar: Ernest Chan - Comparison of Matlab, R, Python and more for trading

  #11 (permalink)
Elite Member
Los Angeles, CA
 
Futures Experience: Beginner
Platform: TradeStation
Favorite Futures: Stocks
 
Posts: 13 since Jun 2012
Thanks: 7 given, 3 received


GoldenRatio View Post
I have used Matlab home for quite a while now and simply cannot trade/program/backtest without it.

The option to buy add-on's such as the financial toolbox for only $45 is money well spent IMO. Yes, you could program all these script on your own but at some point you get to the point where your time is more valuable.

Can't you just use TradeStation for all your backtesting? TradeStation has a built-in Walk Forward Optimizer, Portfolio Maestro for backtesting multiple symbols, and EasyLanguage.

Do you actually need Matlab? Backtesting using Matlab for intraday intervals must be difficult. Walk Forward optimizing is mentioned in the webinar. Does Matlab even have a toolbox for WFO or do you need to buy a third party WFO such as $300-$400 WFAToolbox?

Reply With Quote
 
  #12 (permalink)
Elite Member
Los Angeles, CA
 
Futures Experience: Beginner
Platform: TradeStation
Favorite Futures: Stocks
 
Posts: 13 since Jun 2012
Thanks: 7 given, 3 received

There is a factual mistake in the webinar. At 20:26 and 36:00 it mentions translating to C/C++. This is true. However, in order to do this, you must purchase MATLAB Coder which costs $6500. Matlab Coder only works with Matlab Professional which costs $2150, as mentioned in the webinar. Matlab Coder does not work with the $149 Home Edition.

Here is a link to the Matlab page which has the Pro price list. Furthermore, the toolbox prices for the Pro edition are a minimum of $1000 each, not $45. So translating Matlab code into C++ is probably not an option. Here is the price list for the $149 Home Edition.

I did find the webinar interesting, especially the Matlab part. The question is, do TradeStation users really need Matlab? Can't TS users simply use the tools they already have at their disposal? Unless you want to do some very complex calculations, I can't see the need for Matlab. Furthermore, accessing intraday pricing might be difficult with Matlab.

Reply With Quote
 
  #13 (permalink)
Elite Member
Philadelphia, PA
 
Futures Experience: Intermediate
Platform: Matlab, TradeStation
Favorite Futures: Stocks
 
GoldenRatio's Avatar
 
Posts: 179 since Aug 2012
Thanks: 4,556 given, 226 received



techstocktrader View Post
Can't you just use TradeStation for all your backtesting?

Yes and no. I do not want to get into a position of defending Matlab but it certainly has it merits over TS.

In the most simplistic terms, if you want more control over your backtesting and to see what's really going on during the process then Matlab is the way to go. TS certainly has a lots of bells and whistles programmed in, especially the optimization report; however, I do not backtest off those types of results as they can easily lead me to accidentally backfitting. What I prefer to do is create a system in Matlab and then once I am satisfied I will bring it into TS to test.

Matlab is just another tool, similar to a trading system or process. If it doesn't fit the users personality (not matter how great the tool is) it will be worthless to the individual. I recognize I have a personal bias to Matlab as I have used it for +20 years.

FYI - WFA is very simple in Matlab. Simply create a loop, iterate through each loop, record your results and then step forward using the new output. It's as simple as:

 
Code
variables (1st iteration)
for n=1:length(variable)-1
  your backtesting code
  save new variables
end

Reply With Quote
The following 3 users say Thank You to GoldenRatio for this post:
 
  #14 (permalink)
Rristocrat
zurich
 
Futures Experience: Advanced
Platform: Sierra ahRrrr CQG ...
Favorite Futures: Bund, ES, ...
 
puma's Avatar
 
Posts: 963 since Aug 2010
Thanks: 7,268 given, 1,489 received

informative webinar, TY

I still like R.
Mine runs every day in conjunction with sierra.

One can pre-compile functions in R.
Noam Ross | FasteR! HigheR! StrongeR! - A Guide to Speeding Up R Code for Busy People

I do not feel much improvement in my scripts though.


Last edited by puma; May 20th, 2016 at 05:03 PM.
Reply With Quote
The following user says Thank You to puma for this post:
 
  #15 (permalink)
Elite Member
Chemnitz, Germany
 
Futures Experience: Intermediate
Platform: Python
Favorite Futures: ALL the futures (and options)
 
Posts: 80 since Sep 2014
Thanks: 304 given, 48 received

Though the point that you can call R functions from Python does have merit. I currently use the anaconda Python stack for data analysis. Spyder gives me pretty much everything rstudio does, yet I don't have to deal with R. (Or S, if we want to be pedantic...)

Reply With Quote
The following user says Thank You to skoa for this post:
 
  #16 (permalink)
Elite Member
Norwich, UK
 
Futures Experience: Beginner
Platform: Multiple:research&executi
Broker/Data: Started with Stage5/OEC ... multiple
Favorite Futures: Anything found profitable goes ...
 
andby's Avatar
 
Posts: 141 since Jul 2012
Thanks: 82 given, 56 received

the rubber meets the road!

Alright, that's it - Matlab is the way to go, R is grand, Tradestation gives you everything, Multicharts was given to us from the future (except it doesn't quite work like you'd expect) - I think we should let the code speak to itself.
I'm not a fan of either the above - I like to see some code and make a judgement afterwards. I think Ilya did a grand job here by not evangelizing R but rather giving a clear cut simple strategy, which was something along the lines:

require(IKTrading)
require(quantstrat)
require(PerformanceAnalytics)
require(DSTrading)

initDate="1990-01-01"
from="2003-01-01"
to="2012-12-31"
options(width=70)

options("getSymbols.warning4.0"=FALSE)
currency('USD')
Sys.setenv(TZ="UTC")
symbols <- c("XLB", #SPDR Materials sector
"XLE", #SPDR Energy sector
"XLF", #SPDR Financial sector
"XLP", #SPDR Consumer staples sector
"XLI", #SPDR Industrial sector
"XLU", #SPDR Utilities sector
"XLV", #SPDR Healthcare sector
"XLK", #SPDR Tech sector
"XLY", #SPDR Consumer discretionary sector
"RWR", #SPDR Dow Jones REIT ETF
"EWJ", #iShares Japan
"EWG", #iShares Germany
"EWU", #iShares UK
"EWC", #iShares Canada
"EWY", #iShares South Korea
"EWA", #iShares Australia
"EWH", #iShares Hong Kong
"EWS", #iShares Singapore
"IYZ", #iShares U.S. Telecom
"EZU", #iShares MSCI EMU ETF
"IYR", #iShares U.S. Real Estate
"EWT", #iShares Taiwan
"EWZ", #iShares Brazil
"EFA", #iShares EAFE
"IGE", #iShares North American Natural Resources
"EPP", #iShares Pacific Ex Japan
"LQD", #iShares Investment Grade Corporate Bonds
"SHY", #iShares 1-3 year TBonds
"IEF", #iShares 3-7 year TBonds
"TLT" #iShares 20+ year Bonds
)
#SPDR ETFs first, iShares ETFs afterwards
if(!"XLB" %in% ls()) {
suppressMessages(getSymbols(symbols, from=from, to=to, src="yahoo", adjust=TRUE))
}
stock(symbols, currency="USD", multiplier=1)
currency('USD')
Sys.setenv(TZ="UTC")

#trade sizing and initial equity settings
tradeSize <- 100000
initEq <- tradeSize*length(symbols)

strategy.st <- portfolio.st <- account.st <- "DollarVsATRos"
rm.strat(strategy.st)
initPortf(portfolio.st, symbols=symbols, initDate=initDate, currency='USD')
initAcct(account.st, portfolios=portfolio.st, initDate=initDate, currency='USD',initEq=initEq)
initOrders(portfolio.st, initDate=initDate)
strategy(strategy.st, store=TRUE)



#parameters
pctATR <- .02
period <- 10
atrOrder <- TRUE
nRSI <- 2
buyThresh <- 20
sellThresh <- 80
nSMA <- 200
#indicators
add.indicator(strategy.st, name="lagATR",
arguments=list(HLC=quote(HLC(mktdata)), n=period),
label="atrX")
add.indicator(strategy.st, name="RSI",
arguments=list(price=quote(Cl(mktdata)), n=nRSI),
label="rsi")
add.indicator(strategy.st, name="SMA",
arguments=list(x=quote(Cl(mktdata)), n=nSMA),
label="sma")



#signals
add.signal(strategy.st, name="sigComparison",
arguments=list(columns=c("Close", "sma"), relationship="gt"),
label="filter")

add.signal(strategy.st, name="sigThreshold",
arguments=list(column="rsi", threshold=buyThresh,
relationship="lt", cross=FALSE),
label="rsiLtThresh")

add.signal(strategy.st, name="sigAND",
arguments=list(columns=c("filter", "rsiLtThresh"), cross=TRUE),
label="longEntry")

add.signal(strategy.st, name="sigThreshold",
arguments=list(column="rsi", threshold=sellThresh,
relationship="gt", cross=TRUE),
label="longExit")

add.signal(strategy.st, name="sigCrossover",
arguments=list(columns=c("Close", "sma"), relationship="lt"),
label="filterExit")



#rules
if(atrOrder) {

add.rule(strategy.st, name="ruleSignal",
arguments=list(sigcol="longEntry", sigval=TRUE, ordertype="market",
orderside="long", replace=FALSE, prefer="Open",
osFUN=osDollarATR, tradeSize=tradeSize,
pctATR=pctATR, atrMod="X"),
type="enter", path.dep=TRUE)
} else {
add.rule(strategy.st, name="ruleSignal",
arguments=list(sigcol="longEntry", sigval=TRUE, ordertype="market",
orderside="long", replace=FALSE, prefer="Open",
osFUN=osMaxDollar, tradeSize=tradeSize, maxSize=tradeSize),
type="enter", path.dep=TRUE)
}

add.rule(strategy.st, name="ruleSignal",
arguments=list(sigcol="longExit", sigval=TRUE, orderqty="all",
ordertype="market", orderside="long",
replace=FALSE, prefer="Open"),
type="exit", path.dep=TRUE)

add.rule(strategy.st, name="ruleSignal",
arguments=list(sigcol="filterExit", sigval=TRUE, orderqty="all",
ordertype="market", orderside="long", replace=FALSE,
prefer="Open"),
type="exit", path.dep=TRUE)




#apply strategy
t1 <- Sys.time()
out <- applyStrategy(strategy=strategy.st,portfolios=portfolio.st)
t2 <- Sys.time()
print(t2-t1)

#set up analytics
updatePortf(portfolio.st)
dateRange <- time(getPortfolio(portfolio.st)$summary)[-1]
updateAcct(portfolio.st,dateRange)
updateEndEq(account.st)


Simple, elegant, readable and to the point - a full portfolio backtest in 150 lines. He even took the time to spell out each line of code in the above in:
https://quantstrattrader.wordpress.com/2014/09/09/nuts-and-bolts-of-quantstrat-part-i/
Can anyone give a simple piece of code in matlab ... just do a simple system: 2 moving averages cross-over + simple optimisation of the two lengths + a walk-forward example ...
And please, don't point to Kawee's walk-forward analysis demo on Matlab's site with 10 separate files and god knows how many lines of code in each. If it's that simple and comparable to R, a moving average system for one symbol should be a 5-10 minutes job to exemplify.

thanks!

Reply With Quote
 
  #17 (permalink)
Elite Member
Austin, TX
 
Futures Experience: Intermediate
Platform: F-16CM-50
Favorite Futures: JDAM
 
tturner86's Avatar
 
Posts: 5,784 since Sep 2013
Thanks: 9,849 given, 11,160 received
Forum Reputation: Legendary


sam028 View Post
Yes, like all webinars since AD 2009.

Oh man, this made me laugh.

Reply With Quote
 
  #18 (permalink)
Elite Member
Christchurch, New Zealand
 
Futures Experience: Beginner
Platform: SC
Broker/Data: IB, BC, Dx Feed
Favorite Futures: US Equities
 
Neo1's Avatar
 
Posts: 422 since Jul 2014
Thanks: 470 given, 470 received

Why are more traders not using Matlab?

"Free markets work because they allow people to be lucky, thanks to aggressive trial and error, not by giving rewards or incentives for skill. The strategy is, then, to tinker as much as possible and try to collect as many Black Swan opportunities as you can"
Reply With Quote
 
  #19 (permalink)
Market Wizard
Houston, TX
 
Futures Experience: Advanced
Platform: XTrader
Broker/Data: Advantage Futures
Favorite Futures: Energy
 
Posts: 2,123 since Dec 2013
Thanks: 1,749 given, 3,360 received
Forum Reputation: Legendary

Probably cost.

Octave is a free Matlab alternative but I don't know if the Toolbox's you would want are available.

Reply With Quote
 
  #20 (permalink)
Elite Member
Christchurch, New Zealand
 
Futures Experience: Beginner
Platform: SC
Broker/Data: IB, BC, Dx Feed
Favorite Futures: US Equities
 
Neo1's Avatar
 
Posts: 422 since Jul 2014
Thanks: 470 given, 470 received



SMCJB View Post
Probably cost.

Octave is a free Matlab alternative but I don't know if the Toolbox's you would want are available.

That's exactly what I think. Cost becomes a barrier to entry when it shouldn't be. You could spend no more than $500 on the home edition and kit out Matlab with all the toolboxes you need( aside from the C++ code generator). $500 is nothing if you're serious. It's half the price of a lifetime NT license. Even if it's just a hobby for you, hobbies are not free either, you pay more than $500 for a set of golf clubs.

You should choose the likes of Python & R because they suit you/ fit your needs better, not because they're free.

"Free markets work because they allow people to be lucky, thanks to aggressive trial and error, not by giving rewards or incentives for skill. The strategy is, then, to tinker as much as possible and try to collect as many Black Swan opportunities as you can"
Reply With Quote
The following user says Thank You to Neo1 for this post:

Reply



futures io > > > > Webinar: Ernest Chan - Comparison of Matlab, R, Python and more for trading

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)

Jigsaw Trading: TBA

Elite only

FuturesTrader71: TBA

Elite only

NinjaTrader: TBA

Jan 18

RandBots: TBA

Jan 23

GFF Brokers & CME Group: Futures & Bitcoin

Elite only

Adam Grimes: TBA

Elite only

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Webinar: Ernest Chan on Leading Risk Indicators and Order Flow Big Mike Psychology and Money Management 26 October 21st, 2017 04:32 AM
R vs Python vs matlab: the quant language war treydog999 Matlab, R project and Python 26 November 29th, 2016 05:20 AM
Webinar: Ernest Chan on Capital Allocation and Risk Management (Kelly) Big Mike Psychology and Money Management 27 May 2nd, 2016 07:06 PM
Webinar: Ernest Chan on Factor Models In Practice Big Mike Traders Hideout 32 September 28th, 2014 08:24 AM
Ernest Chan traderwerks Traders and Trading Methods 0 April 9th, 2013 12:34 AM


All times are GMT -4. The time now is 01:31 AM.

Copyright © 2017 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts
Page generated 2017-12-18 in 0.17 seconds with 19 queries on phoenix via your IP 54.92.201.232