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 algospoke, 04-17-2024, 06:40 PM
          6 responses
          48 views
          0 likes
          Last Post algospoke  
          Started by arvidvanstaey, Today, 02:19 PM
          4 responses
          11 views
          0 likes
          Last Post arvidvanstaey  
          Started by samish18, 04-17-2024, 08:57 AM
          16 responses
          61 views
          0 likes
          Last Post samish18  
          Started by jordanq2, Today, 03:10 PM
          2 responses
          9 views
          0 likes
          Last Post jordanq2  
          Started by traderqz, Today, 12:06 AM
          10 responses
          19 views
          0 likes
          Last Post traderqz  
          Working...
          X