Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

"Don't Trade" Periods

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

    "Don't Trade" Periods

    Hi there,

    Is there an option in the strategy setup to "not trade"?
    For example, in my strategy I don't want to trade during 20:00 and 06:30.
    Please let me know how I can program this in.

    Thx,

    Z

    #2
    Originally posted by Zhorny View Post
    Hi there,

    Is there an option in the strategy setup to "not trade"?
    For example, in my strategy I don't want to trade during 20:00 and 06:30.
    Please let me know how I can program this in.

    Thx,

    Z
    Hi Zhorny,

    You mean something like ToTime()?

    Regards,

    Comment


      #3
      Possibly yes. Does this mean you're strategy will only trade between certain times?
      How can I access this in the GUI Strategy drop down menus?

      Comment


        #4
        Unfortunately you could not access those directly, a time filter example is shown here -

        Comment


          #5
          Great thanks.

          I've installed it and it comes up with the SampleTimeFilter example under the "edit ninjascript" > "strategy" menu but how can I implement it?

          Do I have to hard code it in or can I access it via the GUI?

          Comment


            #6
            This would be an example how to hardcode the start / end times in, but you can replace the times set with user inputs of DateTime for example.

            Or in the wizard those rules can also be setup without any programming -

            Comment


              #7
              Thanks Bertand. Is it something like this (see below)?
              Example, flatten position after 1900 and before 0630 (although I tried it and it didn't seem to work).

              Comment


                #8
                You're welcome, this will not work, as you do not have any action specified, only conditions that would trigger the below listed action...which is empty here in your case.

                Comment


                  #9
                  Hmmm ok. I read the website you sent me to and I understand it (or so I think) but still stuck on how I would want to limit trading sessions.
                  You mentioned DateTime - how can I get around programming specifics in?

                  Comment


                    #10
                    Here's a simple example to demonstrate, it would go long only if flat and if the bar time in in the cash hours from 9:30 to 16:00...and then exit at the close as defined by the session template used.
                    Attached Files

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by cmoran13, Yesterday, 01:02 PM
                    0 responses
                    29 views
                    0 likes
                    Last Post cmoran13  
                    Started by PaulMohn, 04-10-2026, 11:11 AM
                    0 responses
                    21 views
                    0 likes
                    Last Post PaulMohn  
                    Started by CarlTrading, 03-31-2026, 09:41 PM
                    1 response
                    160 views
                    1 like
                    Last Post NinjaTrader_ChelseaB  
                    Started by CarlTrading, 04-01-2026, 02:41 AM
                    0 responses
                    95 views
                    1 like
                    Last Post CarlTrading  
                    Started by CaptainJack, 03-31-2026, 11:44 PM
                    0 responses
                    148 views
                    2 likes
                    Last Post CaptainJack  
                    Working...
                    X