Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Trading on level 2 values

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

    thank you so much !

    these answers are very precises and to the point ! definitely you are a great addition to the NT forum team.

    Comment


      Hi chancehero,

      Thank you for the compliment.

      Please let me know if I can still be of assistance.
      Chelsea B.NinjaTrader Customer Service

      Comment


        ok next question:
        so im recording lvl 2 data, execution data and I have to go and turn on every strategy on every night. thats not really a problem, what is the problem is that Im recording 180 ish instuments and I have to start them all.
        is there any way that I can have 1 strategy go through all the instrument in my instrument manager list ?

        Comment


          Hi chancehero,

          While its not possible to directly run a strategy over the Master Instrument list, it is possible to run a strategy over user made instrument lists (such as the default list or the pre-made Dow 30 list or any custom user lists.

          To do this:
          • Click the Strategies tab in the Control Center
          • Right-click the gray area in the Strategies tab -> select New Strategy...
          • In the Data series section click the value for Instruments(s)
          • Check the radio button for Instrument list -> select the Instrument list from the drop-down
          • Change any other settings you would like including the Strategy
          • Click OK


          Also, you could create a list in the Instrument Manager that contains all instruments.

          Below is a link to the help guide on Instrument Lists.
          Last edited by NinjaTrader_ChelseaB; 06-25-2013, 08:34 AM.
          Chelsea B.NinjaTrader Customer Service

          Comment


            yeah. this was what I was going, but having to enable 180+ strategies everyday, is annoying, do you know of a way to start all strategies at the same time ? instead of clicking one by one?

            Comment


              Hi chancehero,

              Try the following:
              • In the Strategies tab click on the grey area or on a strategy to give the Strategies tab focus
              • On your keyboard hit Ctrl + A to select all strategies
              • Right-click any strategy while they are all selected -> select Enable


              Let me know if this does not work for you.
              Chelsea B.NinjaTrader Customer Service

              Comment


                nice ! 10 minutes saved !

                Comment


                  shorting,

                  hi,

                  so I starting working on some strats about shorting and apparently I suck I imputing the right commands in it.

                  NOTE:
                  1) im working in unmanaged,
                  2) I want to short a future at a limit price, at the bid.
                  3) I want to place my profit and stop loss target, but im not sure what to place.
                  help.
                  4) and then to change the stop loss and profit target if something arrises.
                  Last edited by chancehero; 08-30-2013, 10:25 AM.

                  Comment


                    Hi Chancehero,

                    Stop loss orders are placed as stop limit orders and profit targets are placed as limit orders.

                    You will need to have your strategy actively check when you need to adjust those orders by using ChangeOrder() to adjust the price of those orders.
                    Cal H.NinjaTrader Customer Service

                    Comment


                      so examples:

                      I place my orders;
                      enter_short = SubmitOrder(0, OrderAction.SellShort, OrderType.Limit, trade_quantity, enter_price, 0, "", "Enter short");

                      stop_target_short = SubmitOrder(0, OrderAction.BuyToCover, OrderType.StopLimit,trade_quantity,stop_price,stop _price,"","Stop target short");

                      profit_target_short = SubmitOrder(0, OrderAction.BuyToCover, OrderType.Limit,trade_quantity,profit_price,0,""," profit target");

                      and chagne them using :
                      ChangeOrder(profit_target_short, trade_quantity, profit_price, 0);
                      ChangeOrder(stop_target_short, trade_quantity, stop_price, stop_price);

                      does this make sense or will this generate errors?

                      Comment


                        also, is there a post, or some very nice guy that has worked on a piece that deals with Iorder handling with errors, and other sorts of relatively boring , events :
                        NativeError
                        Possible values are:

                        ErrorCode.BrokerOrderError
                        ErrorCode.InvalidInstrument
                        ErrorCode.LoginFailed
                        ErrorCode.NoError
                        ErrorCode.NotConnected
                        ErrorCode.NotSupported
                        ErrorCode.OrderRejected
                        ErrorCode.Panic
                        ErrorCode.ServerConnectionIsBroken
                        ErrorCode.UnableToCancelOrder
                        ErrorCode.UnableToChangeOrder
                        ErrorCode.UnableToSubmitOrder
                        ErrorCode.UserAbort

                        and then
                        OverFill
                        **A bool value representing if the order is an overfill. For use when using Unmanaged orders and IgnoreOverFill

                        and the others possible order values?

                        if so post it here! would be great for everyone to get a good template to work with.

                        Comment


                          Chancehero,

                          The code looks good. If you are worried about errors, you can try using some of the debug methods to find out where one may be coming from and to test if your conditions are working and using the correct values.

                          First of all you would want to use Print() statements to verify values are what you expect - Debugging your NinjaScript code.

                          For strategies add TraceOrders = true to your Initialize() method and you can then view valuable output related to strategy submitted orders through Tools > Output window - TraceOrders

                          It may also help to add drawing objects to your chart for signal and condition confirmation - Drawing Objects.
                          Cal H.NinjaTrader Customer Service

                          Comment


                            thanks,
                            (I ended up finding the problem that was giving me the error, + instead of a -)

                            dont reply to this:

                            Support for the development of custom automated trading strategies using NinjaScript.


                            simple explanation about disconnect handling

                            Comment


                              questions:

                              1) in instrument manager, I can make list, and so on, but it hella-annoying to make long list, always going back and forth.... what a pain, when I make a list, can I find it somewhere in the directory and the simply edit it in a text file? instead of using the editor? what will me the name of that file?

                              2) im using System.IO.StreamWriter to write lvl2 data to my hhd in the market depth , with
                              PHP Code:
                              log_file_lvl2_book.WriteLine("{0},{1},{2},{3},{4},{5}",DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss.fff"),
                                          Instrument.FullName, //and so on... 
                              
                              and the close the program with
                              PHP Code:
                              protected override void OnTermination() 
                                  {
                                      // Disposes resources used by the StreamWriter
                                      if (log_file_lvl2_book != null)
                                      {
                                          log_file_lvl2_book.Dispose();
                                          log_file_lvl2_book = null;
                                      } 
                              
                              im using zen fire connection to run this code (since its free, and my connection with patsystem is just so so...), since I dont have to restart the strategy and can leave it run for the whole week, how can I make the program start recording into a new file when market open at 7pm (atlantic time), someone must of asked this question already.. any way if you can point me in the right direction that would be perfect.

                              thanks

                              Comment


                                Chancehero,

                                The Instrument is stored in the database file which would not be accessible unfortunately.

                                With the System.IO, you may want to use a time filter to tell the script when to close the current text file and start to write a new text file.

                                The link below is a reference sample on how to create a time filter in NinjaScript
                                http://www.ninjatrader.com/support/f...ead.php?t=3226

                                Let me know if I can be of further assistance.
                                Cal H.NinjaTrader Customer Service

                                Comment

                                Latest Posts

                                Collapse

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