MySQL & Ninja - NinjaTrader Programming | futures io social day trading
futures io futures trading


MySQL & Ninja
Updated: Views / Replies:4,306 / 18
Created: by dsraider 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
 1  
 
Thread Tools Search this Thread
 

MySQL & Ninja

  #11 (permalink)
Elite Member
Portland, OR
 
Futures Experience: Intermediate
Platform: Sierra Chart
Favorite Futures: ES
 
Posts: 269 since Jan 2011
Thanks: 326 given, 179 received

Thanks dsraider. Appreciate it. Checking out.

Mike - FYI:

your code is located in this thread:

NinjaTrader Support Forum - View Single Post - mysql database code sample

full thread:
mysql database code sample - Page 3 - NinjaTrader Support Forum

futures.io (formerly BMT) link:
https://futures.io/ninjatrader-programming/1298-mysql-db-writer.html

Reply With Quote
The following user says Thank You to ejtrader for this post:
 
  #12 (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,238 since Jun 2009
Thanks: 29,350 given, 83,217 received


ejtrader View Post
Thanks dsraider. Appreciate it. Checking out.

Mike - FYI:

your code is located in this thread:

NinjaTrader Support Forum - View Single Post - mysql database code sample

full thread:
mysql database code sample - Page 3 - NinjaTrader Support Forum

futures.io (formerly BMT) link:
https://futures.io/ninjatrader-programming/1298-mysql-db-writer.html

Thanks for digging. Unfortunately that was my first round of code, not with the enhancements I made later and then lost somehow.

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
 
  #13 (permalink)
Elite Member
Portland, OR
 
Futures Experience: Intermediate
Platform: Sierra Chart
Favorite Futures: ES
 
Posts: 269 since Jan 2011
Thanks: 326 given, 179 received


dsraider - Just wanted to let you know - I am able to write the data as well.

In the end it turned out to be the System.Data.dll - reference ( it was pointed to net 4.0 version and later changed to 2.0).

Should be able to experiment further going forward as this was the initial hurdle

PS: I think this should work fine with net 3.5 version of this dll as well - but would have to experiment further.

Thanks.

Attached Thumbnails
MySQL & Ninja-nt_references.jpg  
Reply With Quote
 
  #14 (permalink)
Trading for Fun
New York, NY
 
Futures Experience: Advanced
Platform: NinjaTrader
Broker/Data: Amp Futures/Zen-Fire
Favorite Futures: ES
 
Posts: 142 since Dec 2009
Thanks: 41 given, 83 received

EJ - Awesome!

Thanks for letting me know. My 3.5 dll wasn't readily available (read I was tired and frustrated and couldn't find it at first glance) so I went with 2.0, wrote to MySQL and promptly ran away. Would definitely be interested to hear if 3.5 works out better for you.

P.S. Mike, I didn't realize you'd written the my_sql_db code from which I based mine so thanks yet again.

Reply With Quote
 
  #15 (permalink)
Trading for Fun
New York, NY
 
Futures Experience: Advanced
Platform: NinjaTrader
Broker/Data: Amp Futures/Zen-Fire
Favorite Futures: ES
 
Posts: 142 since Dec 2009
Thanks: 41 given, 83 received

EJ, Mike et al,

Wondering if anyone has successfully separated code in the following way:

OnStartUp() - open connection

OnBarUpdate() - execute insert command (though will change later per Mike's suggestion)

OnTermination() close connection

While Print statements are telling me each of these are being called, and everything compiles properly, it's simply not working.

Placing connection.Open() in OnStartUp() gives me: Error on calling 'OnBarUpdate' method for indicator '[indicator]' on bar 0: Connection must be valid and open.

Placing connection.Close() in OnTermination gives me a message about pooling, which I've found out means I've opened too many connections WITHOUT closing any (this occurs when moving connection.Open() back to OnBarUpdate() with insert code).

Reply With Quote
 
  #16 (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,238 since Jun 2009
Thanks: 29,350 given, 83,217 received


dsraider View Post
EJ, Mike et al,

Wondering if anyone has successfully separated code in the following way:

NT7 was before my time with this So I can't comment much, except to say just add more debug print statements to see what is going on and track down the bad code.

Also check your MySQL settings, make sure the timeout is sufficiently high to not force close the connection on the server side between inserts if you choose to keep the connection open on the client (which would be my choice).

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
 
  #17 (permalink)
Elite Member
Portland, OR
 
Futures Experience: Intermediate
Platform: Sierra Chart
Favorite Futures: ES
 
Posts: 269 since Jan 2011
Thanks: 326 given, 179 received

There is an excellent thread started by GOMI ( Kudos to him!! ) - which has everything that is needed to get this done correct.

Here is the thread.

https://futures.io/elite-circle/17298-ninjatrader-framework-access-trades-history-indicators-using-ninjatrader-database.html

Reply With Quote
The following user says Thank You to ejtrader for this post:
 
  #18 (permalink)
 Vendor: www.probabletrades.com 
OC, California, USA
 
Futures Experience: Advanced
Platform: IB/TWS, NinjaTrader, thinkorswim
Favorite Futures: stocks, options, futures, VIX
 
shodson's Avatar
 
Posts: 1,859 since Jun 2009
Thanks: 480 given, 3,254 received


dsraider View Post
EJ, Mike et al,

Wondering if anyone has successfully separated code in the following way:

OnStartUp() - open connection

OnBarUpdate() - execute insert command (though will change later per Mike's suggestion)

OnTermination() close connection

While Print statements are telling me each of these are being called, and everything compiles properly, it's simply not working.

Placing connection.Open() in OnStartUp() gives me: Error on calling 'OnBarUpdate' method for indicator '[indicator]' on bar 0: Connection must be valid and open.

Placing connection.Close() in OnTermination gives me a message about pooling, which I've found out means I've opened too many connections WITHOUT closing any (this occurs when moving connection.Open() back to OnBarUpdate() with insert code).

Since you haven't included any code I can only offer a couple of thoughts

1) make sure your connection object has class scope, and is not a variable declared within your OnStartUp() method.

2) I would initialize and open the connection in OnBarUpdate() but only if the connection object is null. This helps prevent issues assuming that OnStartUp() will only be called once and only once at the beginning of the strategy's execution.

I have not done this with MySql, but I have done it with MS SQL, which you can download for free, and .NET is much more friendly to SQL Server out of the box. It's possible you need a .NET 4-friendly MySql driver, or use the older driver as some have done.

Reply With Quote
 
  #19 (permalink)
Trading for Fun
New York, NY
 
Futures Experience: Advanced
Platform: NinjaTrader
Broker/Data: Amp Futures/Zen-Fire
Favorite Futures: ES
 
Posts: 142 since Dec 2009
Thanks: 41 given, 83 received

Apologies for the delayed response. They're trying to kill me in the real world...

Thank you to everyone for your suggestions. Unfortunately, nothing I've tried has worked. shodson, I've actually including my current working code early on in this thread. If you have time to check it out, I'd definitely appreciate it. I'm starting to think it might be an NT issue but this is "Unsupported."

DS

Reply With Quote

Reply



futures io > > > > > MySQL & Ninja

Thread Tools Search this Thread
Search this Thread:

Advanced Search



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

Linda Bradford Raschke: Reading The Tape

Elite only

Adam Grimes: TBA

Elite only

NinjaTrader: TBA

January

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
ninja & AutoHotKey for order entrys bobarian NinjaTrader 55 April 6th, 2016 03:59 PM
GomRecorder with MySQL backend Big Mike The Elite Circle 25 October 14th, 2012 05:46 PM
Ninja T&S Trades Above and Below the Market Trafford Traders Hideout 3 January 6th, 2011 05:58 PM
My 2 cents in mysql database iwannatoscript NinjaTrader Programming 5 March 7th, 2010 09:56 AM
mysql db writer tortexal NinjaTrader Programming 2 November 27th, 2009 11:59 AM


All times are GMT -4. The time now is 03:11 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-11 in 0.14 seconds with 20 queries on phoenix via your IP 54.226.172.30