Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

The previous day's one-minute decision

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

    #16
    Thank you for your reply.

    To have the reset happen at a specific time you would need to change the
    You say I need to change the following code.
    Also did I make a mistake in the changes I attached at the end on lines 64 and 68?

    The other conditions to set the value up or down would still need to be changed to whatever works for the bars type you used. I provided an example of what that would look like on a 1 minute series but that uses IsFirstBarOfSession as well. You could use time conditions there as well but you also need the conditions checking if the price is up or down like it was originally.
    I would like to use 1 min.
    And how can I do the condition to check if the price is going up or down?


    We apologize for the inconvenience and thank you in advance for your cooperation.

    Comment


      #17
      Hello ラリー,

      Also did I make a mistake in the changes I attached at the end on lines 64 and 68?
      Yes that is what I had commented on. You are only checking times but not if it was up or down.

      And how can I do the condition to check if the price is going up or down?
      I had shown this in the original sample using the Close greater or lesser than Open conditions. The 1 or -1 is used to tell what direction the price was. In your edit both conditions are identical so it will always evaluate the same at that time.

      Comment


        #18
        Thank you for your reply.

        I have changed the code again (attached) so that only the first leg of the morning session is included in the calculation, but the plot does not show -1 or 1, it only shows 0, which does not work.

        Also, if the symbol starts at 9:00, it is fine, but if it is a buy quote, it may come in after 9:01, in which case only n/a appears in the plot.
        Attached Files
        Last edited by ラリー; 09-01-2022, 03:47 AM.

        Comment


          #19
          Hello ラリー,

          The code you pictured has heavily deviated from the described concept, there are now multiple problems.

          line 60 needs to remain the same, you do not need to change how that value is set. The purpose of how this works is by setting the current day to the previous days value so that the previous days value is plotted.

          You need to always set a value to the plot so the analyzer can use it, the condition on line 62 needs to be removed.

          The condition on line 65 and 69 is not checking a time so that is going to reset the value for every bar.

          The line 75 is not doing anything so it should be removed. As a side note about this line you also used a semi colon at the end of the if statement which in C# terminates the if statement:

          Here is an example of an invalid if condition
          Code:
          if(someCondition)[B];[/B]
          {
             // code wont be executed, you have a semi colon on the if statement meaning its terminated. 
          }

          Comment


            #20
            Thank you for your reply.

            I will try to sort out what you have told me and make various attempts and will contact you again as soon as I make progress.
            Thank you in advance.

            Comment


              #21
              We become indebted to. I have been in touch with you about the progress. It seems that only the first bar (9 o'clock) session of the front field was calculated and displayed on the plot. However, if there is a bias in buy orders or sell orders, it may not start at 9 o'clock. How can I calculate only the opening bar and not include the late session and show it in the plot?
              Attached Files
              Last edited by ラリー; 09-02-2022, 10:32 PM.

              Comment


                #22
                Hello ラリー,

                I am not certain I understand the question. If the first bar of the session you want is 9 oclock then you would need to add conditions to check for that specific time.

                However, if there is a bias in buy orders or sell orders, it may not start at 9 o'clock
                The session would still start at a specific time, are you asking what to do if there was no price movement at that time?

                The image you provided of the code is lacking time conditions on lines 65 and 70, that means that code will be executed for every bar through the entire session. You would be plotting the value from the very last bar before the 9am condition and not the 9oclock condition.

                The opening brace { on line 59 and the closing brace } on line 61 also need to be removed. NinjaScript is C# language so learning C# outside of NinjaTrader will greatly help with structure items like this.



                Comment


                  #23
                  Thank you for your reply.

                  The session would still start at a specific time, are you asking what to do if there was no price movement at that time?
                  I apologize for not explaining it better.
                  Yes, if an individual issue normally starts at 9:00 but is in a special buy quote or special sell quote, it will not start at exactly 9:00, which means that we only want to include in the calculation the session in which the first trade started.

                  Comment


                    #24
                    Hello ラリー,

                    If you wanted to start at a later time you need to make time conditions for that. The platform won't denote a later time as the start of the session if the actual session started at 9. You would have to determine what time you want data from and make your conditions reflect that.

                    Comment


                      #25
                      Thank you for your reply.

                      If you wanted to start at a later time you need to make time conditions for that. The platform won't denote a later time as the start of the session if the actual session started at 9. You would have to determine what time you want data from and make your conditions reflect that.
                      I understand that I need to create a time condition if I want to include a session with a later start time.
                      How can I do this?

                      Thank you in advance for your time.

                      Comment


                        #26
                        Hello ラリー,

                        In post 18 you provided an image of your code where it has time conditions. That would be how to define time conditions. As part of the conditions checking the price you would need to add a condition for the start and end time you wanted to check. Then if the time falls on or between those times the condition would be able to be checked.



                        Comment


                          #27
                          Click image for larger version

Name:	2022-09-08  Result after applying the chart after code modification.jpg
Views:	203
Size:	137.2 KB
ID:	1214794Click image for larger version

Name:	2022-09-08  Previous day 1-minute decision script (code modification).jpg
Views:	179
Size:	193.0 KB
ID:	1214795 I tried adding a time condition.
                          The calculation is applied to all one-minute sessions at the specified time, but it doesn't work.

                          ♯The code you posted in Forum would have been closer to what I wanted to do with the results of Forum except for including the afternoon session.

                          Is it possible to use if(Bars.IsFirstBarOfSession) to calculate only the first session started?
                          Last edited by NinjaTrader_Jesse; 09-14-2022, 07:08 AM.

                          Comment


                            #28
                            Thank you for your help.

                            If you have responded to my post, I would appreciate it if you could send it to me again, as I seem to be having some problems with my e-mails, notifications (not getting notifications, etc.) and other issues since the maintenance (NinjaTreder).​

                            Comment


                              #29
                              Hello ラリー,

                              We had previously covered this, you are putting the time conditions in the wrong place.. You need the time conditions where you want to determine if the price is up or down. In your newest image that is lines 75 and 80. The remainder of the logic should look like it did in post 2. If you are having trouble understanding the sample that was provided in post 2 I would suggest to use prints to better understand how that logic is working while the script processes. ​

                              Comment


                                #30
                                Thank you for your reply.

                                The remainder of the logic should look like it did in post 2. If you are having trouble understanding the sample that was provided in post 2 I would suggest to use prints to better understand how that logic is working while the script processes. ​
                                I would like to use print, is that done from Ninjascript? Or is it done from the control tool?

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                                0 responses
                                650 views
                                0 likes
                                Last Post Geovanny Suaza  
                                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                                0 responses
                                370 views
                                1 like
                                Last Post Geovanny Suaza  
                                Started by Mindset, 02-09-2026, 11:44 AM
                                0 responses
                                109 views
                                0 likes
                                Last Post Mindset
                                by Mindset
                                 
                                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                                0 responses
                                574 views
                                1 like
                                Last Post Geovanny Suaza  
                                Started by RFrosty, 01-28-2026, 06:49 PM
                                0 responses
                                577 views
                                1 like
                                Last Post RFrosty
                                by RFrosty
                                 
                                Working...
                                X