• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Draw.Diamond on Add-On

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

    Draw.Diamond on Add-On

    Hello

    I'm trying to transfer my code from NT7 to NT8.

    I wrote a function that wraps Draw.Diamond which pass compilation on my indicator:

    Code:
    public Diamond DiamondDraw(double y, DateTime dateTime, Brush brush)
            {
                return (Draw.Diamond(this, Guid.NewGuid().ToString(), false, dateTime, y, brush));
            }

    However I want it to be on my Add-on so I wont need to copy it to each indicator. How can that be accomplished?

    Thanks

    #2
    Hello kiss987,

    Thank you for your note.

    I have attached a sample Addon which contains your draw diamond method inside a partial indicator class. The attachment also includes a indicator which references your method.

    You should note that if you try to export this indicator you will have to include this partial class, or include it within the indicator. I have this position commented out at the bottom of the attached indicator.

    Please let us know if you need further assistance.
    Attached Files
    Alan P.NinjaTrader Customer Service

    Comment


      #3
      Thank you for your reply.

      On my addon file I have the following code:

      namespace NinjaTrader.NinjaScript.AddOns
      {
      public partial class MySharedMethods : NinjaTrader.NinjaScript.AddOnBase
      {
      }
      }

      Is it possible to move the DiamondDraw method to this area so it will be effective for both indicators and strategies?

      Comment


        #4
        Hello kiss987,

        If you test the method inside the Addon namespace, like your suggestion, are you able to call it from a strategy?

        A working approach would be to add the following code to the end of the file I provided and you could reference the strategy method from within a strategy.

        Code:
        namespace NinjaTrader.NinjaScript.Strategies
        {
        	public partial class Strategy
        	{
        		public NinjaTrader.NinjaScript.DrawingTools.Diamond DiamondDraw1(double y, DateTime dateTime, Brush brush)
                       {
                           return (NinjaTrader.NinjaScript.DrawingTools.Draw.Diamond(this, Guid.NewGuid().ToString(), false, dateTime, y, brush));
                       }
        	}
        }
        Please let us know if you need further assistance.
        Alan P.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Ilpropio, Today, 09:45 PM
        0 responses
        2 views
        0 likes
        Last Post Ilpropio  
        Started by Revan, Today, 05:44 PM
        1 response
        13 views
        0 likes
        Last Post NinjaTrader_Marco  
        Started by superg3, Today, 07:57 PM
        0 responses
        3 views
        0 likes
        Last Post superg3
        by superg3
         
        Started by Longhornmark, Today, 07:06 AM
        5 responses
        35 views
        0 likes
        Last Post nkhoi
        by nkhoi
         
        Started by bomberone3, Today, 02:59 PM
        1 response
        4 views
        0 likes
        Last Post NinjaTrader_ChrisL  
        Working...
        X