• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Error in ChartControl

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

    Error in ChartControl

    Hello,

    I am getting an "Object reference not set to an instance of an object" error from the following simple line of code:

    ChartControl.ChartStyle.Pen.Color = Color.LightGray;

    I cannot understand why this line would throw an error since it is the syntax recommended in the following NT guide:

    http://ninjatrader.com/support/helpG...er_11_2010.pdf

    Suggestions?

    Thank you.

    #2
    Hello ivb73077,

    Thanks for your post.

    Are you certain that the error refers to that specific line and of that specific file?

    I've tried the line and had no issues.
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Yes. The line is wrapped inside a Try/Catch block and the exception occurred therein. To determine the exact source of the error, I debugged using Visual Studio and it was this line that caused the exception to be thrown.

      Comment


        #4
        Hello ivb73077,

        Thanks for your reply.

        Using the Ninjascript IDE I've had no issues with that line in an indicator or a strategy.

        If you like, feel free to send in your script and I can test on my end. You can send to PlatformSupport[at]Ninjatrader[dot]com with atten Paul and a link to this thread in the subject line.
        Paul H.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by ivb73077 View Post
          Hello,

          I am getting an "Object reference not set to an instance of an object" error from the following simple line of code:

          ChartControl.ChartStyle.Pen.Color = Color.LightGray;

          I cannot understand why this line would throw an error since it is the syntax recommended in the following NT guide:

          http://ninjatrader.com/support/helpG...er_11_2010.pdf

          Suggestions?

          Thank you.
          Are you using that line in a called Indicator? IOW, is that line coming from code in an entity that is directly applied to a chart, or from an object that is being called by another object?

          Comment


            #6
            Yes. I am calling it from within an indicator.

            Can you please explain the impact this would have, if any? Thank you.

            Comment


              #7
              Originally posted by ivb73077 View Post
              Yes. I am calling it from within an indicator.

              Can you please explain the impact this would have, if any? Thank you.
              If the indicator is not directly applied to a chart, ChartControl does not exist. Check for it and escape if necessary.

              ref: http://ninjatrader.com/support/forum...ad.php?t=76551
              Last edited by koganam; 09-09-2015, 09:32 AM.

              Comment


                #8
                The peculiar issue is that I have ~15 ChartControl settings being called. All of them work except the line

                ChartControl.ChartStyle.Pen.Color = Color.LightGray;

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by spikeruk, Today, 01:49 PM
                1 response
                11 views
                0 likes
                Last Post NinjaTrader_PaulH  
                Started by Yandychang, Today, 02:16 PM
                5 responses
                17 views
                0 likes
                Last Post NinjaTrader_Jesse  
                Started by priceisking, Today, 01:16 PM
                2 responses
                8 views
                0 likes
                Last Post priceisking  
                Started by kashyapjdave, 03-23-2017, 12:12 AM
                11 responses
                1,959 views
                0 likes
                Last Post forextrader2003  
                Started by Gav_G, 07-26-2018, 04:29 PM
                6 responses
                428 views
                0 likes
                Last Post forextrader2003  
                Working...
                X