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

The previous day's one-minute decision

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

    #46
    Thank you for your reply.

    I have added a time condition and applied it on the chart but nothing shows up.
    What am I doing wrong?​
    Attached Files

    Comment


      #47
      Hello ラリー,

      If noting is showing up this would be a good point to use Prints to see if the conditions are true or what is happening in the logic.

      I can say that you have only added 1 part of the time condition to each of the conditions. We had already covered this previously. If you wanted to check the prices once at a specific time you need a start time and an end time as a condition. In what you provided most recently you only have 1 time per condition meaning its not a span of time. You can see an example of creating a span of time in the help guide sample, the first sample shows using a start time and end time. https://ninjatrader.com/support/help...ightsub=totime

      JesseNinjaTrader Customer Service

      Comment


        #48
        Thank you for your reply.

        I would like to confirm that I may be confused, but am I correct that the latest screenshots I posted show lines 69, 79 and 84 as the ones that need to be corrected?​

        Comment


          #49
          Hello ラリー,

          Just 79 and 84 are the conditions which set the plot to -1 or 1. I didn't catch that when I looked yesterday, line 69 does not need to change from the original example. You have disabled the logic again by making other changes from what was posted in post Forum

          JesseNinjaTrader Customer Service

          Comment


            #50
            Thank you for your reply.

            So am I correct in understanding that I only need to modify lines 79 and 84 in the latest screenshot?​

            Comment


              #51
              Hello ラリー,

              Yes in addition to reverting back to what was shown in post 2, line 69 in the last image is not correct. you don't need to reset back to 0.
              JesseNinjaTrader Customer Service

              Comment


                #52
                Thank you for your reply.

                Yes in addition to reverting back to what was shown in post 2, line 69 in the last image is not correct. you don't need to reset back to 0.
                I have changed to the code you gave me in post 2.

                The last 69 lines are incorrect and you say it does not need to be reset to 0. Does 0 mean Time[0]?​
                Attached Files

                Comment


                  #53
                  Hello ラリー,

                  There seems to be a communication problem happening here. You have changed the wrong lines.

                  Please do the following:

                  Delete that script
                  Start a new indicator so it has had no changes
                  Copy the code from post 2 and paste it over the existing OnBarUpdate. It should look like the image that I had attached.
                  Edit lines 65 and 69 to have the time conditions that you wanted. You can find examples of creating a window of time here: https://ninjatrader.com/support/help...ightsub=totime


                  Click image for larger version

Name:	NinjaTrader_CleP3FbKhP.png
Views:	115
Size:	20.3 KB
ID:	1217344

                  JesseNinjaTrader Customer Service

                  Comment


                    #54
                    Thank you for your reply.

                    I copied and pasted the code in post 2.

                    I also edited lines 65 and 69 as shown in the attached image, applied it to the chart again and ran it, but the calculation was applied to all legs.
                    I only wanted to apply the calculation to the first leg of the session that started, what did I do wrong?​
                    Attached Files

                    Comment


                      #55
                      Hello ラリー,

                      It looks like you added only 1 time condition per condition, you need two time conditions to make a span of time.

                      If you look at the help guide sample it shows you how to use two time conditions to make a span of time which is what you need. You need to check between two times to know a certain time.

                      JesseNinjaTrader Customer Service

                      Comment


                        #56
                        Thank you for your reply.

                        I referred to the sample in the help guide, made the edits to the code as attached, and it seems I ended up with a different result than what I was expecting.

                        I am aware that the if(Close[0] < Open[0]) comparison on line 65 outputs a value of -1 if the closing price of the first leg is lower than the opening price of that leg, and the else if(Close[0] > Open[0]) on line 69 outputs a value of 1 if the closing price of the first leg is higher than the opening price. I expected the result to output a value of 1 if the close of the first leg was higher than the open, but the opposite value was output.
                        Why is this?​
                        Attached Files

                        Comment


                          #57
                          Hello ラリー,

                          You are using two different spans of time for the conditions so they happen at different points during the day. If you wanted to check if the bar is up or down for a certain time then both spans of time should be the same values so you are getting values from the same bar.
                          JesseNinjaTrader Customer Service

                          Comment


                            #58
                            Thank you for your reply.

                            I ran line 69 on the same time span as line 65, but as well, the first leg is showing as 1 on the data box.

                            I understand that the condition of the if statement in line 69 is that if the closing price of the first leg is higher than the opening price of that leg, then the number 1 should be displayed in My plot 2.
                            Am I correct in that understanding?
                            If so, I thought that the -1 value of the if statement condition in line 65 would be displayed in My plot 2 because the close of the 9:24 leg (the first leg of the close) is lower than the opening price of the first leg.​

                            Attached Files

                            Comment


                              #59
                              Hello ラリー,

                              I believe there is some confusion about the sample that I provided in post 2. If you go back to post 1 and your original question:

                              I would like to determine whether the first 1 minute leg of the previous day was positive or negativeI would like to determine whether the first 1 minute leg of the previous day was positive or negative
                              That is what the logic from post 2 is doing. By using 12:30 as the end time for the time condition the previous day's positive or negative plot would be based on the previous days 12:30 bar values. What you are pointing to in the image is the current day after what appears to be a session break. You would need to scroll back and find the 12:30 bar to check its Open and Close values because that is the time condition you created.

                              If you are trying to check for a specific time you don't need such a large span of time. You could use as small of a time as 1 minute intervals because you are using a 1 minute chart.


                              JesseNinjaTrader Customer Service

                              Comment


                                #60
                                Thank you for your reply.

                                My apologies.
                                There may have been a problem with the way I communicated this to you.

                                I would like to cover the 1 minute leg of the previous day's opening price when the first close occurs. For example, if the opening price occurs during the morning session, I would like to cover only the morning session, not the afternoon session, and if the opening price does not occur during the morning session but occurs during the afternoon session, I would like to cover the afternoon session. If the opening price did not occur during the morning session and the opening price occurred during the afternoon session, we want to include the afternoon session.​

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by Stanfillirenfro, Yesterday, 09:19 AM
                                7 responses
                                51 views
                                0 likes
                                Last Post NinjaTrader_Gaby  
                                Started by TraderCro, 04-12-2024, 11:36 AM
                                4 responses
                                70 views
                                0 likes
                                Last Post Mindset
                                by Mindset
                                 
                                Started by Mindset, Yesterday, 02:04 AM
                                1 response
                                15 views
                                0 likes
                                Last Post Mindset
                                by Mindset
                                 
                                Started by agclub, 04-21-2024, 08:57 PM
                                4 responses
                                18 views
                                0 likes
                                Last Post NinjaTrader_Gaby  
                                Started by Irukandji, Today, 04:58 AM
                                0 responses
                                6 views
                                0 likes
                                Last Post Irukandji  
                                Working...
                                X