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

Setting up several different trading times.

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

    Setting up several different trading times.

    SO what im looking to do is use 1 strategy with different profit loss setups depending on the time of day. Example I have one set during day trading hours works well. I can not get a setup to work over night will not work in back testing either. Anyone seen were i have to add some other variable or maybe days of the week for this certain over night setup?
    I have even made a new script using only the over nite hours and it will still not trade anything.

    #2
    Hello Chryslertech,

    Is the instrument in question in the trading session overnight? If the script is not in a trading session then it won't be able to perform logic during that time, you need to have new bars being generated to drive the logic.

    If you are using an instrument that trades overnight and is in a session then I would also need to know what you tried to get a better idea of what may not be working.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Its ES so yes I have run a single script for many months day and night I just want to have different P/L for day and night and only way I could see to do that would be to have 2 scripts running at different time frames with out overlap.

      Comment


        #4
        Hello Chryslertech,

        In that case we would need more specific details on what you had tried that did not work. If you are trying to make a timespan that crosses midnight you would need to make two seperate time windows, one with a start time before midnight and ending at midnight and a second with a start time of midnight and the end time you wanted.



        JesseNinjaTrader Customer Service

        Comment


          #5
          have tried doing variables doing time from 405 to 1159 pm tried doing one from 405 pm to 929 am both will not run back test .
          Attached Files

          Comment


            #6
            Hello Chryslertech,

            That condition wont work, you are checking if the current time of day is equal to the start time and also equal to the end time. It won't be equal to both times ever. A time condition needs to check if the time is greater equal to the start time or less that or equal to the end time.

            JesseNinjaTrader Customer Service

            Comment


              #7
              awesome let me try that

              Comment


                #8
                That was it That's odd I set it up the same way with just the day time one im guessing that having separate time spots the grater equal is needed so its not over lapping the others.

                Comment


                  #9
                  applied that logic changed the times frames to 405pm to 925 am and same issue is it because it went to a different day? and am pm switch ?

                  Comment


                    #10
                    Hello Chryslertech,

                    Yes if you cross midnight you need to make two separate conditions. You would have to do 405pm to 11:59 pm and then another time window from 12am to 9:25 am. Time conditions need to be a window within the same day.

                    In the builder this would be a good use case for making two group conditions. In your sett add a first group and select if all as the comparison, then add the conditions if the time is greater equal to 4:05pm and less equal to 11:59 pm. In a second group condition select if all as the comparison and check if the time is greater equal to 12am and lesser equal to 9:25am. In the main set you would select if any as the comparison so that if either group becomes true the set is true.
                    JesseNinjaTrader Customer Service

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by LiamTwine, Today, 08:10 AM
                    0 responses
                    2 views
                    0 likes
                    Last Post LiamTwine  
                    Started by Balage0922, Today, 07:38 AM
                    0 responses
                    5 views
                    0 likes
                    Last Post Balage0922  
                    Started by JoMoon2024, Today, 06:56 AM
                    0 responses
                    6 views
                    0 likes
                    Last Post JoMoon2024  
                    Started by Haiasi, 04-25-2024, 06:53 PM
                    2 responses
                    19 views
                    0 likes
                    Last Post Massinisa  
                    Started by Creamers, Today, 05:32 AM
                    0 responses
                    6 views
                    0 likes
                    Last Post Creamers  
                    Working...
                    X