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

Draw.Diamond on Add-On

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

  • NinjaTrader_AlanP
    replied
    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.

    Leave a comment:


  • kiss987
    replied
    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?

    Leave a comment:


  • NinjaTrader_AlanP
    replied
    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

    Leave a comment:


  • kiss987
    started a topic Draw.Diamond on Add-On

    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

Latest Posts

Collapse

Topics Statistics Last Post
Started by Davide999, 05-18-2023, 03:55 AM
4 responses
554 views
1 like
Last Post kcwasher  
Started by Stanfillirenfro, Today, 07:23 AM
2 responses
9 views
0 likes
Last Post Stanfillirenfro  
Started by rexsole, Today, 08:39 AM
2 responses
6 views
0 likes
Last Post NinjaTrader_Erick  
Started by cmtjoancolmenero, Yesterday, 03:58 PM
6 responses
29 views
0 likes
Last Post NinjaTrader_ChelseaB  
Started by gbourque, Today, 06:39 AM
2 responses
14 views
0 likes
Last Post gbourque  
Working...
X