Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

error fibonacci circle "is not an object "

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

    error fibonacci circle "is not an object "

    I try to draw a fibonacci circle by code but i have the error ... I"s not an object"
    I found the code here : https://ninjatrader.com/support/help...accicircle.htm
    Code:
    FibonacciCircle myFibCirc = Draw.FibonacciCircle(this, "tag1", true, 10, Low[10], 0, High[0]);
    This code is in a function that executes when the chart is clicked.
    Can you explain me how to draw it correctly
    Thank you

    #2
    Hello bicou,

    Can you provide an image of the error that you are seeing?

    The code you provided/from the help guide compiles fine on my end so I am not sure what specific error you are seeing based on the details.

    Comment


      #3
      The exact error is : Unhandled exception: Object reference not set to an instance of an object.
      The code :
      Code:
      protected void MouseClicked(object sender, MouseButtonEventArgs e)
      {
        FibonacciCircle myFibCirc= Draw.FibonacciCircle(this, "tag1", true, 10, Low[10], 0, High[0]);
      }​
      thx

      Comment


        #4
        Hello bicou,

        That means an object was null.

        If you use button or mouse events you also need to use TriggerCustomEvent inside the event handler.

        https://ninjatrader.com/support/help...tsub=TriggerCustomEvent

        Code:
        private void MymouseHandler()
        {
        TriggerCustomEvent(o =>
        {
        // your code here
        }, null));​
        Last edited by NinjaTrader_Jesse; 11-07-2023, 03:13 PM.

        Comment


          #5
          Thank you, it works very well.
          I have one more question.
          Here I only trace one object so with a boolean, as you can see in my code, I can manage its deletion.
          Code:
          if ( Drawn)
          {
          RemoveDrawObject("tag1");
          Drawn = false;
          }
          else
          {
          myFibCirc= Draw.FibonacciCircle(this, "tag1", true, 10, Low[10], 0, High[0]);
          Drawn = true;
          }​​
          But if I have several objects, how can I delete one of them?
          I thought of testing the tag with if (myFibCirc.Tag == "tag1")... but it doesn't work and I haven't found anything like it in the documentation.
          Thanks

          Comment


            #6
            Hello bicou,

            If you have several objects they would need to have unique tag names so you would just need to specify the unique tag that you wanted to remove. If you wanted to control when that gets removed you would have to make a second variable and conditions similar to what you have shown to control that second object.

            Comment


              #7
              Thank you for your answer

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
              0 responses
              636 views
              0 likes
              Last Post Geovanny Suaza  
              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
              0 responses
              366 views
              1 like
              Last Post Geovanny Suaza  
              Started by Mindset, 02-09-2026, 11:44 AM
              0 responses
              107 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
              0 responses
              568 views
              1 like
              Last Post Geovanny Suaza  
              Started by RFrosty, 01-28-2026, 06:49 PM
              0 responses
              571 views
              1 like
              Last Post RFrosty
              by RFrosty
               
              Working...
              X