• 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 line with box as tail

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

    draw line with box as tail

    Is there a way to draw a box line instead of arrow line? And also I have drawn a line and user can move it on chart but it doesn't scale automatically the y axis with respect to chart ticksize, zOrder=1 in lines doesn't work too. Can someone help me on this?
    Last edited by luxurious_04; 11-03-2017, 06:19 AM.

    #2
    Hello luxurious_04,

    Thanks for opening the thread.

    There is not a specific "Box line" drawing tool that comes with NinjaTrader, but there are line and rectangle drawing tools that you may be able to use to accomplish your goal. Otherwise, you could consider creating your own tool to create a an "Arrow Line" through custom plotting. Custom plotting is reserved for advanced programs that would like to do their own drawing in NinjaTrader 7. We do not provide support for custom drawing code, but we do ship a SampleCustomPlot indicator with NinjaTrader 7 that demonstrates how it can be done.

    As for auto scaling a draw object, you can create a drawing object with the autoscale bool set to true, and then you can unlock the drawing object so it can be moved manually. If the chart scale is set to automatic and is not in fixed mode, you will be able to adjust the scale of the chart with the drawing tool.

    Code:
    if(CurrentBar < 10) return;
    ILine myLine = DrawLine("tag", true, 10, Close[0] + 100 *TickSize, 0,  Close[0] + 100 *TickSize, Color.Black, DashStyle.Solid, 2);
    myLine.Locked = false;
    Drawing tools will inherit the zOrder of the indicator that creates them. This zOrder is determined by the order in which you add the indicators. You can set a SeparateZOrder property for a drawing tool so you can manually adjust the zOrder, but it cannot be set programmatically.

    An example script can be found here: https://ninjatrader.com/support/foru...9&postcount=10

    DrawingObject properties can be referenced in our help guide here: https://ninjatrader.com/support/help...drawobject.htm

    If you have any additional questions, please don't hesitate to ask.
    JimNinjaTrader Customer Service

    Comment


      #3
      Is there a way to merge the line and rectangle? I want to move line then the rectangle also follows with the line. Something I want to group the two drawn objects just like the MS Word wherein you can group a line and a rectangle. Also how to set the chart scale to automatic?

      Comment


        #4
        Hello luxurious_04,

        There is not an ability to link drawing objects together, but we have a feature request tracking interest in this field. I will submit a vote for you on your behalf. The ticket ID is SFT-2625. Keep in mind, NinjaTrader 7 is in a freeze and this request would be for implementation in NinjaTrader 8.

        This feature's implementation can be found in the Release Notes of the version of NinjaTrader 8 that includes the feature. You can find the Release Notes here: https://ninjatrader.com/support/help...ease_notes.htm

        Feature requests are fulfilled based on our development team's schedule and priorities and we cannot provide a time frame for it to become available.

        In the meantime, you may be able to find a workaround by constantly checking one of your drawing objects anchors, and if one object moves, you could move the other. I have attached an example indicator that draws a line once and then updates its start and end anchors with each bar update. This example is only for demonstration purposes as is not intended to be copy and pasted into a real script.

        If there is anything else I can do to assist, please let me know.
        Attached Files
        JimNinjaTrader Customer Service

        Comment


          #5
          I know how to lock the drawing but I really want to draw lines the same with the NT lines when you submit an order. Just like the image I have attached.
          Attached Files

          Comment


            #6
            Hello luxurious_04,

            Thanks for your reply.

            There is not a drawing tool that can be used to recreate order markers. You could create your own tool that can do this through custom plotting and checks to see if certain mouse clicks are within the bounds of what you would like to have selectable. Otherwise, you could use a combination of existing drawing tools and use your own logic to update the drawing objects positions after one is being adjusted.

            There is an example that a colleague of mine has shared that can demonstrate how to register mouse clicks. This script and the CustomPlotSample script that is included with NinjaTrader 7 could provide some direction to help you get started creating your own script with custom plotting.

            Mouse click to price level example - https://ninjatrader.com/support/foru...d.php?t=103995

            Please let me know if I can offer further help.
            JimNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Mike3238, Yesterday, 07:09 PM
            1 response
            19 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by Rashid Garuba, Today, 11:37 AM
            0 responses
            8 views
            0 likes
            Last Post Rashid Garuba  
            Started by elkhatabi, Today, 11:19 AM
            0 responses
            5 views
            0 likes
            Last Post elkhatabi  
            Started by hurleydood, Today, 10:07 AM
            0 responses
            6 views
            0 likes
            Last Post hurleydood  
            Started by Irukandji, Today, 09:43 AM
            1 response
            10 views
            0 likes
            Last Post NinjaTrader_ThomasC  
            Working...
            X