Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Trading on level 2 values

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

    dataseries

    hi again,

    problem, so I was trying to use a dataseries list in

    protected override void OnMarketDepth(MarketDepthEventArgs e) {


    and setting some values in that space. But noticed that this only works on bars for past values, so ex:

    PHP Code:
    protected override void OnMarketDepth(MarketDepthEventArgs e) {
            
             updateOrderBook(e);
                
    bid.Set(askVolume);   
     ask.Set(bidVolume);  
                Print(ask[0] +" " +ask[1]); 
    
    wont give you the previous ask, you have to wait for a bar to update and then you get the value at that time. ... very frustrating.

    so my question is how do I get the real ask[1], which is the value that ask[0] was just before

    thanks

    Comment


      use List .... arg

      Comment


        Thanks for the update. Glad to hear it sounds like you're working it out.

        Let me know if we can be of further assistance.
        LanceNinjaTrader Customer Service

        Comment


          yes you can,

          so I built a little strat to record the lvl2 book and I set it up in a way that It creates a folder with the date and then record in a .dat file the data. what if I want to create a folder with the name of the instrument that I am recording? how can I do this? (from a strat, how can I create a folder with the instrument name)

          thanks

          Comment


            Yes you can do that with the Directory Class

            Exposes static methods for creating, moving, and enumerating through directories and subdirectories. This class cannot be inherited.


            Example:
            using System.IO

            Directory.CreateDirectory(UserDataDir + @"templates\sessions\temp");
            LanceNinjaTrader Customer Service

            Comment


              this is what I have as of now:

              protected override void OnStartUp()
              {
              string activeDir = @"e:/" + DateTime.Now.AddDays(1).ToString("dMMMyyyy") ;
              string data = System.IO.Path.Combine(activeDir,"lvl2");
              System.IO.Directory.CreateDirectory(data);

              log_file_lvl2_book = new System.IO.StreamWriter(log_file_name_lvl2_book, true);
              }

              but I want to change the "lvl2" into the instrument that the strategy is using, in this case ES 06-13, so I want the lvl2 folder changed to ES 06-13, but I dont want to explicitely write it , since I want to use the strat to record other instrument as well. so that when I start this same strategy with NQ 06-13 it create a folder for that as well.

              Comment


                You could use something this to create a folder in OnStartUp() that would use the instrument name

                protected override void OnStartUp()
                {
                Directory.CreateDirectory(@"C:\"+Instrument.FullNa me);
                }

                Last edited by NinjaTrader_Lance; 04-22-2013, 09:07 AM.
                LanceNinjaTrader Customer Service

                Comment


                  Hi ,
                  another question;

                  I want to create a general stratety for some testing and want to test a few versions and want to name them and create appropriate folders and files for them


                  in variables:

                  private int name = 700;
                  // output
                  private string log_file_name_trade = "e://" + DateTime.Now.AddDays(1).ToString("dMMMyyyy") + "/test7XX/"+"/test"+name+"_log.dat";
                  private System.IO.StreamWriter log_file_trade_log;
                  and in the properties :


                  #region Properties
                  [Description("")]
                  [GridCategory("Parameters")]
                  public int Name
                  {
                  get { return name; }
                  set { name = Math.Max(1, value); }
                  }
                  #endregion

                  it does not work, and I know its wrong but I am unsure how to proceed. I would like to be able to set the name when I start the strategy from the strategy tab and write 700, or 80 , or anything and then I would get a file with that name.

                  how can I do this?

                  Comment


                    Hello chancehero,

                    Thank you for your note.

                    I believe the issue is you are trying to use "name" and "Name" which are protected system variables.

                    Please try a different variable name for this integer. (also add .ToString to the variable as you will need to convert the integer to a string to include it with the path).


                    Please let me know if this does not resolve your inquiry.
                    Chelsea B.NinjaTrader Customer Service

                    Comment


                      yeah thats what I did and added static in front of the name variable and done.
                      tx

                      Comment


                        simulation / paper trading

                        hi again,
                        I am looking for some yes or no (with explanation) answers for these questions:

                        1) if I am paper trading using SIM101 account, and I place a long limit order, for lets say, at the bid price. it will only be filled if the ASK price gets to it ?

                        2) once that order is filled I place a sell order for that position at 2 ticks of profit. my position will only be filled if the BID price hits it correct ?

                        basically , I'm asking if you have some sort of basic order tracking within the book, as I am running some simulations with my own external program using lvl2 book data, with those two rules above , I run into issue where real paper trades get filled on NT but my other simulation do not. ... very annoying.

                        please spell out the selling and buying method used by NT in simulation mode.
                        (I know that it will be different from what will take place in real live trading - I need to know to make the paper trade match with my own simulations)

                        Comment


                          possible to get a answer to my post ? not sure if it was forgotten. tx

                          Comment


                            Hi chancehero,

                            Thanks for your post. I'm just stepping in today and will have an answer for you shortly.

                            Thank you for your patience.
                            Chelsea B.NinjaTrader Customer Service

                            Comment


                              Hi chancehero,

                              Thanks again for your patience.

                              1) A buy order will fill once the bid price hits it. A limit order placed at the bid price should fill immediately if the price does not move before the order is accepted by the broker.

                              2) The opposite is true of sell orders, a sell order will fill once the ask price has hit it.

                              3) From our help guide "The engine uses a scientific approach to determine fill probability by including a number of variables including: ask/bid volume, trade volume, time (to simulate order queue position), and random time delays for switching between order states."
                              http://www.ninjatrader.com/support/h...simulation.htm

                              This means that there are algorithms used to try and mimic how a real exchange would fill your order. You also have some control over this.
                              • Tools -> Options -> Simulator tab

                              Here you have parameters to change the delay of communication, delay the exchange takes to process your order, amount of time the sim will wait for incoming data to place an order.


                              Please let me know if this does not resolve your inquiry.
                              Chelsea B.NinjaTrader Customer Service

                              Comment


                                so any chance I can have the specifics as to now you make simulation trades.

                                From our help guide "The engine uses a scientific approach to determine fill probability by including a number of variables including: ask/bid volume, trade volume, time (to simulate order queue position), and random time delays for switching between order states."
                                http://www.ninjatrader.com/support/h...simulation.htm.

                                this gives me nothing. I own a license and I can test my strat but I have no idea as to how these get filled. very annoying. I need more specific info ... actual code ?

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                                0 responses
                                596 views
                                0 likes
                                Last Post Geovanny Suaza  
                                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                                0 responses
                                343 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
                                556 views
                                1 like
                                Last Post Geovanny Suaza  
                                Started by RFrosty, 01-28-2026, 06:49 PM
                                0 responses
                                554 views
                                1 like
                                Last Post RFrosty
                                by RFrosty
                                 
                                Working...
                                X