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

    #61
    Hello ラリー,

    Right we went over that as well. That's why we were talking about using time conditions in the previous posts. If you need to find that time then adjust your time conditions to meet that criteria.

    The value that is plotted is the previous day value. The previous day value comes from finding the up or down value during the time condition and setting it as the current days value, on the following day that found up or down value is set to the previous days value and plotted. The current day value is reset so it can find the new value when the time comes. This repeats for each bar.

    Keep in mind that our support can only provide a direction for you such as the small example i originally provided in post 2. If you need to accommodate specific other requirements you will need to program those cases. The platform has tools for you to use to debug the script when you run it which is Print statements. You can use that to learn more about how certain logic works to better learn NinjaScript.
    JesseNinjaTrader Customer Service

    Comment


      #62
      Thank you for your reply.

      I have tried to see how the script I am currently creating (image here) works, and I am aware that if the if statement and the time condition are both true in the range from 9:00 to 15:00, the value of -1 or 1 for the run will be displayed, and if the plot has a When displayed in the plot, the leg painted orange (default color is red) is the leg with the first opening price of the day.
      We do not want anything else to appear in the plot.

      Also, when I hover the cursor over the orange color, the plot shows a -1, but I am thinking that this is not a -1 value calculated for the orange color, but that the value of the closing 3pm bar of the previous day has finished falling, so the orange color of the next day shows a -1 value. What do you think?
      Attached Files

      Comment


        #63
        Hello ラリー,

        From the image you changed the reset again so this will not work as it was from post Forum The Bars.IsFirstBarOfSession condition is required so that each new session the priorDayValue variable is reset to the new value that was found on the current day. By removing the condition completely the plot will switch between -1 and 1 like you pictured. If you want the reset at a different time than the normal session begin you could use a time condition in place of that but it needs to happen for only 1 bar. The time conditions you used already are for long periods of time which span many bars so you would need to use a more specific time for the reset.

        If you are having difficulty understanding NinjaScript or how to program we do suggest looking into third party developers or educators as an alternate to creating your own items.

        JesseNinjaTrader Customer Service

        Comment


          #64
          Thank you for your reply.

          From the image you changed the reset again so this will not work as it was from post Forum The Bars.IsFirstBarOfSession condition is required so that each new session the priorDayValue variable is reset to the new value that was found on the current day. By removing the condition completely the plot will switch between -1 and 1 like you pictured. If you want the reset at a different time than the normal session begin you could use a time condition in place of that but it needs to happen for only 1 bar. The time conditions you used already are for long periods of time which span many bars so you would need to use a more specific time for the reset.
          Bars.IsFirstBarOfSession, but in the case of Japanese stocks, there are two sessions, so I want only the bars of the first session to be included in the calculation, but is it difficult to use Bars.IsFirstBarOfSession alone without time conditions?

          I apologize for the trouble I have caused you due to my poor explanation.
          I created this script for the purpose of explanation.
          In the output of NinjaScript OutPut, the first trading session of each date and time is output, and I would like to judge whether the bar of the first trading session is rising or falling.​
          Attached Files

          Comment


            #65
            Hello ラリー,

            Bars.IsFirstBarOfSession, but in the case of Japanese stocks, there are two sessions, so I want only the bars of the first session to be included in the calculation, but is it difficult to use Bars.IsFirstBarOfSession alone without time conditions?

            We had covered this earlier in this thread. If you need to use something other than the IsFirstBarOfSession you need to make a time condition for that. You can replace Bars.IsFirstBarOfSession for a time condition which targets the specific time you needed.

            In the output of NinjaScript OutPut, the first trading session of each date and time is output, and I would like to judge whether the bar of the first trading session is rising or falling.​

            If that is not the IsFirstBarOfSession then you would need to make a time condition which finds that bar and use that with the conditions checking if Close is greater than Open or if Close is less than Open.

            JesseNinjaTrader Customer Service

            Comment


              #66
              Thank you for your reply.

              We had covered this earlier in this thread. If you need to use something other than the IsFirstBarOfSession you need to make a time condition for that. You can replace Bars.IsFirstBarOfSession for a time condition which targets the specific time you needed.
              Not Bars.IsFirstBarOfSession.
              I asked if there is a way to use only Bars.IsFirstBarOfSession.

              I apologize for the inconvenience, but could you please provide a screenshot of the complete code or even a sample of the complete NinjaScript file so that we can study it in the future?
              Last edited by ラリー; 10-06-2022, 01:54 AM.

              Comment


                #67
                Hello ラリー,

                Not Bars.IsFirstBarOfSession.
                I asked if there is a way to use only Bars.IsFirstBarOfSession.

                We had covered this previously, if the property is not true at the time that you wanted then you would need to make a time condition instead. IsFirstBarOfSession represents the trading hours start of session. The time you wanted to use was a different time as you mentioned after I had made that first sample so it would not make sense to use IsFirstBarOfSession in that use case.

                I apologize for the inconvenience, but could you please provide a screenshot of the complete code or even a sample of the complete NinjaScript file so that we can study it in the future?

                I would not be able to provide a screenshot of the code because that would be up to you to make it from this point, I have not made any of the changes that you need for the custom instrument. We have covered in detail what would be needed to make the changes that you asked about at later dates.

                The sample that I provided was a generic starting point based on the description you gave in post 1, you mentioned the previous day as a requirement and nearly all instruments have a specific session open and close time. That means for most instruments you can use IsFirstBarOfSession to know when a new session started and that is why I included that in the sample.

                You have since added other requirements which we have gone over in the past posts. If you need to change how that original sample works to meet your actual needs that is fine, you can do that. The changes that you have been providing in the follow up posts have not been correct or provide the wrong results because you had not accurately used what the original sample was provided to teach. That sample shows how to plot a value from the previous day and resets for the current day based on the session. You can change how it works by adding time conditions if you needed to support an instrument at a different time rather than its IsFirstBarOfSession bar. The reset condition still needs to only happen for 1 bar when you want the session to reset.




                JesseNinjaTrader Customer Service

                Comment


                  #68
                  Thank you for your reply.

                  I will again review what you supported on this matter from your first post.
                  I hope to be able to ask you again after I have learned a little more about it, and I would appreciate your support again in that case.​

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Gerik, Today, 09:40 AM
                  1 response
                  5 views
                  0 likes
                  Last Post NinjaTrader_Gaby  
                  Started by RookieTrader, Today, 09:37 AM
                  1 response
                  10 views
                  0 likes
                  Last Post NinjaTrader_ChelseaB  
                  Started by alifarahani, Today, 09:40 AM
                  0 responses
                  5 views
                  0 likes
                  Last Post alifarahani  
                  Started by KennyK, 05-29-2017, 02:02 AM
                  3 responses
                  1,284 views
                  0 likes
                  Last Post NinjaTrader_Clayton  
                  Started by AttiM, 02-14-2024, 05:20 PM
                  11 responses
                  185 views
                  0 likes
                  Last Post NinjaTrader_ChelseaB  
                  Working...
                  X