Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Under 25K

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

    Under 25K

    I am under 25K, so I am looking to swing trade rather than day trade. I thus need to make sure the position is exited on a day that is different than the day entered, but I can't find in the Ninjascript library where to get the day a position was entered or the current day. Can any one help?

    Also, is it possible to cap my number of day trades at three for the week?

    #2
    No such requirement in futures.

    Comment


      #3
      Hello CriticalMind,

      Sledge is correct in that with futures you do not have a minimum account balance to day trade so what you are asking may not even apply.

      Both items you have mentioned however are perfectly possible within NinjaTrader using NinjaScript. To get the time an order was filled (the same as when a position is entered) you check the OnExecution method for order fills and then create a DateTime variable to hold the time the order filled. For example:
      Code:
      #region Variables
        DateTime orderFilled;
        IOrder myOrder;
      #endregion
      protected override void OnBarUpdate()
      {
        if(myOrder == null)
        {
          myOrder = EnterLong(); //Submits the order
        }
      }
      protected override void OnExecution(IExecution e)
      {
        if(e.Order.OrderState == OrderState.Filled && e.Order == myOrder)
        {
          orderFilled = DateTime.Now; //Set the orderFilled time
        }
      }
      The code you would use to cap the number of day trades at three for the week would depend significantly on how the rest of your strategy was setup and whether you were planning on leaving your strategy running all week or not. This is because when you close the strategy, it does not save the variables so you would have to have a resource like a file created by your strategy to hold the current number of trades that have been submitted this week and the start or end date of the week which it would reload each time it was enabled.

      Please let me know if you have any questions or if I may be of further assistance anytime.
      Michael M.NinjaTrader Quality Assurance

      Comment


        #4
        Thank you very much. I'll backtest both the futures and swing trading stocks, and find which is most effective.

        Does anyone on the forum know a good place to get the symbol list for NYMEX? I entered some manually, and I got error messages for half of them.

        Comment


          #5
          You can find a list on the CME website at the following link: http://www.cmegroup.com/trading/prod...lse&exch=NYMEX

          Please let me know if you cannot find one of these under Tools > Instrument Manager: http://ninjatrader.com/support/helpG...nt_manager.htm

          Comment


            #6
            I must have been to that website a dozen times, and didn't find that. Thanks so much!

            Comment


              #7
              Will this code work with backtesting?

              Comment


                #8
                Hello CriticalMind,

                For backtesting you will likely want to replace the following code:
                Code:
                orderFilled = DateTime.Now; //Set the orderFilled time
                with something like:
                Code:
                orderFilled = Time[0]; //Set the orderFilled time
                Please let me know if this does not resolve the issue or if I may be of further assistance.
                Michael M.NinjaTrader Quality Assurance

                Comment


                  #9
                  Thanks for the reply. It looks like it still doesn't work. Backtested the NASDAQ 100 since Jan 2015 and only one stock traded once. It normally trades about 20 times a week. Any other ideas. Thanks for your help.

                  Comment


                    #10
                    Hello CriticalMind,

                    So that I can assist in the most efficient manner possible, can you please attach your code in an email to platformsupport[AT]ninjatrader[DOT]com with the subject line: "ATTN: Michael M http://www.ninjatrader.com/support/forum/showthread.php?t=78518"?

                    Thank you in advance.
                    Michael M.NinjaTrader Quality Assurance

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by Aviram Y, Today, 05:29 AM
                    0 responses
                    3 views
                    0 likes
                    Last Post Aviram Y  
                    Started by quantismo, 04-17-2024, 05:13 PM
                    3 responses
                    27 views
                    0 likes
                    Last Post NinjaTrader_Gaby  
                    Started by ScottWalsh, 04-16-2024, 04:29 PM
                    7 responses
                    35 views
                    0 likes
                    Last Post NinjaTrader_Gaby  
                    Started by cls71, Today, 04:45 AM
                    0 responses
                    6 views
                    0 likes
                    Last Post cls71
                    by cls71
                     
                    Started by mjairg, 07-20-2023, 11:57 PM
                    3 responses
                    218 views
                    1 like
                    Last Post PaulMohn  
                    Working...
                    X