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 arvidvanstaey, Today, 02:19 PM
        4 responses
        11 views
        0 likes
        Last Post arvidvanstaey  
        Started by samish18, 04-17-2024, 08:57 AM
        16 responses
        60 views
        0 likes
        Last Post samish18  
        Started by jordanq2, Today, 03:10 PM
        2 responses
        9 views
        0 likes
        Last Post jordanq2  
        Started by traderqz, Today, 12:06 AM
        10 responses
        18 views
        0 likes
        Last Post traderqz  
        Started by algospoke, 04-17-2024, 06:40 PM
        5 responses
        48 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Working...
        X