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


convert a drawing object into an indicator

  • Filter
  • Time
  • Show
Clear All
new posts

  • ninjistu10
    Hi Jim,
    many thanks for your quick and detailed reply
    I'll go through your post carefully to figure out how to perform what I want since I'm not really well with coding

    I'll let you know if I have any questions since there seems to be no easy implementation...
    Last edited by ninjistu10; 02-25-2020, 03:48 PM.

    Leave a comment:

  • NinjaTrader_Jim
    Hello ninjistu10,

    Thanks for your post.

    We can create Alert conditions that fire limit orders at a defined price, but we cannot set an up alert for say "When price touches X line, submit a limit order at this price." The most straightforward way this could be accomplished is if NinjaTrader allowed for attaching orders to drawing objects, where the order will stay attached to where the line intersects with the current bar. We have a feature request tracking interest behind this and I have submitted a vote on your behalf. The internal ticket ID is SFT-1275. This is not a public ID but new features will be listed and described in the Release Notes page of the Help Guide upon implementation.

    Drawing objects cannot be converted to an indicator, but to use the Attach to Indicator feature with orders, you would want to capture the drawing object, and then assign the drawing object's anchor price to the indicator's plot. You could then submit your limit order and attach it to the indicator plot. I have attached an example that can help you get started.

    You can also consider looping through the DrawObjects collection, find your line and its anchors, and then you could perform some math to determine the price level you should be using for the current bar to hit that price. This would be more complicated. You would have to find the intersection of the line and a vertical line from the current bar, and then convert the Y coordinate of that intersection point to a Price value with ChartScale.GetValueByY(). I use some similar math in my Labeled Lines Drawing Tool, but you would be on your own for developing a way to find intersection, convert to price, and use to submit an order. Orders can be submitted from an indicator using AddOn code. See Account.CreateOrder for more details.

    LabeledLines Drawing Tool -

    Account.CreateOrder -

    Order objects -

    ​​​​​​​We look forward to assisting.
    Attached Files

    Leave a comment:

  • ninjistu10
    started a topic convert a drawing object into an indicator

    convert a drawing object into an indicator


    I would like to know if it's possible to convert a drawing object (e.g. a line) into an indicator and be able to attach an order to that line since is only possible to do it whit indicators

    Also, I considered to create an alert for that line but it's not fine for me because don't allow add a Limit order (under actions in alert properties), just a market order or an MIT order

    The final idea is to put a limit order when the price touches an inclined line (or any another drawing object in the chart)

    In the pic, a Limit Sell order should be submitted at 1,08985 if the last candle at that moment touches my line

    Any idea or suggestion is more than welcomed

    Attached Files

Latest Posts


Topics Statistics Last Post
Started by EnveousColnago, Today, 05:35 AM
2 responses
Last Post bltdavid  
Started by rafaelcoisa, Today, 02:20 PM
0 responses
Last Post rafaelcoisa  
Started by christopher512, Today, 02:05 PM
0 responses
Last Post christopher512  
Started by Auchlow, Yesterday, 05:49 AM
3 responses
1 like
Last Post sidlercom80  
Started by dp8282, Yesterday, 05:05 PM
2 responses
Last Post dp8282
by dp8282