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

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

      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 zstheorist, Today, 07:52 PM
              0 responses
              6 views
              0 likes
              Last Post zstheorist  
              Started by pmachiraju, 11-01-2023, 04:46 AM
              8 responses
              150 views
              0 likes
              Last Post rehmans
              by rehmans
               
              Started by mattbsea, Today, 05:44 PM
              0 responses
              6 views
              0 likes
              Last Post mattbsea  
              Started by RideMe, 04-07-2024, 04:54 PM
              6 responses
              33 views
              0 likes
              Last Post RideMe
              by RideMe
               
              Started by tkaboris, Today, 05:13 PM
              0 responses
              6 views
              0 likes
              Last Post tkaboris  
              Working...
              X