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

Is it possible read the 'Default' template asscosiated to a drawing object?

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

    Is it possible read the 'Default' template asscosiated to a drawing object?

    Hi support or anybody that can help,

    I'd like to read the Default attributes/properties of a user drawn object with Ninjascript but so far i have not been successful.

    Any idea how i can proceed to find a solution?

    Thanks

    #2
    Hello trendisyourfriend,

    The drawing objects will be in the DrawObjects collection and will need to be casted to the object type.


    The properties will be listed for the casted object type in the help guide. For example, below is a link to the properties of Line objects.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thanks,

      I found this solution for a line object as an example.

      Within the OnBarUpdate i create a dummy line once with the Default template and record its Stroke and then immediatly delete the object. So from then onward, i can set any other line to the default settings for the line object.

      Class wide variable:
      NinjaTrader.Gui.Stroke defaultLineStroke;

      Code:
      if (CurrentBar == BarsRequiredToTrade) {
      NinjaTrader.NinjaScript.DrawingTools.Line myLine = Draw.Line(this, "tag1", false, 2, Close[0], 1, Close[0], "Default");
      defaultLineStroke = myLine.Stroke;
      if ( DrawObjects["tag1"] as DrawingTools.Line != null )
      RemoveDrawObject("tag1");
      }

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by WHICKED, Today, 12:56 PM
      2 responses
      15 views
      0 likes
      Last Post WHICKED
      by WHICKED
       
      Started by Felix Reichert, Today, 02:12 PM
      0 responses
      1 view
      0 likes
      Last Post Felix Reichert  
      Started by Tim-c, Today, 02:10 PM
      0 responses
      1 view
      0 likes
      Last Post Tim-c
      by Tim-c
       
      Started by cre8able, Today, 01:16 PM
      2 responses
      9 views
      0 likes
      Last Post cre8able  
      Started by chbruno, 04-24-2024, 04:10 PM
      3 responses
      49 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Working...
      X