Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

strategy wizard - set trading times

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

    strategy wizard - set trading times

    How do I utilize the strategy wizard to make this happen?

    if (
    (ToTime(Time[0]) > ToTime(9, 45, 0) && ToTime(Time[0]) < ToTime(12, 30, 0)) || (ToTime(Time[0]) > ToTime(14, 30, 0) && ToTime(Time[0]) < ToTime(16, 15, 0))
    && whatever else conditions
    )

    #2
    Hello tdrogersnt,

    Thank you for your post.

    '||' (or) conditions are not possible within the same set. You must place these in a different set in the Strategy Wizard. All conditions built in one set of the Strategy Wizard Conditions and Actions tab are set with '&&' (and).

    As these conditions are split by the '||' operator please refer to the two screenshots of these conditions in two sets.

    Please let me know if you have any questions.
    Attached Files

    Comment


      #3
      Thanks. I actually tried that but didn't split into separate sets. I appreciate your help.

      Comment


        #4
        Hi there,

        The solution above works for me on one hour bars (60 mins), but not on the 4 hour. (240 mins). For some reason I keep seeing deals in the backtest that should not have been done. Hope you can assist?
        Thx,

        Comment


          #5
          Hello Strooizout,

          Thank you for your post and welcome to the NinjaTrader Support Forum!

          Please provide what condition you are trying to build and what you are currently using that is not working.

          I look forward to your response.

          Comment


            #6
            Hello Patrick,

            Thx for your prompt reply.
            I am trying to build a strategy on a 4Hour bar that works during certain hours.
            Assume from 6 am to 20pm.

            Here's what I have, and what works on one hour strategies:

            if(_position ==0 && ToTime(Time[0]) > ToTime(6, 00, 0) && ToTime(Time[0]) < ToTime(20, 00, 0))
            As seen in this forum somewhere....

            Regards,

            Comment


              #7
              Hello Strooizout,

              Thank you for your response.

              Can you provide a screenshot of the trades on the backtest that should not have been made?

              What instrument are you testing? What Session Template are you using?

              Comment


                #8
                Morning Patrick.

                I test GBP USD
                In the attached screenshot you can see the outcome of a test on the 240 min period.
                Time set is ToTime(Time[0]) > ToTime(8, 00, 00) && ToTime(Time[0]) < ToTime(18, 00, 0)

                As you can see it trades from 16 to 20 hours, with even an occasional 15 o'clock trade.
                The session template is the "default 24/7" based on UTC -5 Eastern time.

                Thx,
                regards
                Attached Files

                Comment


                  #9
                  Hello Strooizout,

                  Thank you for your response.

                  May I review your code? You can attach the .cs file under (My) Documents\NinjaTrader 7\bin\Custom\Strategies to your response or send a note to platformsupport[at]ninjatrader[dot]com with this thread in the subject line and the file attached.

                  Thread: "http://www.ninjatrader.com/support/forum/showthread.php?t=60140"

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                  0 responses
                  590 views
                  0 likes
                  Last Post Geovanny Suaza  
                  Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                  0 responses
                  342 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by Mindset, 02-09-2026, 11:44 AM
                  0 responses
                  103 views
                  0 likes
                  Last Post Mindset
                  by Mindset
                   
                  Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                  0 responses
                  555 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by RFrosty, 01-28-2026, 06:49 PM
                  0 responses
                  552 views
                  1 like
                  Last Post RFrosty
                  by RFrosty
                   
                  Working...
                  X