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

convert a drawing object into an indicator

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

    convert a drawing object into an indicator

    Hi,

    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
    Thanks

    Attached Files

    #2
    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 - https://ninjatraderecosystem.com/use...-drawing-tool/

    Account.CreateOrder - https://ninjatrader.com/support/help...reateorder.htm

    Order objects - https://ninjatrader.com/support/help...nt8/?order.htm

    ​​​​​​​We look forward to assisting.
    Attached Files
    JimNinjaTrader Customer Service

    Comment


      #3
      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...
      BR
      Last edited by ninjistu10; 02-25-2020, 03:48 PM.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by tkaboris, Yesterday, 05:13 PM
      2 responses
      36 views
      0 likes
      Last Post tkaboris  
      Started by trader3000a, Yesterday, 02:48 PM
      2 responses
      34 views
      0 likes
      Last Post trader3000a  
      Started by lyrad82, Today, 02:58 AM
      1 response
      28 views
      0 likes
      Last Post NinjaTrader_Jason  
      Started by elliot5, Today, 04:07 AM
      0 responses
      18 views
      0 likes
      Last Post elliot5
      by elliot5
       
      Started by rafaelcoisa, 01-29-2023, 07:56 PM
      20 responses
      213 views
      0 likes
      Last Post rafaelcoisa  
      Working...
      X