Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

mysql database code sample

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #61
    Taddypole, you need to re-compile the script in the editor (with the F5 key) and then you should be able to add it to charts.

    Comment


      #62
      Thank you auspiv,

      I've made it to the next step but now I'm getting a Compile error.
      I think its looking for System.Data.dll.

      I tried putting this dll in the Bin directory under NinjaTrader 7 under the Program directoy but that didn't help.

      Where would System.Data.dll go?

      Thank you,
      taddypole...

      Comment


        #63
        Never mind.
        Found the solution.
        While in the editor, just right click on the code and select references.
        you can then navigate to the assembly to be referenced.

        taddypole...

        Comment


          #64
          I just wanted to revive this thread again.

          And thanks auspiv & ctrlbrk for putting this together, its working great. I just wanted to let everyone know that I have this working in NT 6.5 and 7. 6.5 compiles just fine, but with NT 7 I needed to change in lines 48 from int to long and line 50 from...

          public EurUsdRow(double myPrice, int myVolume, string myMarketMaker)

          to

          public EurUsdRow(double myPrice, long myVolume, string myMarketMaker)

          It looks like 6.5 ignored it and 7 made me change it, so I hope that helps anyone who runs into compile errors...

          Comment


            #65
            I'm doing DB storage of tick data, not with mysql though. See http://www.bigmiketrading.com/ninjat...b-backend.html

            Comment


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

              Hi,
              Posted an example of how to connect NinjaTrader7 --> MySQL --> R(2.12) on Big Mike Trading. http://www.bigmiketrading.com/matlab...html#post91701

              Thanks to auspiv, decus, ctrlbrk for pointing me in the right direction.

              Good Luck,

              Justin300

              Comment


                #67
                Hello there, I would like to add a database to a custom strategy. Can anyone please help me with it? I have been having problems getting it to work because there seems to be a compile error that is hindering me to add mysql.

                DO you guys think that mysql is a good option or do you have any ideas you could suggest?

                Comment


                  #68
                  Hallo cedricf and all,
                  I am new to that intention to store the data in mysql. When I compile the script there occur a compile error and I have problems with the NEW from LadderRow method [rows.Insert(e.Position, new LadderRow(e.Price, e.Volume, e.MarketMaker));] and the e.Volume in line 131 and 146 regarding to convert. Please help me.
                  Thank you in advance.
                  Benjamin

                  Comment


                    #69
                    Is anyone having trouble with .NET 4.0? I can't seem to get NT 7 64-bit to recognize the MySql.Data.dll. I've added it to the NT/bin/Custom directory, referenced it my indicator, added it to my indicator i.e. (using MySql.Data.MySqlClient).

                    It compiles fine but intellisense is not recognizing it and if I create a MySql connection object or command object and attempt to use it in my indicator my indicator won't run correctly. absolutely nothing happens. It appears to blocking my indicator from doing anything!

                    Can someone please provide insight/solution on this problem?

                    Thanks in advance,
                    -DA

                    Comment


                      #70
                      Well, pardon me if someone already mentioned it but i had a php-cron job for maintaining historical date in MySQL. I was doing delta refresh every-night and full refresh every saturday.

                      MySQL supports inserting thousands of rows using single SQL. My full refresh job was extremely efficient because I was inserting 10 years of EoD data in on shot. I started with Oracle DB but finally settled on MySQL only because of this awesome feature.

                      I assume similar technique can rescue you here. Keep data in memory using some collection object and use INSERT after every 2000 ticks. Consider using some messaging (say ActiveMQ) if you can spare one+ machine for this setup.

                      INSERT DELAYED has totally different use-case and won't help here.

                      Great thread ;-)

                      Cheers,
                      - Su

                      Comment


                        #71
                        Are you claiming Oracle does not? What version of oracle were you using, 7? 8?

                        Bulk Load in Oracle did not work?


                        Originally posted by TraderSU View Post
                        Well, pardon me if someone already mentioned it but i had a php-cron job for maintaining historical date in MySQL. I was doing delta refresh every-night and full refresh every saturday.

                        MySQL supports inserting thousands of rows using single SQL. My full refresh job was extremely efficient because I was inserting 10 years of EoD data in on shot. I started with Oracle DB but finally settled on MySQL only because of this awesome feature.

                        I assume similar technique can rescue you here. Keep data in memory using some collection object and use INSERT after every 2000 ticks. Consider using some messaging (say ActiveMQ) if you can spare one+ machine for this setup.

                        INSERT DELAYED has totally different use-case and won't help here.

                        Great thread ;-)

                        Cheers,
                        - Su

                        Comment


                          #72
                          Hello,

                          Ninja compiler gives me error: \ Ninja Trader\bin\Custom\mysql.data.dll could not be found. The file is in thad directory. What am I missing here, could anybody help?

                          Comment


                            #73
                            Hello saabas,
                            It looks like Taddypole had had this same message and it was resolved by changing / adding the reference in the ninjascript editor

                            Have you referenced the DLL by doing the following?

                            Right click in the code section of the NinjaScript editor.
                            In the context menu click on 'References'
                            In the Reference dialog add the reference to the DLL

                            This is a link to the part of the thread where he had solved this.


                            Please let me know if I may be of further assistance.
                            JesseNinjaTrader Customer Service

                            Comment


                              #74
                              Originally posted by NinjaTrader_Jesse View Post
                              Hello saabas,
                              It looks like Taddypole had had this same message and it was resolved by changing / adding the reference in the ninjascript editor

                              Have you referenced the DLL by doing the following?

                              Right click in the code section of the NinjaScript editor.
                              In the context menu click on 'References'
                              In the Reference dialog add the reference to the DLL

                              This is a link to the part of the thread where he had solved this.


                              Please let me know if I may be of further assistance.
                              Hi Jesse,

                              Is there any example of interaction from NT8 to a database (mysql / mssql) ?

                              Thanks

                              Comment


                                #75
                                Hello,

                                Unfortunately not, NinjaTrader its self does not provide samples for third party libraries as there are too many variables to account for regarding that topic.

                                Instead, if you locate any C# mysql tutorials or examples online using a search, these will likely apply to NinjaTrader as well.

                                As long as the dll's .net version matches the NT version you are using, I.E. NT7 requires .net 3.5 or less dlls where NT8 can support up to .net 4.5, it is possible to reference the dll and utilize its code. Also if there are 32 or 64 bit versions, you would need to match that with the version of NT you are running.

                                Also you would need to place whatever required dlls the mysql has in the custom folder and reference them accordingly and then start testing the code required to use the dll piece by piece in an indicator.

                                Often you will need to check the output window and log regarding external dll errors.

                                I look forward to being of further assistance.
                                JesseNinjaTrader Customer Service

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by kujista, Today, 05:44 AM
                                2 responses
                                11 views
                                0 likes
                                Last Post kujista
                                by kujista
                                 
                                Started by trilliantrader, Today, 08:16 AM
                                0 responses
                                3 views
                                0 likes
                                Last Post trilliantrader  
                                Started by AttiM, 02-14-2024, 05:20 PM
                                9 responses
                                174 views
                                0 likes
                                Last Post NinjaTrader_BrandonH  
                                Started by funk10101, Today, 08:14 AM
                                0 responses
                                2 views
                                0 likes
                                Last Post funk10101  
                                Started by adeelshahzad, Today, 03:54 AM
                                1 response
                                13 views
                                0 likes
                                Last Post NinjaTrader_BrandonH  
                                Working...
                                X