Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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.
    BertrandNinjaTrader Customer Service

    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.
        BertrandNinjaTrader Customer Service

        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?
            BertrandNinjaTrader Customer Service

            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.
                BertrandNinjaTrader Customer Service

                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,
                    BertrandNinjaTrader Customer Service

                    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.
                        BertrandNinjaTrader Customer Service

                        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.
                            BertrandNinjaTrader Customer Service

                            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 George21, Today, 10:07 AM
                              0 responses
                              4 views
                              0 likes
                              Last Post George21  
                              Started by Stanfillirenfro, Today, 07:23 AM
                              8 responses
                              23 views
                              0 likes
                              Last Post Stanfillirenfro  
                              Started by DayTradingDEMON, Today, 09:28 AM
                              2 responses
                              16 views
                              0 likes
                              Last Post DayTradingDEMON  
                              Started by navyguy06, Today, 09:28 AM
                              1 response
                              6 views
                              0 likes
                              Last Post NinjaTrader_Gaby  
                              Started by cmtjoancolmenero, Yesterday, 03:58 PM
                              8 responses
                              32 views
                              0 likes
                              Last Post NinjaTrader_ChelseaB  
                              Working...
                              X