• 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

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, 03: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 tecmisc1, Today, 09:57 AM
    0 responses
    2 views
    0 likes
    Last Post tecmisc1  
    Started by mbesha, Today, 09:26 AM
    0 responses
    1 view
    0 likes
    Last Post mbesha
    by mbesha
     
    Started by Brillo, Today, 08:58 AM
    0 responses
    6 views
    0 likes
    Last Post Brillo
    by Brillo
     
    Started by avrege, Today, 01:48 AM
    2 responses
    14 views
    0 likes
    Last Post avrege
    by avrege
     
    Started by markbb10, Today, 07:14 AM
    0 responses
    7 views
    0 likes
    Last Post markbb10  
    Working...
    X