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

Add new plot to existing indicator

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

    Add new plot to existing indicator

    I want to add a plot for the high and low for the following indicator. I tried using Values[0].Set array as suggested on another site, but when the indicator is loaded it does not display anything. It looks like the indicator is trying to load, but disappears very quickly.

    Any help on how to add a plot for the high and low for the attached indicator will be appreciated.
    Attached Files

    #2
    I tried creating a data series for the high and low plots (see attachment) and nothing displays. Obviously, I am doing something wrong, please help. I am a newbie at coding so this is probably a very simple problem, but I am out of ideas to try.
    Attached Files

    Comment


      #3
      I fixed the disappearing plots issue by do as NinjaTrader_ZacharyG suggested in the following thread: http://ninjatrader.com/support/forum...81&postcount=7

      Originally posted by NinjaTrader_ZacharyG View Post
      Hello TzunTzai,

      Upon further investigation, it looks like the error was occurring within the Plot() override method's for loop that's looping over the seriesCount.

      There wasn't enough brushes within the brushes collection. You will need to add additional brushes within the brushes collection within the Variables region.

      More about the "index was outside the bounds of the array" error can be found at this DotNetPetls link: http://www.dotnetperls.com/indexoutofrangeexception


      Now I repeatedly get the following error messages as they appear in the Log tab of the Control Center. How do I fix these errors? Attached is the new version with the additional brushes.

      Failed to set property 'Open' for indicator '': Object of type 'NinjaTrader.Indicator.DataSeriesHelper' cannot be converted to type 'System.Double'.

      Failed to set property 'Low' for indicator '': Object of type 'NinjaTrader.Indicator.DataSeriesHelper' cannot be converted to type 'System.Double'.

      Failed to set property 'High' for indicator '': Object of type 'NinjaTrader.Indicator.DataSeriesHelper' cannot be converted to type 'System.Double'.
      Attached Files

      Comment


        #4
        Originally posted by ActiveTrader09 View Post
        I fixed the disappearing plots issue by do as NinjaTrader_ZacharyG suggested in the following thread: http://ninjatrader.com/support/forum...81&postcount=7





        Now I repeatedly get the following error messages as they appear in the Log tab of the Control Center. How do I fix these errors? Attached is the new version with the additional brushes.

        Failed to set property 'Open' for indicator '': Object of type 'NinjaTrader.Indicator.DataSeriesHelper' cannot be converted to type 'System.Double'.

        Failed to set property 'Low' for indicator '': Object of type 'NinjaTrader.Indicator.DataSeriesHelper' cannot be converted to type 'System.Double'.

        Failed to set property 'High' for indicator '': Object of type 'NinjaTrader.Indicator.DataSeriesHelper' cannot be converted to type 'System.Double'.
        I fixed the failed to set property for indicator errors.

        Now I am trying to use drawtext for the plot labels.

        I get the following error message in the Log tab of the Control Center when using drawtext in the attached code.

        Error on calling 'OnBarUpdate' method for indicator 'FloorPivotsWeeklyV5' on bar 0: Index was outside the bounds of the array.

        How do I fix this error?
        Attached Files

        Comment


          #5
          Hello ActiveTrader09,

          Thank you for your patience.

          If you comment out the if (midpoint) section of your code the error does not return. I would recommend printing the values of the doubles you are setting in if (midpoint).

          For information on debugging your code please visit the following link:http://ninjatrader.com/support/forum...ead.php?t=3418

          Comment


            #6
            Originally posted by NinjaTrader_PatrickH View Post
            Hello ActiveTrader09,

            Thank you for your patience.

            If you comment out the if (midpoint) section of your code the error does not return. I would recommend printing the values of the doubles you are setting in if (midpoint).

            For information on debugging your code please visit the following link:http://ninjatrader.com/support/forum...ead.php?t=3418
            I placed the // before if(midpoint) and compiled. When I load the indicator I get the same error message. l would do the print command I do not understand how to implement it with my code.

            Comment


              #7
              Originally posted by ActiveTrader09 View Post
              I placed the // before if(midpoint) and compiled. When I load the indicator I get the same error message. l would do the print command I do not understand how to implement it with my code.
              I placed the // before if(midpoint) around the whole section, now it compiles without error. Now I need to figure out what is wrong with this section.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by arvidvanstaey, Today, 02:19 PM
              1 response
              3 views
              0 likes
              Last Post NinjaTrader_Zachary  
              Started by mmckinnm, Today, 01:34 PM
              3 responses
              5 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Started by f.saeidi, Today, 01:32 PM
              2 responses
              7 views
              0 likes
              Last Post f.saeidi  
              Started by alifarahani, 04-19-2024, 09:40 AM
              9 responses
              55 views
              0 likes
              Last Post NinjaTrader_Jesse  
              Started by Conceptzx, 10-11-2022, 06:38 AM
              3 responses
              60 views
              0 likes
              Last Post NinjaTrader_SeanH  
              Working...
              X