Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Accessing draw.Diamond in MySharedMethods

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

    Accessing draw.Diamond in MySharedMethods

    I am trying to access draw.Diamond in a static method in MySharedMethods. How do I do that please.

    NT8

    #2
    Thank you for your question stevenev1.

    Static methods in C# can never have instance specific methods.

    As a possible work-around, oine common way to get at local variables and methods from a static class is to have a singleton instance of the class kept available. I am attaching one such strategy, which stores a "main" instance of itself in a variable called "self", and which uses this to access the Draw.Diamond method. Please let us know if there are any other ways we can help.

    Another possible work-around would be to keep an array or dictionary of live indicator instances, so that your static method can reference multiple instances.

    Please let us know if there are any other ways wee can help.
    Attached Files
    Jessica P.NinjaTrader Customer Service

    Comment


      #3
      Thanks, Jessica!

      It worked great once I included that indicator on my chart. Now how do I use this common method in another indicator (while keeping the code in the indicator your provided). This got me stumped

      Comment


        #4
        I am thinking that I could pass 'this' to a static method that resides in common indicator space. That way, everything is available. I just don't know how to set that up. If this is also an option, please help.

        Comment


          #5
          You can absolutely pass "this" as the first argument to any of the Draw methods. If you can send a small stripped-down code sample I may be able to provide more direct help.
          Jessica P.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          77 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          45 views
          0 likes
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          27 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Started by TheRealMorford, 03-05-2026, 06:15 PM
          0 responses
          32 views
          0 likes
          Last Post TheRealMorford  
          Started by Mindset, 02-28-2026, 06:16 AM
          0 responses
          63 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Working...
          X