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

Sentiment As an Indicator

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

    #46
    Originally posted by randl View Post
    what does it mean "you fed it with a DataSeries."? Is that a region? if so where is it?
    Sorry, I do not understand your question.

    You had a Set() statement. That requires a double as a parameter. Instead of providing it with a double, you gave it a DataSeries. How does the matter of regions come in?

    A DataSeries is a structure that holds indexed double values. You access those double values by specifying the relevant index. If you do not specify an index, you are referring to the DataSeries, instead of any of its members. Compare the statement that you had, and the corrected statement, as I wrote it. You should be able to see the difference by reference to the syntax that is detailed in the NT Help.

    Comment


      #47
      Sentiment as an Indicator

      Thank you for all the help.

      I have attached a text file with the latest code. The script compiles, however, nothing plots at this time and it yields error messages in the log. I also printed the log messages at the bottom of the attached file.

      11/11/2013 2:49 AM Default Error on calling 'OnBarUpdate' method for indicator 'MarketThrust' on bar 3: Index was outside the bounds of the array.
      11/11/2013 2:49 AM Default Error on calling 'OnBarUpdate' method for indicator 'MarketThrust' on bar 3: Index was outside the bounds of the array.
      11/11/2013 2:47 AM Default Error on calling 'OnBarUpdate' method for indicator 'MarketThrust': Index was outside the bounds of the array.
      11/11/2013 2:47 AM Default Error on calling 'OnBarUpdate' method for indicator 'MarketThrust' on bar 3: Index was outside the bounds of the array.
      Attached Files

      Comment


        #48
        Randl,

        These logs indicate that you have indexed values being called outside of the range. I would suggest re-working your current bars check. This is something that will need to be debugged and worked through.

        Ensure you are loading enough data from the chart and that your index values are correct as well.
        Cal H.NinjaTrader Customer Service

        Comment


          #49
          Originally posted by randl View Post
          Thank you for all the help.

          I have attached a text file with the latest code. The script compiles, however, nothing plots at this time and it yields error messages in the log. I also printed the log messages at the bottom of the attached file.

          11/11/2013 2:49 AM Default Error on calling 'OnBarUpdate' method for indicator 'MarketThrust' on bar 3: Index was outside the bounds of the array.
          11/11/2013 2:49 AM Default Error on calling 'OnBarUpdate' method for indicator 'MarketThrust' on bar 3: Index was outside the bounds of the array.
          11/11/2013 2:47 AM Default Error on calling 'OnBarUpdate' method for indicator 'MarketThrust': Index was outside the bounds of the array.
          11/11/2013 2:47 AM Default Error on calling 'OnBarUpdate' method for indicator 'MarketThrust' on bar 3: Index was outside the bounds of the array.
          I would suggest that you need to go through the tutorials in the NT Help, so that you understand the structure of the classes and the purpose of the various constructs.

          Looking at your code, little ties together. In this particular case, you have declared only one Plot, yet in the properties, you are defining access for 2 Plots.

          Comment


            #50
            I've got bigger problems than no plotting the avg line.

            Comment


              #51
              Originally posted by randl View Post
              I've got bigger problems than no plotting the avg line.
              Actually, no. The ONLY reason for that error is that you never declared a second plot, and you are trying to access a second plot with Values[1]. That index is out of bounds of the Values array because you never declared it. As you declared only one plot, the Values array holds only one value, Values[0].

              Your entire code reads like you are throwing statements up, hoping to see it do what you want. You are going to have to understand what statements mean, and how they come together. That will not come from asking highly specific questions, and then not being able to translate the answers because you do not understand the framework of those constructs.

              If you really want to write your own code, I still suggest that you go through the tutorials, and understand how to construct the code. Otherwise, it may save you time to pay someone else to write your code for you. (For the avoidance of doubt, I am not talking about me. )

              Comment


                #52
                Koganam, Thanks for the feedback. I am in the process of doing that. I bought the Ninja introduction to scripting. I am in the process of watching them. As far as how my code looks, I am afraid that this won't change, I am trying to move into Ninja stuff that I operate with, while learning.

                I have learned from all the help I have gotten so far, it has not been wasted.
                Please do not feel obligated to tell me what to do.
                If nobody responds, I will figure out what to do on my own... it will just take me longer and I don't mind.
                As I said, Thanks for the feedback.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by CortexZenUSA, Today, 12:53 AM
                0 responses
                1 view
                0 likes
                Last Post CortexZenUSA  
                Started by CortexZenUSA, Today, 12:46 AM
                0 responses
                1 view
                0 likes
                Last Post CortexZenUSA  
                Started by usazencortex, Today, 12:43 AM
                0 responses
                5 views
                0 likes
                Last Post usazencortex  
                Started by sidlercom80, 10-28-2023, 08:49 AM
                168 responses
                2,265 views
                0 likes
                Last Post sidlercom80  
                Started by Barry Milan, Yesterday, 10:35 PM
                3 responses
                11 views
                0 likes
                Last Post NinjaTrader_Manfred  
                Working...
                X