Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Optimizing exit time

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

    Optimizing exit time

    Hi,

    I want to optimize the exittime of an strategy. So I used an integer valued strategy parameter and the method ToTime(). The results are perfect.

    But how do I skip uncorrect times like 106600 (so the 66th minute of an hour)? I increment by 100 which means by 1 minute. This only makes sense from 0 to 59 (not to 99).

    Is there a way that I can set the result of an backtest / optimization to "null" / "undefined" / no result. So that the optimization graph does not show it...



    Regards,

    Martin
    Attached Files

    #2
    Hello emakon,

    Thank you for your note.

    If you set a trading hours template which excludes these hours does this resolve the issue?

    I look forward to your reply.
    Alan P.NinjaTrader Customer Service

    Comment


      #3
      No, this does not help. It does not make sense.

      ToTime( Times[0][0] ) >= MyIntegerTimeNumber

      If MyIntegerTimeNumber loops from 160000 to 166600 it has nothing to do with trading hours.

      Comment


        #4
        Hello emakon,

        So I may test on my end please provide a simplified script which demonstrates the behavior.

        I look forward to your reply.
        Alan P.NinjaTrader Customer Service

        Comment


          #5
          if ( ToTime( Times[0][0] ) == MyIntegerTimeNumber ) {
          EnterLong(Convert.ToInt32(DefaultQuantity), "");
          }

          #region Properties
          [NinjaScriptProperty]
          [Range(1, int.MaxValue)]
          [Display(Name="MyIntegerTimeNumber", Order=1, GroupName="Parameters")]
          public int MyIntegerTimeNumber
          { get; set; }
          #endregion

          Comment


            #6
            Hello emakon,

            Thanks for writing back.

            There would be a few ways you could accomplish this. The easiest would probably be to make three integer variables to construct a time you want to use for comparison. You could limit the range of those variables as well. You would then want to use the overload for the hour, minute and second.

            ToTime(int hour, int minute, int second)

            I've provided a link to our openly available documentation on ToTime() for reference and example code: https://ninjatrader.com/support/help...us/?totime.htm

            Further reference for limiting range of parameters can be found here:


            If there is anything else I can do to help out, please let me know.
            JimNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Tim-c, Today, 10:58 AM
            0 responses
            1 view
            0 likes
            Last Post Tim-c
            by Tim-c
             
            Started by traderqz, Yesterday, 09:06 AM
            3 responses
            21 views
            0 likes
            Last Post NinjaTrader_ThomasC  
            Started by f.saeidi, Today, 10:19 AM
            1 response
            5 views
            0 likes
            Last Post NinjaTrader_BrandonH  
            Started by kujista, Today, 06:23 AM
            5 responses
            17 views
            0 likes
            Last Post kujista
            by kujista
             
            Started by traderqz, Today, 12:06 AM
            3 responses
            6 views
            0 likes
            Last Post NinjaTrader_Gaby  
            Working...
            X