Webinar: An Introduction To R for Trading w/Ilya Kipnis - Matlab, R project and Python | futures io social day trading
futures io futures trading


Webinar: An Introduction To R for Trading w/Ilya Kipnis
Updated: Views / Replies:26,854 / 150
Created: by Big Mike Attachments:44

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

Webinar: An Introduction To R for Trading w/Ilya Kipnis

  #91 (permalink)
Elite Member
Lagos, Nigeria
 
Futures Experience: Intermediate
Platform: NinjaTrader, SierraChart
Favorite Futures: Euro Currency & Oil
 
lolu's Avatar
 
Posts: 2,440 since Jun 2009
Thanks: 1,000 given, 1,595 received


IlyaKipnis View Post
You need devtools installed, and need to use the command install_github.

I had devtools already installed ... I'll check the use of install_github. Can I unzip the stuff in the zip file to the folder containing my other R scripts ?

Lolu

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


lolu View Post
I had devtools already installed ... I'll check the use of install_github. Can I unzip the stuff in the zip file to the folder containing my other R scripts ?

Lolu

No. These are R packages.

Reply With Quote
The following user says Thank You to IlyaKipnis for this post:
 
  #93 (permalink)
Elite Member
Lagos, Nigeria
 
Futures Experience: Intermediate
Platform: NinjaTrader, SierraChart
Favorite Futures: Euro Currency & Oil
 
lolu's Avatar
 
Posts: 2,440 since Jun 2009
Thanks: 1,000 given, 1,595 received



IlyaKipnis View Post
No. These are R packages.

Do I issue the install_github at the command/Terminal prompt ?

Lolu

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


lolu View Post
Do I issue the install_github at the command/Terminal prompt ?

Lolu

No, in R

Reply With Quote
The following user says Thank You to IlyaKipnis for this post:
 
  #95 (permalink)
Trading Apprentice
New York City, New York
 
Futures Experience: Advanced
Platform: NinjaTrader, TOS
Favorite Futures: Options, Equities, Futures
 
Posts: 18 since Sep 2014
Thanks: 2 given, 5 received

Can someone explain to me what these errors mean?

If someone could tell me what these errors mean, or suggest a solution, I would appreciate it.

 
Code
> #trade statistics
> tStats <- tradeStats(Portfolios = portfolio.st, use = "trades", inclZeroDays = FALSE)
> tStats[,4:ncol(tStats)] <- round(tStats[,4:ncol(tStats)], 2)
Error in 4:ncol(tStats) : argument of length 0
> print(data.frame(t(tStats[,-c(1,2)])))
Error in t.default(tStats[, -c(1, 2)]) : argument is not a matrix
> (aggPF <- sum(tStats$Gross.Profits) /-sum(tStats$Gross.Losses))
[1] NaN
> (aggCorrect <- mean(tStats$Percent.Positive))
[1] NA
Warning message:
In mean.default(tStats$Percent.Positive) :
  argument is not numeric or logical: returning NA
> (numTrades <- sum(tStats$Num.Trades))
[1] 0
> (meanAvgWLR <- mean(tStats$Avg.WinLoss.Ratio[tStats$Avg.WinLoss.Ratio < Inf], na.rm = TRUE))
[1] NA
Warning message:
In mean.default(tStats$Avg.WinLoss.Ratio[tStats$Avg.WinLoss.Ratio <  :
  argument is not numeric or logical: returning NA
>

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


CaptainNegatory View Post
If someone could tell me what these errors mean, or suggest a solution, I would appreciate it.

 
Code
> #trade statistics
> tStats <- tradeStats(Portfolios = portfolio.st, use = "trades", inclZeroDays = FALSE)
> tStats[,4:ncol(tStats)] <- round(tStats[,4:ncol(tStats)], 2)
Error in 4:ncol(tStats) : argument of length 0
> print(data.frame(t(tStats[,-c(1,2)])))
Error in t.default(tStats[, -c(1, 2)]) : argument is not a matrix
> (aggPF <- sum(tStats$Gross.Profits) /-sum(tStats$Gross.Losses))
[1] NaN
> (aggCorrect <- mean(tStats$Percent.Positive))
[1] NA
Warning message:
In mean.default(tStats$Percent.Positive) :
  argument is not numeric or logical: returning NA
> (numTrades <- sum(tStats$Num.Trades))
[1] 0
> (meanAvgWLR <- mean(tStats$Avg.WinLoss.Ratio[tStats$Avg.WinLoss.Ratio < Inf], na.rm = TRUE))
[1] NA
Warning message:
In mean.default(tStats$Avg.WinLoss.Ratio[tStats$Avg.WinLoss.Ratio <  :
  argument is not numeric or logical: returning NA
>

It means the demo didn't run correctly before that point.

Reply With Quote
 
  #97 (permalink)
Trading Apprentice
New York City, New York
 
Futures Experience: Advanced
Platform: NinjaTrader, TOS
Favorite Futures: Options, Equities, Futures
 
Posts: 18 since Sep 2014
Thanks: 2 given, 5 received


IlyaKipnis View Post
It means the demo didn't run correctly before that point.

Any idea why? Everything runs properly up until the trade statistics. Maybe you could post your code from the tutorial video?

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

Did you get orders printing to the console?

Reply With Quote
 
  #99 (permalink)
Trading Apprentice
New York City, New York
 
Futures Experience: Advanced
Platform: NinjaTrader, TOS
Favorite Futures: Options, Equities, Futures
 
Posts: 18 since Sep 2014
Thanks: 2 given, 5 received


IlyaKipnis View Post
Did you get orders printing to the console?

No I didn't. But all the code ran.

 
Code
> require("quantstrat")
> require("IKTrading")
> require("DSTrading")
> 
> options("getSymbols.warning4.0" = FALSE)
> rm(list=ls(.blotter), envir = .blotter)
> currency('USD')
[1] "USD"
> Sys.setenv(TZ="UTC")
> 
> symbols <- "SPY"
> suppressMessages(getSymbols(symbols, from = "1998-01-01", to = "2012-12-31"))
[1] "SPY"
> stock(symbols, currency = "USD", multiplier = 1)
[1] "SPY"
> initDate = "1990-01-01"
> 
> tradeSize <- 100000
> initEq <- tradeSize * length(symbols)
> 
> strategy.st <- portfolio.st <- account.st <- "RSI_Strat_Test"
> rm.strat(portfolio.st)
> rm.strat(strategy.st)
> initPortf(portfolio.st, symbols = symbols, initDate = initDate, currency = "USD")
[1] "RSI_Strat_Test"
> initAcct(account.st, portfolios = portfolio.st, initDate = initDate, currency = "USD", initEq = initEq)
[1] "RSI_Strat_Test"
> initOrders(portfolio.st, initDate = initDate)
> strategy(strategy.st, store = TRUE)
> 
> #parameters
> nRSI = 2
> thresh1 = 10
> thresh2 = 6
> 
> nSMAexit = 5
> nSMAfilter = 200
> 
> period = 10
> pctATR = .02
> maxPct = .04
> 
> #indicators
> add.indicator(strategy.st, name="lagATR", arguments = list(HLC = quote(HLC(mktdata))), n = period,
+               label = "atrx")
[1] "RSI_Strat_Test"
> 
> add.indicator(strategy.st, name = "RSI", arguments = list(price = quote(Cl(mktdata)), n = nRSI),
+               label = "rsi")
[1] "RSI_Strat_Test"
> 
> add.indicator(strategy.st, name = "SMA", arguments = list(x = quote(Cl(mktdata)), n = nSMAexit),
+               label = "quickMA")
[1] "RSI_Strat_Test"
> 
> add.indicator(strategy.st, name = "SMA", arguments = list(x = quote(Cl(mktdata)), n = nSMAfilter),
+               label = "filterMA")
[1] "RSI_Strat_Test"
> 
> #signals
> add.signal(strategy.st, name="sigComparison", 
+            arguments = list(columns = c("Close", "filterMA"),relationship = "gt"),
+            label = "upTrend")
[1] "RSI_Strat_Test"
> 
> add.signal(strategy.st, name="sigThreshold", arguments = list(column = "rsi", threshold = thresh1, relationship = "lt",
+            cross = FALSE), label = "rsiThresh1")
[1] "RSI_Strat_Test"
> 
> add.signal(strategy.st, name="sigThreshold", arguments = list(column = "rsi", threshold = thresh2, relationship = "lt",
+            cross = FALSE), label = "rsiThresh2")
[1] "RSI_Strat_Test"
> 
> add.signal(strategy.st, name="sigAND", arguments = list(columns = c("rsiThresh1","upTrend"), cross = TRUE),
+            label = "longEntry1")
[1] "RSI_Strat_Test"
> 
> add.signal(strategy.st, name="sigAND", arguments = list(columns = c("rsiThresh2","upTrend"), cross = TRUE),
+            label = "longEntry2")
[1] "RSI_Strat_Test"
> 
> add.signal(strategy.st, name="sigCrossover", arguments = list(columns = c("Close","quickMA"), relationship = "gt"),
+            label = "exitLongNormal")
[1] "RSI_Strat_Test"
> 
> add.signal(strategy.st, name="sigCrossover", arguments = list(columns = c("Close","filterMA"), relationship = "lt"),
+            label = "exitLongFilter")
[1] "RSI_Strat_Test"
> 
> #rules
> add.rule(strategy.st, name = "ruleSignal",
+          arguments = list(sigcol = "longEntry1",
+                           sigval = TRUE,
+                           ordertype = "market",
+                           orderside = "long",
+                           replace = FALSE,
+                           prefer = "Open",
+                           osFun = osDollarATR,
+                           tradeSize = tradeSize,
+                           pctATR = pctATR,
+                           maxPctATR = pctATR,
+                           atrMod = "X"),
+          type = "enter", path.dep = TRUE, label = "enterLong1")
[1] "RSI_Strat_Test"
> 
> add.rule(strategy.st, name = "ruleSignal",
+          arguments = list(sigcol = "longEntry2",
+                           sigval = TRUE,
+                           ordertype = "market",
+                           orderside = "long",
+                           replace = FALSE,
+                           prefer = "Open",
+                           osFun = osDollarATR,
+                           tradeSize = tradeSize,
+                           pctATR = pctATR,
+                           maxPctATR = maxPct,
+                           atrMod = "X"),
+          type = "enter", path.dep = TRUE, label = "enterLong2")
[1] "RSI_Strat_Test"
> 
> add.rule(strategy.st, name = "ruleSignal",
+          arguments = list(sigcol = "exitLongNormal",
+                           sigval = TRUE,
+                           orderqty = "all",
+                           ordertype = "market",
+                           orderside = "long",
+                           replace = FALSE,
+                           prefer = "Open",
+          type = "exit", path.dep = TRUE, label = "normalExitLong"))
[1] "RSI_Strat_Test"
>          
> add.rule(strategy.st, name = "ruleSignal",
+         arguments = list(sigcol = "exitLongFilter",
+                          sigval = TRUE,
+                          orderqty = "all",
+                          ordertype = "market",
+                          orderside = "long",
+                          replace = FALSE,
+                          prefer = "Open",
+          type = "exit", path.dep = TRUE, label = "filterExitLong"))
[1] "RSI_Strat_Test"
>         
> #apply strategy
> t1 <- Sys.time()
> out <- applyStrategy(strategy = strategy.st, portfolios = portfolio.st)
> t2 <- Sys.time()
> print(t2 - t1)
Time difference of 5.135864 secs
> 
> #set up analytics
> updatePortf(portfolio.st)
[1] "RSI_Strat_Test"
> dateRange <- time(getPortfolio(portfolio.st)$summary[-1])
> updateAcct(portfolio.st, dateRange)
[1] "RSI_Strat_Test"
> updateEndEq(account.st)
[1] "RSI_Strat_Test"

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


Can you tell me what head(mktdata) shows?

Reply With Quote

Reply



futures io > > > > Webinar: An Introduction To R for Trading w/Ilya Kipnis

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: Introduction to C# and Ninjascript Programming, Feb 23rd @ 1:00PM Eastern shodson The Elite Circle 67 December 2nd, 2014 08:44 PM
Webinar: FuturePath Trading and PhotonTrader introduction w/Damon Pavlatos Big Mike Reviews of Brokers and Data Feeds 47 February 7th, 2014 12:03 PM
Webinar: MultiCharts and Zen-Fire Introduction Big Mike MultiCharts 12 October 4th, 2012 02:15 PM
Webinar Trading Video: Live Trading and Technical Analysis of EuroStoxx 50 max-td Trading Reviews and Vendors 1 March 13th, 2010 07:35 AM
Introduction: Sim trading S&P with Ninja traders SOM123 Traders Hideout 5 December 13th, 2009 11:27 AM


All times are GMT -4. The time now is 12:56 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-14 in 0.11 seconds with 20 queries on phoenix via your IP 54.221.93.187