Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

is there any way to record volumes (ask size and bid size)

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

    #16
    Originally posted by NinjaTrader_Austin View Post
    No, it doesn't have to be hardcoded, but it doesn't work with loops. This, for example, works fine:
    Code:
    private string inst = @"ES 09-11";
    
    Initialize()
    {
       Add(inst, PeriodType.Minute, 1);
    }

    What errors were you having that were resolved with the restart?
    What's the @ doing in the front of the value?

    Comment


      #17
      The @ declares the string as a literal string. To be honest, I wasn't exactly sure what it meant myself, but a quick search yielded this from MSDN:
      Code:
      The advantage of @-quoting is that escape sequences are not processed, which makes it easy to write, for example, a fully qualified file name:
      Copy
      
      @"c:\Docs\Source\a.txt"  // rather than "c:\\Docs\\Source\\a.txt"
      AustinNinjaTrader Customer Service

      Comment


        #18
        Originally posted by NinjaTrader_Austin View Post
        No, it doesn't have to be hardcoded, but it doesn't work with loops. This, for example, works fine:
        Code:
        private string inst = @"ES 09-11";
        
        Initialize()
        {
           Add(inst, PeriodType.Minute, 1);
        }

        What errors were you having that were resolved with the restart?
        I couldn't believe this - that it receives a string, but it doesn't work in loop. What the loop had to do with string passing? So I started my strategy, with programatic symbol adding in the loop. It took the symbols, as I've seen them in the strategy tab after clicking on plus button near the strategy. But I don't have any idea where I can check what it Prints. Where is that window?

        Comment


          #19
          fxeconomist, you can check the prints in the output window which is started from the Control Center under Tools.

          Comment


            #20
            New problems...

            Originally posted by NinjaTrader_Bertrand View Post
            fxeconomist, you can check the prints in the output window which is started from the Control Center under Tools.
            Thanks Bertrand!

            Now the question is, if I specify an instrument or an instrument list at the instrument field when launching New Strategy, will these be added BEFORE my instruments that I specify on Symbol1, Symbol2 and so on? I mean, for instance I want "6E 09-11" as Symbol1 (on bar 0) and "6J 09-11" as Symbol2 (on bar 1). But if I forgot "YM 09-11" on the instrument field, that will probably be added before my symbols in Initialize() thus making 6E to jump on bar 1 and 6J on bar 2. How do I know how many symbols have been previously added, which corresponds to which bar, and how do I remove them, if I want?

            In the meanwhile, I'm struggling with System.Data.dll to send ticks to a FoxPro database via ODBC driver.

            Comment


              #21
              fxeconomist, all Add()s are done before the first OnBarUpdate() call, and after the instrument you're running it on loads.

              Adding and removing various instrument series is not supported.

              As for the database stuff, take a look at this thread (which is also unfortunately not supported) -
              http://www.ninjatrader.com/support/f...ad.php?t=10296.
              AustinNinjaTrader Customer Service

              Comment


                #22
                Originally posted by NinjaTrader_Austin View Post
                fxeconomist, all Add()s are done before the first OnBarUpdate() call, and after the instrument you're running it on loads.

                Adding and removing various instrument series is not supported.

                As for the database stuff, take a look at this thread (which is also unfortunately not supported) -
                http://www.ninjatrader.com/support/f...ad.php?t=10296.
                so, i understand that the system doesn't add anything before the Initialize(). Then, if you pass an instrument or a list within the instrument(s) field, and you want to add them in the initialize, how do you address them? What is the object that refers what is in that field?

                Comment


                  #23
                  Can you please clarify what you're asking here? What do you mean by pass an instrument or list to the instrument field?
                  AustinNinjaTrader Customer Service

                  Comment


                    #24
                    In my script, the instruments have to be introduced one by one, in fields that I defined : Symbol1, Symbol2,...

                    But, how do I look also at the instrument(s) field , which can contain one instrument or an instrument list. You can see this field after clicking on New Strategy, last field in the Data Series section. As I understood these instruments are not automatically added before the Initialize() and I would like to also see what's in this field.

                    Comment


                      #25
                      Thanks, when you do a new strategy for an entire instrument list, there is one new strategy created for each instrument in the list. You can get the instrument name with Instrument.FullName - http://www.ninjatrader.com/support/h...t_fullname.htm.
                      Code:
                      string instName = Instrument.FullName;
                      These instruments are the first instrument added when a strategy is started. Anything added in Initialize() comes after that first instrument.
                      AustinNinjaTrader Customer Service

                      Comment


                        #26
                        Thanks, good that's clear that aspect now.

                        Comment


                          #27
                          Originally posted by NinjaTrader_Austin View Post
                          fxeconomist, all Add()s are done before the first OnBarUpdate() call, and after the instrument you're running it on loads.

                          Adding and removing various instrument series is not supported.

                          As for the database stuff, take a look at this thread (which is also unfortunately not supported) -
                          http://www.ninjatrader.com/support/f...ad.php?t=10296.
                          No, you're not right. Stuff gets added before Initialize(). I was having QG 06-11 on Symbol1, but on instrument field was set, as default, YM 06-11. And I see on bar 0 I receive stuff like 10612. Means that these symbols are added before the Initialize() gets fired, because in Initialize i do Add only on my stuff.
                          Last edited by fxeconomist; 08-09-2011, 12:45 PM.

                          Comment


                            #28
                            Originally posted by fxeconomist View Post
                            No, you're not right. Stuff gets added before Initialize(). I was having QG 06-11 on Symbol1, but on instrument field was set, as default, YM 06-11. And I see on bar 0 I receive stuff like 10612. Means that these symbols are added before the Initialize() gets fired, because in Initialize i do Add only on my stuff.
                            Then it seems that you added the strategy to a YM chart. The first instrument is ALWAYS the instrument on the chart that you are running on.

                            Comment


                              #29
                              Originally posted by koganam View Post
                              Then it seems that you added the strategy to a YM chart. The first instrument is ALWAYS the instrument on the chart that you are running on.
                              Which means, that if I apply it to a list, this list will be before everything I add. So, reiterating my question, could I find out, in the Initialize(), at least how many instruments are already there? for instance

                              Code:
                               protected override void Initialize()
                                      {
                                       int already=.....
                                       Add("6E 09-11",PeriodType.Tick,1); //i know 6E will have BarsInProgress=already;
                                       Add("6J 09-11",PeriodType.Tick,1); //i know 6J will have BarsInProgress=already+1
                                      //and so on
                                     }
                              is there anything to tell me the value of that "already" ? Or, even more, is there a way to enumerate these already present symbols? For instance , i wanna know what symbol is on 0, what is on 1, and so on. Is this possible?

                              Comment


                                #30
                                fxeconomist,

                                You will only know when you are done processing Initialize().

                                What is your concern for this info though? If you really want it to just be all known what you can do is completely ignore BarsInProgress 0, add all the series you want and then you will know what 1, 2, 3, 4 will be based on the order you added them in Initialize().

                                Also, you will always know what 0 is before you even begin the script because that is the series you will be adding your script onto. If you need it to be 6E or 6J, just make sure you correctly add it to the 6E or 6J chart.
                                Josh P.NinjaTrader Customer Service

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                                0 responses
                                602 views
                                0 likes
                                Last Post Geovanny Suaza  
                                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                                0 responses
                                347 views
                                1 like
                                Last Post Geovanny Suaza  
                                Started by Mindset, 02-09-2026, 11:44 AM
                                0 responses
                                103 views
                                0 likes
                                Last Post Mindset
                                by Mindset
                                 
                                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                                0 responses
                                559 views
                                1 like
                                Last Post Geovanny Suaza  
                                Started by RFrosty, 01-28-2026, 06:49 PM
                                0 responses
                                559 views
                                1 like
                                Last Post RFrosty
                                by RFrosty
                                 
                                Working...
                                X