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

How to instantiate a custom drawing object/tool

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

    How to instantiate a custom drawing object/tool

    Hi all,

    In a strategy i am developing i'd like to be able to create/instantiate drawing objects based on a custom drawing tool. I have not found a way to do it similar to what it is possible with native drawing objects.

    For example, with native drawing tools you can create or instantiate an object like this:
    NinjaTrader.NinjaScript.DrawingTools.Line _myLine;
    _myLine = Draw.Line(this, "target_" + _drawLine.plotName, false, 20, _priceLevel, 1, _priceLevel, markerColor, DashStyleHelper.Solid, 5);​

    But with a custom drawing tool i have no idea how to proceed or if it is even possible.

    The only solution i found was to simulate a hotkey pressed using this command:
    System.Windows.Forms.SendKeys.SendWait("%{3}"); // simulate Alt+3 pressed

    But it is not perfect.

    Are there any other solutions ?
    Last edited by trendisyourfriend; 04-26-2023, 03:27 PM.

    #2
    Hello trendisyourfriend,

    Thank you for your post.

    I suggest checking out the ChartMarkersPlus script from the User App Share. It demonstrates how to add NS methods to draw the markers via other scripts; utilizing this idea in your custom drawing tool, you should be able to use the methods in other scripts to create/instantiate the drawing objects in other scripts, such as your strategy.

    The ChartMarkersPlus script is publicly available on our NinjaTrader Ecosystem website:
    Here is a basic guideline of how to import NinjaScript add-ons in NinjaTrader 8:

    Note — To import NinjaScripts you will need the original .zip file.

    To Import:
    1. Download the NinjaScripts to your desktop, keep them in the compressed .zip file.
    2. From the Control Center window select the menu Tools > Import > NinjaScript Add-on...
    3. Select the downloaded .zip file
    4. NinjaTrader will then confirm if the import has been successful.

    Critical - Specifically for some NinjaScripts, it will prompt that you are running newer versions of @SMA, @EMA, etc. and ask if you want to replace, press 'No'

    Once installed, you may add the indicator to a chart by:
    • Right-click your chart > Indicators... > Select the Indicator from the 'Available' list on the left > Add > OK

    Here is a short video demonstration of the import process:
    Please let me know if I can be of further assistance.

    The NinjaTrader Ecosystem website is for educational and informational purposes only and should not be considered a solicitation to buy or sell a futures contract or make any other type of investment decision. The add-ons listed on this website are not to be considered a recommendation and it is the reader's responsibility to evaluate any product, service, or company. NinjaTrader Ecosystem LLC is not responsible for the accuracy or content of any product, service or company linked to on this website.
    Emily C.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by burtoninlondon, Today, 12:38 AM
    0 responses
    9 views
    0 likes
    Last Post burtoninlondon  
    Started by AaronKoRn, Yesterday, 09:49 PM
    0 responses
    14 views
    0 likes
    Last Post AaronKoRn  
    Started by carnitron, Yesterday, 08:42 PM
    0 responses
    11 views
    0 likes
    Last Post carnitron  
    Started by strategist007, Yesterday, 07:51 PM
    0 responses
    13 views
    0 likes
    Last Post strategist007  
    Started by StockTrader88, 03-06-2021, 08:58 AM
    44 responses
    3,983 views
    3 likes
    Last Post jhudas88  
    Working...
    X