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.
    https://ninjatrader.com/support/help...rawobjects.htm

    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.
    https://ninjatrader.com/support/helpGuides/nt8/line.htm
    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 egar1234, Yesterday, 03:51 PM
      1 response
      18 views
      0 likes
      Last Post NinjaTrader_PaulH  
      Started by derivtrader, Today, 05:59 AM
      0 responses
      9 views
      0 likes
      Last Post derivtrader  
      Started by dgee949, Yesterday, 09:01 PM
      1 response
      22 views
      0 likes
      Last Post NinjaTrader_ChrisSch  
      Started by uncavl, Today, 12:41 AM
      1 response
      27 views
      0 likes
      Last Post NinjaTrader_Jason  
      Started by focus333, Yesterday, 11:28 PM
      0 responses
      17 views
      0 likes
      Last Post focus333  
      Working...
      X