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 rocketman7, Today, 09:41 AM
      3 responses
      7 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Started by traderqz, Today, 09:44 AM
      2 responses
      4 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Started by stafe, 04-15-2024, 08:34 PM
      8 responses
      40 views
      0 likes
      Last Post stafe
      by stafe
       
      Started by rocketman7, Today, 02:12 AM
      7 responses
      31 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by guillembm, Yesterday, 11:25 AM
      3 responses
      16 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Working...
      X