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

Help to stop the lines when it's crossing any bar on the chart

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

    Help to stop the lines when it's crossing any bar on the chart


    Hello Ninja Trader Community,

    I am currently drawing lines from one low value to another bar's low value. However, I've noticed that some lines are intersecting with the bars. I would like to prevent this from happening. Is there a way for me to determine whether a line is crossing any bars on the chart through code?

    For example, I would like to prevent dotted lines from extending beyond the bars in the screenshots below.

    Please assist me with this issue.

    Thank you
    Ramanji​


    Click image for larger version

Name:	image.png
Views:	50
Size:	141.8 KB
ID:	1281937

    #2
    Hello ramanji,

    Thanks for your post.

    To clarify, do you want the dotted line to be drawn behind the bars?

    The SetZOrder() method seen on the help guide page below could be used to accomplish this. Setting the ZOrder to -1 would make sure the object plots behind the chart bars.

    SetZOrder: https://ninjatrader.com/support/help.../setzorder.htm
    ZOrder: https://ninjatrader.com/support/help...art_zorder.htm

    Otherwise, from the image you shared, you are drawing the line to a point on the right side of the chart so the line overlapping bars would be expected based on the start and end points of the line.

    If you wanted it to stop at that bar where the line crossed the bar, you would need to add custom logic to your script to specify that bar is the endpoint for that line instead of the endpoint at the right side of the chart in the image.
    Last edited by NinjaTrader_BrandonH; 12-12-2023, 01:25 PM.
    Brandon H.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by AaronKoRn, Today, 09:49 PM
    0 responses
    6 views
    0 likes
    Last Post AaronKoRn  
    Started by carnitron, Today, 08:42 PM
    0 responses
    8 views
    0 likes
    Last Post carnitron  
    Started by strategist007, Today, 07:51 PM
    0 responses
    9 views
    0 likes
    Last Post strategist007  
    Started by StockTrader88, 03-06-2021, 08:58 AM
    44 responses
    3,975 views
    3 likes
    Last Post jhudas88  
    Started by rbeckmann05, Today, 06:48 PM
    0 responses
    9 views
    0 likes
    Last Post rbeckmann05  
    Working...
    X