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

Change previously drawn drawvertialline from solid to dash

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

    Change previously drawn drawvertialline from solid to dash

    Scenario:

    I drawverticalline to a future time (not bars) on a range chart. When I draw it initially I want to draw it as a dash line to show it in the future (got that part working fine). When the actual time hits I want to change the vertical line pen to a solid line (need help here). Or should I just redraw it.

    I think I need to change the dashstyle on the verticalline pen using iverticalline. Not sure exactly how to code this. I looked on the forum and couldn't find a good example reference to use. I can also just remove the drawn line object and redraw the vertical line.

    A second minor issue is Ninja will draw the line to the future time (bar) on the range chart where it thinks that time will be. I draw these line days in advance so they can be off by a lot by the time it actually hits. Currently I redraw the line periodically (I actually change the iverticalline time to something different and then back to the original) if the time is in the future to realign it to the chart. It works but didn't know if there was a cleaner way to fix this issue. I can do an f5 and everything will display correct but that is a real hassle.

    Summary:
    1) How do I change a previously drawvertialline dash to a solid line? or I draw a line in the future but when that time hits i want to display it differently.
    2) What is the recommended way to realign a drawobject time drawn in the future to a time (not bars) on a non time (range) chart so it will be aligned correctly with the actual time?

    Hope that makes sense.
    Last edited by ct; 07-12-2015, 04:09 PM.

    #2
    Hello,

    Thank you for the questions.


    For 1, modifying a prior line, there are two ways in which you could do this. First would be to remove the existing line and then draw another line. This would involve knowing which tag is for which object so you can call RemoveDrawObject() http://ninjatrader.com/support/helpG...ightsub=remove

    The second would be to store the object as a variable, you could then use the variable to change the line anytime it is needed.

    A simple example of this would be:

    Code:
    IVerticalLine vl = DrawVerticalLine("MyVerticalLine", 0, Color.Blue, DashStyle.Solid, 1);
    vl.Pen.DashStyle = DashStyle.Dash;

    For 2, this did not quite make sense as I am unsure exactly what code you are using for the future plotting. If you are trying to change the object the example above would be exactly that, otherwise can you provide some clarification or example of this question?

    I look forward to being of further assistance.
    JesseNinjaTrader 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
    61 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