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

Custom drawing crosshairs

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

    Custom drawing crosshairs

    I'm trying to draw a crosshair that indicates a projected target price on the price chart. I tried to use the DrawLine() api, but it seems lacking since I can not specify the exact coordinates to draw. For example, if I make this call:

    DrawLine("tag1", true, 1, 43, 0, 43, Color.Black, DashStyle.Solid, 1);

    It will draw a line from the previous bar to the current bar at the price value I intend (43). However, that is only half of the horizontal line. I could draw another line from the next bar over (-1, but I don't think this will work?), but then how do I draw the vertical line at that bar to complete the crosshair?

    I could use the DrawText() method to draw a "+", but it seems that would have to be tweaked a lot to get accuracy with the vertical axis value.

    Is there another api I can use to do this?

    Thanks,
    Chris

    #2
    Chris,

    I am not entirely sure what you mean. You can use DrawVerticalLine() to draw a vertical line on whichever bar index you want. You can also even use DrawHorizontalLine() to draw a horizontal line at a specific price all the way across the chart.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      I don't want to draw lines across the entire chart. Just small "+" above or below a price bar at the target price.

      Comment


        #4
        Best bet is your idea for using DrawText with + as the text then. You may need to fudge around with the exact placement to get it aligned where you want it exactly.
        Josh P.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Segwin, 05-07-2018, 02:15 PM
        10 responses
        1,769 views
        0 likes
        Last Post Leafcutter  
        Started by Rapine Heihei, 04-23-2024, 07:51 PM
        2 responses
        30 views
        0 likes
        Last Post Max238
        by Max238
         
        Started by Shansen, 08-30-2019, 10:18 PM
        24 responses
        943 views
        0 likes
        Last Post spwizard  
        Started by Max238, Today, 01:28 AM
        0 responses
        10 views
        0 likes
        Last Post Max238
        by Max238
         
        Started by rocketman7, Today, 01:00 AM
        0 responses
        7 views
        0 likes
        Last Post rocketman7  
        Working...
        X