R newbee q. - Matlab, R project and Python | futures io social day trading
futures io futures trading


R newbee q.
Updated: Views / Replies:2,000 / 20
Created: by giladbi Attachments:3

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
 3  
 
Thread Tools Search this Thread
 

R newbee q.

  #11 (permalink)
Elite Member
tel aviv
 
Futures Experience: Advanced
Platform: Multicharts, SC
Favorite Futures: es
 
Posts: 34 since Jun 2009
Thanks: 4 given, 1 received

i mange to play with it till it is working!

 
Code
library("quantmod")
library("PerformanceAnalytics")

XG1min <-read.csv("XG#-1min 22122011-10102014 BarData.txt", header=TRUE)
XG1min$DateTime <- as.POSIXct(paste(XG1min$Date, XG1min$Time), format="%Y/%m/%d %H:%M:%S") 
XG1min <- XG1min[ ,c(11,1:10)]
XG1min[,2] <- NULL
XG1min[,2] <- NULL

XG1min <- xts(XG1min[,-1], order.by=XG1min[,1])
sym1 <- XG1min
#startTraining  <- "2013-05-29 02:00:00"
#endTraining    <- "2013-05-30 18:00:00"
# I use "/" you used "::" - dont know if important
#rangeTraining  <- paste(startTraining,"/",endTraining,sep ="")
# I dont have your above sample window, so I use this time window
trainsym1   <- sym1[,4]
trainsym1["2011-12-22 02:00:00/2011-12-22 02:05:00"]
pdtsym1 <- diff(trainsym1)[-1]

Reply With Quote
 
  #12 (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

great

Reply With Quote
 
  #13 (permalink)
Elite Member
seoul, Korea
 
Futures Experience: Intermediate
Platform: Multicharts
Broker/Data: CQG, DTN IQfeed
Favorite Futures: YM 6E
 
treydog999's Avatar
 
Posts: 894 since Jul 2012
Thanks: 291 given, 1,006 received

quantstrat


quantstrat has a pair_trade demo that you can look at which is very descriptive. I was able to use that as base and create my own systems out of that. Its fairly easy to understand.

Reply With Quote
The following user says Thank You to treydog999 for this post:
 
  #14 (permalink)
Elite Member
tel aviv
 
Futures Experience: Advanced
Platform: Multicharts, SC
Favorite Futures: es
 
Posts: 34 since Jun 2009
Thanks: 4 given, 1 received


treydog999 View Post
quantstrat has a pair_trade demo that you can look at which is very descriptive. I was able to use that as base and create my own systems out of that. Its fairly easy to understand.

I serched their site but could not find anything related to pairs trading.
btw most demo code for pairs are for daily movements while i am trying to built something for an intraday use based on my 1 min. files.
Thanks!

Reply With Quote
 
  #15 (permalink)
Elite Member
seoul, Korea
 
Futures Experience: Intermediate
Platform: Multicharts
Broker/Data: CQG, DTN IQfeed
Favorite Futures: YM 6E
 
treydog999's Avatar
 
Posts: 894 since Jul 2012
Thanks: 291 given, 1,006 received


giladbi View Post
I serched their site but could not find anything related to pairs trading.
btw most demo code for pairs are for daily movements while i am trying to built something for an intraday use based on my 1 min. files.
Thanks!

Here is the link to all the demos on R forge. I dont know which "website" your referring to exactly.
https://r-forge.r-project.org/scm/viewvc.php/pkg/quantstrat/demo/?root=blotter

also, demos are all in daily. Probably due to easy access to replicatable data sets (yahoo/google finance) and quick execution in order to see functionality. But that is irrelevant as quantstrat can handle tick data and BBO series. So it can get as granular as you want. Its just up to you to modify the code in order to do so.

Reply With Quote
The following user says Thank You to treydog999 for this post:
 
  #16 (permalink)
Elite Member
tel aviv
 
Futures Experience: Advanced
Platform: Multicharts, SC
Favorite Futures: es
 
Posts: 34 since Jun 2009
Thanks: 4 given, 1 received

I would like to post my code which is set for intraday pair. I am new to R but I am trading for many years many different instruments and would like to expand into the pair trading in intraday futures.

Pls notice you can choose both IQfeed or read from file to load the data (which is what i was strangeling when open this post). It's not yet complited and I would like to get the crowd's feedback as much as you can expose.
Thanks!

Attached Files
Register to download File Type: r Demo Pairs.R (8.2 KB, 4 views)
Reply With Quote
 
  #17 (permalink)
Trading Apprentice
Vilnius Lithuania
 
Futures Experience: Beginner
Platform: R
Favorite Futures: forex
 
Posts: 3 since Jan 2015
Thanks: 0 given, 0 received

Since I didn't want to create new thread I will post my question here.

I have recently created a very simple trend-following strategy(double MA crossover) that trades on short and long side. I learned everything until now from IlyaKipnis webinar and blog, however, his ATR position sizing method is not appropriate in my case, because this method assumes that I can access leverage for my system. To address that I tried to use osFUN=osDollarMax approach, but new problem arose. This method increases position size if the price of underlying asset decreases and more of it can be bought. Therefore, when the system has profitable short trade it just keeps scaling up the position until the trend reverses. Can you give me any advice how to remove this scaling in/pyramiding thing entirely from the system? (I mean, that I want my system to open trade and keep the position size constant until it is closed in both, long and short side).

Here's the code for rules:

 
Code
add.rule(strategy.st, name="ruleSignal", 
         arguments=list(sigcol="UpTrend", 
                        sigval=TRUE, 
                        ordertype="market",  
                        orderside="long", 
                        replace=FALSE,       
                        prefer="Open", 
                        osFUN=osMaxDollar,
                        tradeSize=tradeSize,
                        maxSize=tradeSize), 
         type="enter",   path.dep=TRUE,   label="enterLong")

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

## Short rules:
add.rule(strategy.st, name="ruleSignal", 
         arguments=list(sigcol="DownTrend",
                        sigval=TRUE,
                        ordertype="market", 
                        orderside="short",
                        replace=FALSE,
                        prefer="Open",
                        osFUN=osMaxDollar,
                        tradeSize=-tradeSize/2,
                        maxSize=-tradeSize/2), 
         type="enter", path.dep=TRUE)

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

Reply With Quote
 
  #18 (permalink)
Elite Member
seoul, Korea
 
Futures Experience: Intermediate
Platform: Multicharts
Broker/Data: CQG, DTN IQfeed
Favorite Futures: YM 6E
 
treydog999's Avatar
 
Posts: 894 since Jul 2012
Thanks: 291 given, 1,006 received

You can just create your own custom function for positions. Osdollarmax is doing its job correctly as when the asset price decreases relative to your buying power you can aquire more.

Reply With Quote
 
  #19 (permalink)
Trading Apprentice
Vilnius Lithuania
 
Futures Experience: Beginner
Platform: R
Favorite Futures: forex
 
Posts: 3 since Jan 2015
Thanks: 0 given, 0 received

Well, I really don't want to start inventing bicycle (thats why I started using quantstrat instead of creating my own trading platform), so I was just wondering, if there is any position sizing function that buys maximum quantity of stock that can be bought with equity that is available at the moment of order execution instead of initial equity.

Of course, if that doesn't exist, I will have to create my own function.

Reply With Quote
 
  #20 (permalink)
Elite Member
Philadelphia + NJ/US
 
Futures Experience: Beginner
Platform: quantstrat
Favorite Futures: ETFs
 
Posts: 52 since Aug 2014
Thanks: 4 given, 39 received



ViliusP2 View Post
Well, I really don't want to start inventing bicycle (thats why I started using quantstrat instead of creating my own trading platform), so I was just wondering, if there is any position sizing function that buys maximum quantity of stock that can be bought with equity that is available at the moment of order execution instead of initial equity.

Of course, if that doesn't exist, I will have to create my own function.

While that sounds simple to implement, it actually involves recomputing your equity to that point, which is an operation with a non-negligible computing time. Quantstrat operates in cash P&L space, and is a tool to evaluate the efficacy of your signal, not performing return computations. To me, it sounds like you would be better served by writing your strategy in returns space as I have on my blog with some volatility-based strategies, and then evaluating it using PerformanceAnalytics.

Reply With Quote

Reply



futures io > > > > R newbee q.

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
few GOM (ladder/recording) q. for newbee giladbi The Elite Circle 2 December 21st, 2011 06:56 PM


All times are GMT -4. The time now is 07:59 PM.

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-15 in 0.14 seconds with 20 queries on phoenix via your IP 54.163.61.66