Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

About Net change

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

    #16
    Hello ラリー,

    As a heads up, you cannot copy and paste code from a screenshot.

    Copy and pasting the few lines of code or sharing an exported script allows the receiver to use the code.

    To export a NinjaTrader 8 NinjaScript so this can be shared and imported by the recipient do the following:
    1. Click Tools -> Export -> NinjaScript...
    2. Click the 'add' link -> check the box(es) for the script(s) and reference(s) you want to include
    3. Click the 'Export' button
    4. Enter a unique name for the file in the value for 'File name:'
    5. Choose a save location -> click Save
    6. Click OK to clear the export location message
    By default your exported file will be in the following location:
    • (My) Documents/NinjaTrader 8/bin/Custom/ExportNinjaScript/<export_file_name.zip>
    Below is a link to the help guide on Exporting NinjaScripts.
    http://ninjatrader.com/support/helpG...-us/export.htm


    However, as you have specifically asked for a screenshot I have provided one.

    Attached Files
    Chelsea B.NinjaTrader Customer Service

    Comment


      #17
      Thank you for your reply.
      It is very helpful that you sent us the screenshots.​

      When I added the code shown on line 68 of the attached screenshot, I got the error message ""System.DateTime does not have a constructor that allows 5 arguments to be specified".
      How can I resolve this?

      Also attached is the ninja script file.
      Attached Files

      Comment


        #18
        Hello ラリー,

        The script you have provided is an assembly dll, meaning you have checked the 'Export as assembly' checkbox (which is not in the instructions in post #16).

        The code of a closed source assembly cannot be viewed or opened in the NinjaScript Editor, but the script can be run.

        What is the specific line of code causing the error?


        In the example I have provided you a hard coded new DateTime object is created. However, your logic would be setting the date and time to whatever you wanted to calculate, such as " one hour (8:00) before the market starts the next day after the Tokyo Stock Market closes that day"

        If you are needing to know the session start time this can be found with a sessionIterator.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #19
          Thank you for your reply.
          We apologize for any inadequacies.​

          What is the specific line of code causing the error?
          The error is on line 71.
          Also attached are screenshots and the ZiP file again.

          In the example I have provided you a hard coded new DateTime object is created. However, your logic would be setting the date and time to whatever you wanted to calculate, such as " one hour (8:00) before the market starts the next day after the Tokyo Stock Market closes that day"

          If you are needing to know the session start time this can be found with a sessionIterator.
          https://ninjatrader.com/support/help...oniterator.htm
          Thank you.
          The link you sent me has several more links, including the start of a performance session and the end of a performance session, but which one is appropriate for the question I have asked you this time?​​
          Attached Files

          Comment


            #20
            Hello ラリー,

            Currently, I was only demonstrating how a variable works. The actual date time value you assign is up to you.
            For this the links on the sessionIterator is not related.

            That said, I left some mistakes in the screenshot.


            Should you want to retrieve a time in historical data, and not just in real-time, this actually would need to be in OnBarUpdate() where historical data is processed.

            Should you want to calculate a custom time, added or subtracted from the session start time, a sessionIterator would be necessary.
            Attached Files
            Chelsea B.NinjaTrader Customer Service

            Comment


              #21
              Thank you for your reply.

              I have tried to add the ZiP file you sent me to the market analyzer, but nothing seems to be displayed.

              I also tried to add it to the chart, but the
              Net change display is there, but I could not find MyNetChange and could not add it.​

              Does this mean that I need some additional code in NinjaScript?
              Attached Files
              Last edited by ラリー; 09-22-2022, 04:16 AM.

              Comment


                #22
                Hello ラリー,

                The column needs to add at least 3 days of data to ensure that the price at 090000 is found.

                Set 'Load data based on' to Days, and set Days back to 3 or higher.

                Below is a link to a video of testing the script.


                Keep in mind this is for educational purposes only as I our policy does not allow me to write code for you. You will need to code the script to your needs.
                Chelsea B.NinjaTrader Customer Service

                Comment


                  #23
                  Thank you for your reply.

                  I have watched your video.
                  When I imported MyNetChange_Modified in my environment, it imported successfully and I was able to add it to the market analyzer.
                  However, the values are not displayed.
                  Why is this?​
                  Attached Files

                  Comment


                    #24
                    Hello ラリー,

                    Please be sure you have:
                    • The correct CalculationMode selected,
                    • That there are several days of data loaded,
                    • That you are currently seeing realtime data on that symbol,
                    • That you have historical bar data for that symbol (Can you open a chart?)
                    • Also make sure that the Data Series used is set to a time frame that will update myLastClosePrice
                    If you are still stuck, could you share screenshot if the MAColumn settings, as well as a chart showing you have the historical bar data?
                    JimNinjaTrader Customer Service

                    Comment


                      #25
                      Thank you for your reply.

                      • The correct CalculationMode selected,
                      • That there are several days of data loaded,
                      • That you are currently seeing realtime data on that symbol,
                      • That you have historical bar data for that symbol (Can you open a chart?)
                      • Also make sure that the Data Series used is set to a time frame that will update myLastClosePrice

                      ​As you can see in the attached image, the number of days the data was loaded and also
                      It seems to be able to open the chart.
                      I also added the AUDUSD symbol and it seems to be displaying the values.
                      However, the Japanese market was closed yesterday for a holiday.
                      Is there any influence from that?​
                      Attached Files

                      Comment


                        #26
                        Hello ラリー,

                        The script I provided was just an example, which pulls the price at the time of 9 am.

                        Having enough data would have an influence.

                        Use prints to debug and understand the issue.


                        Is there a value printing at 090000?

                        Chelsea B.NinjaTrader Customer Service

                        Comment


                          #27
                          Thank you for your reply.

                          I have added the print to NinjaScript and run it, but nothing is showing up in NinjaScript Output.
                          Is the print I added to my NinjaScript correct?​
                          Attached Files

                          Comment


                            #28
                            Hello ラリー,

                            No, you would want to print in OnBarUpdate() below where myLastClosePrice is being assigned a value.
                            Chelsea B.NinjaTrader Customer Service

                            Comment


                              #29
                              Thank you for your reply.

                              I changed it to Print(myLastClosePrice); instead and ran it, but print (NinjaScript OutPut) nothing is showing up, am I wrong?​
                              Attached Files

                              Comment


                                #30
                                Hello ラリー,

                                Because that part of the switch is not evaluating as true.

                                Why is this code in the switch? I have advised you in post Indicator Development to print this value after it set in OnBarUpdate().
                                Chelsea B.NinjaTrader Customer Service

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by trilliantrader, 04-18-2024, 08:16 AM
                                4 responses
                                18 views
                                0 likes
                                Last Post trilliantrader  
                                Started by mgco4you, Today, 09:46 PM
                                1 response
                                10 views
                                0 likes
                                Last Post NinjaTrader_Manfred  
                                Started by wzgy0920, Today, 09:53 PM
                                0 responses
                                10 views
                                0 likes
                                Last Post wzgy0920  
                                Started by Rapine Heihei, Today, 08:19 PM
                                1 response
                                10 views
                                0 likes
                                Last Post NinjaTrader_Manfred  
                                Started by Rapine Heihei, Today, 08:25 PM
                                0 responses
                                10 views
                                0 likes
                                Last Post Rapine Heihei  
                                Working...
                                X