How to connect NinjaTrader7 --> MySQL --> R(2.12) - Matlab, R project and Python | futures io social day trading
futures io futures trading


How to connect NinjaTrader7 --> MySQL --> R(2.12)
Updated: Views / Replies:5,368 / 5
Created: by Justin300 Attachments:1

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
 

How to connect NinjaTrader7 --> MySQL --> R(2.12)

  #1 (permalink)
Just starting out...
Ontario
 
Futures Experience: Intermediate
Platform: NinjaTrader
 
Posts: 1 since Jul 2010
Thanks: 1 given, 1 received

How to connect NinjaTrader7 --> MySQL --> R(2.12)

Hi,
Just wanted to share a short example demonstrating how to connect NinjaTrader7 --> MySQL --> R(2.12). The example is just trivial, pulling a vector of closing values from NT7 into R, but it demonstrates the power.


Assumes NT7, MySQL, MySQL Connector/Net, .Net Framework and R are installed.
I used a Windows 7 (64) base. I used NT7(32) and R(32).
Assumes “Complete” install option for MySQL (this includes the client header and library files).
I had to uninstall and then reinstall .Net Framework, MySQL Connector and NT7 for this to work.
NT7 was very fussy about referencing the assemblies to get the MySQL connection.
I used the following reference paths:
C:\Windows\Microsoft.NET\assembly\GAC_MSIL\MySql.Data\v4.0_6.3.6.0__c5687fc88969c44d\MySql.Data.dll
C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Data.dll
This tutorial is a huge help for setting up RMySQL:
http://biostat.mc.vanderbilt.edu/wiki/Main/RMySQL

RMySQL needs Rtools212.exe .
Download and Install (for your version of R):
From:
http://www.murdoch-sutherland.com/Rtools/



Create the MySQL database:

shell> mysql -u root -p
>CREATE DATABASE testBlob;
>use testBlob;
>CREATE TABLE closes (
id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
close MEDIUMBLOB);
>DESCRIBE closes;


Configure R:
Navigate to:
C:\Program Files\R\R-2.12.0\etc
In Renviron.site type:
MYSQL_HOME=C:\\PROGRA~2\\MySQL\\MYSQLS~1.1

I had a hard time finding the short name for the path.
Eventually I used the small vb script found here:
http://www.craig.copperleife.com/tech/windows_short_file_paths.htm

Restart R.
Check that the MYSQL_HOME environment variable is set, at the R prompt type:
Sys.getenv('MYSQL_HOME')
This returns:
MySQL_HOME "C:\\PROGRA~2\\MySQL\\MYSQLS~1.1"
Then in R:
install.packages('RMySQL',type='source')



R Script for connecting to MySQL db:
library(RMySQL)

dd <- dbDriver("MySQL")

con <-dbConnect(MySQL(),user="root",password="12345",dbname="testBlob",host="localhost")

dbListTables(con)

closes <- dbSendQuery(con,"SELECT close FROM `closes`")

closes<-fetch(closes)

vecTest <- as.numeric(unlist(strsplit(closes[1,],split=",")))

I hope this helps you.
Good Luck,

Justin300

NinjaScript example is attached.

Attached Files
Register to download File Type: txt MACrossOverSQL.txt (3.4 KB, 256 views)

Last edited by sam028; January 26th, 2011 at 06:29 PM. Reason: spaces for http addresses removed
Reply With Quote
The following 9 users say Thank You to Justin300 for this post:
 
  #2 (permalink)
Quick Summary
Quick Summary Post

Quick Summary is created and edited by users like you... Add FAQ's, Links and other Relevant Information by clicking the edit button in the lower right hand corner of this message.

 
  #3 (permalink)
Elite Member
Neubrandenburg, Germany
 
Futures Experience: Advanced
Platform: R
Favorite Futures: Stocks
 
wh's Avatar
 
Posts: 538 since Jun 2009
Thanks: 297 given, 480 received


you can also access R from mysql (from your c# code) to send signals to analysis in r.
you do not need com/pinvoke/interop

here the simple steps:

RMySQL Package

then create some sql function where you call R and make your analysis
so you can include what you want (ann, wavelet and other signal processing stuff)

a better and solution will be postgresql (with some pl/r examples)

with R/Perl you can pull to html or back to ninja

(imo it is a better solution as encog or similar)

Causality is the relationship between an event (the cause) and a second event (the effect), where the second event is a consequence of the first.
Reply With Quote
The following 4 users say Thank You to wh for this post:
 
  #4 (permalink)
Elite Member
London
 
Futures Experience: Beginner
Platform: MultiCharts
 
Posts: 230 since Nov 2010
Thanks: 10 given, 20 received

So I just want try to do the same, what is the easy way to follow.
Please You make the easiest way.

Reply With Quote
 
  #5 (permalink)
Trading Apprentice
US
 
Futures Experience: Intermediate
Platform: Ninjatrader, Metatrader
Favorite Futures: EUR/USD, Currency futures
 
Posts: 1 since Jun 2011
Thanks: 0 given, 0 received

could somebody make an videotutorial please or better describe any steps ? bcs I get lost after few steps... thx

Reply With Quote
 
  #6 (permalink)
Site Administrator
Manta, Ecuador
 
Futures Experience: Advanced
Platform: My own custom solution
Favorite Futures: E-mini ES S&P 500
 
Big Mike's Avatar
 
Posts: 46,240 since Jun 2009
Thanks: 29,352 given, 83,233 received

To accomplish this you need a good technical background. This is an advanced topic.

Mike

Due to time constraints, please do not PM me if your question can be resolved or answered on the forum.

Need help?
1) Stop changing things. No new indicators, charts, or methods. Be consistent with what is in front of you first.
2) Start a journal and post to it daily with the trades you made to show your strengths and weaknesses.
3) Set goals for yourself to reach daily. Make them about how you trade, not how much money you make.
4) Accept responsibility for your actions. Stop looking elsewhere to explain away poor performance.
5) Where to start as a trader? Watch this webinar and read this thread for hundreds of questions and answers.
6)
Help using the forum? Watch this video to learn general tips on using the site.

If you want
to support our community, become an Elite Member.

Reply With Quote
The following user says Thank You to Big Mike for this post:

Reply



futures io > > > > How to connect NinjaTrader7 --> MySQL --> R(2.12)

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
BLUELINE DELIGHT >>>Intraday Trading Strategy Guide<<< Gabriyele The Elite Circle 407 May 30th, 2013 08:29 AM
First Indicator programing, Text on graph >> Easy language / Multicharts arjfca The Elite Circle 2 September 22nd, 2010 10:05 PM
TIP : Search for free NinjaTrader Indicator on BMT ? >> How to use our searchtools ! max-td Beginners and Introductions 2 July 19th, 2010 07:16 AM
Strategy Condition Logic >> my wetware Trader.Jon NinjaTrader Programming 2 May 24th, 2010 05:17 PM
Jobs for musicians, DJs, coder, salesman >> Native Instruments Berlin + L.A. max-td Off-Topic 1 March 18th, 2010 10:43 AM


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