Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Time of Day

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

    Time of Day

    Hi everyone,

    regarding the time of day filter, is it possible to set 2 user defined inputs like:

    StrategyStart
    StrategyStop

    and let the user insert the parameters for deciding the time window in which the trades will be opened?
    If yes, which would be the format of that user input (int, string, or what)?

    The alternative is to set the timeseries and timevalue in the wizard and changing them each time I would like to try different times of day.

    thank you,

    John.

    #2
    Hi John, that would be possible either via int inputs for the hour and minute component, or by using an input of DateTime directly.

    The advantage of int's would be that you could also optimize them via the Strategy Analyzer.

    Comment


      #3
      Originally posted by NinjaTrader_Bertrand View Post
      Hi John, that would be possible either via int inputs for the hour and minute component, or by using an input of DateTime directly.

      The advantage of int's would be that you could also optimize them via the Strategy Analyzer.
      Hi Bertrand,

      so the type of the user input should be "int"? and the format for, let's say 9.00 AM should be 90000?
      And then select Timeseries >= the user input (if I want the trades to be executed from 9:00 onwards?).

      I have tried what stated above, but I get an error message like "timeseries and int32 do not match".

      thank you,

      John

      Comment


        #4
        Hi John, are you working via the strategy wizard interface here? That would unfortunately only be possible to setup via custom coding.

        Comment


          #5
          Hi Bertrand,

          yes, I was using the wizard.
          If I want to limit the exections between 9:00 and 19.00, should I put in the Conditions and Actions the following conditions:

          Timeseries >= Timevalue (and as per time value: 9.00)

          Timeseries <= Timevalue (and as per time value: 19.00)

          It seems that in this way the trades are not filtered out.

          thank you again,

          John.

          Comment


            #6
            Yes, and then you would list your other entry conditions as well in the same set, correct? So it becomes one entry condition for the script in the end that would contain the time filter as well, for example if this time filter sits in a separate set > it would not be effective per default.

            Also: time stamps may not match exactly on tick based charts, which chart type / timeframe were you testing this script on?

            Comment


              #7
              Hi Bertrand,

              I have 4 sets of conditions, each of them leads to a trade execution, once met certain conditions.
              I have added the time filter as specifiedin each of them, but it doesn't filter out the trades as it was supposed to do.

              I am testing this on the EUR/USD 1 min historical data.

              What is missing?

              thank you,

              John.

              Comment


                #8
                John, please check the trades seen - do you actually see fresh entries outside your time filter region? Or would you see trades being held / continued outside the filtered times? This would then needed to be addressed in a different set, so that your trades are closed if time > 19:00 for example, this is something the time filter rule in your entry conditions sets would not be expected to do.

                Comment


                  #9
                  HI,

                  yes I see executions outside the window specified (I am only interested in the execution time).
                  for example I have and exec at 3:25 AM, one on 20:15 and one on 00:05,

                  What do you think may be wrong?

                  thank you,

                  John.

                  Comment


                    #10
                    Can you please export me the file you test with and either attach here, or send to me at support at ninjatrader dot com?

                    We will then give it a run here and let you know.

                    Thanks,

                    Comment


                      #11
                      Do you mean a set of the historical data?

                      Comment


                        #12
                        Originally posted by johnlucas View Post
                        Do you mean a set of the historical data?
                        No, I was referring to the strategy script you test with. If possible and ok for you, I would like to give this a run on our end to test.

                        Comment


                          #13
                          Hi Bertrand,

                          I have just sent the script as an attachment to support at ninjatrader.com
                          the subject is: To Bertrand_TimeOfDay

                          thank you,

                          John.

                          Comment


                            #14
                            Ok, thanks - will check into it shortly.

                            Comment


                              #15
                              Hi Bertrand,

                              I am going to try soon your modified script.
                              What is important is that a trade won't be closed outside the time window, but that only new trades are taken within that window.

                              Do you think it does that?

                              thank you,

                              John.

                              Comment

                              Latest Posts

                              Collapse

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