Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Start/End of day plot

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

    #16
    I just want to ask about the time filter. I have set a strategy to starts at 8:30 am and ends at 2:15pm and the other strategy is being set to starts at 8:30am also but it will ends at 3:30 pm. Now, I am just confused because when strategy 1 shuts off at 2:15pm and what will happen is that the strategy 2 will also shuts off at 2:15 while I have set it to shut off at 3:30. Any idea on this? Thanks in advance.

    Comment


      #17
      luxurious_04, what methods are you using to 'shut' the strategies off then? Custom code inside the strategy OnBarUpdate()? This would only be used for the individual strategy instance then and should not influence another running strategy.

      Comment


        #18
        I placed the code like this:

        if(Time[0] >= startTime)
        {
        Print("do something");
        }
        else if(Time[0] <= endTime )
        {
        print("-------------------------------------------");
        print("strategy 1");
        print("time:" +Time[0]);
        print("-------------------------------------------");
        return;
        }

        that is inside in the onbarupdate() and the strategy 2 is also the same code.

        if(Time[0] >= startTime)
        {
        Print("do something");
        }
        else if(Time[0] <= endTime )
        {
        print("-------------------------------------------");
        print("strategy 2");
        print("time:" +Time[0]);
        print("-------------------------------------------");
        return;
        }

        Comment


          #19
          Hello,

          I'm not sure if that code alone will completely filter for the trading times you had set. I'd suggest putting the conditions that the strategy is running in side a time filter/wrapper so that these conditions are only true between your start time and end time.

          For an example of this, please see our SampleTimeFilter reference:

          MatthewNinjaTrader Product Management

          Comment


            #20
            Hello I just want to know the overall function of Disable(); code. If I have two strategies running or enabled and my 1st strategy have the Disable(); code at 2:15 pm. Does the Disable(); code will disable all my enabled strategies at 2:15 pm? Or it will only disable the 1st strategy which have the Disable(); code.

            Comment


              #21
              Hello luxurious_04,

              Disable() is not a supported method. If you plan to use, will have to test thoroughly on your end.

              We do have a sample available on halting strategy after definable conditions for best practice here:
              Ryan M.NinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Hwop38, 05-04-2026, 07:02 PM
              0 responses
              181 views
              0 likes
              Last Post Hwop38
              by Hwop38
               
              Started by CaptainJack, 04-24-2026, 11:07 PM
              0 responses
              334 views
              0 likes
              Last Post CaptainJack  
              Started by Mindset, 04-21-2026, 06:46 AM
              0 responses
              258 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Started by M4ndoo, 04-20-2026, 05:21 PM
              0 responses
              358 views
              0 likes
              Last Post M4ndoo
              by M4ndoo
               
              Started by M4ndoo, 04-19-2026, 05:54 PM
              0 responses
              187 views
              0 likes
              Last Post M4ndoo
              by M4ndoo
               
              Working...
              X