Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Plotting Lines through Zones

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

    Plotting Lines through Zones

    Hello,

    The attached sketch shows lines I've drawn using the following simple code:



    Code:
    if (!newblueline && GoodDirection[0] == 1 && GoodDirection[1] != 1) 
    			{
    					newblueline = true;
    					newredline = false;
    					barcountstart = CurrentBar;
    					startline = Close[0];
    			}
    			if (newblueline && GoodDirection[0] != 1 && GoodDirection[1] == 1) 
    			{
    					barcountend = CurrentBar;
    					endline = Close[0];
    					//newblueline = false;
    					
    			}
    			if (!newredline && GoodDirection[0] == -1 && GoodDirection[1] != -1) 
    			{
    					newredline = true;
    					newblueline = false;
    					barcountstart = CurrentBar;
    					startline = Close[0];
    			}
    			if (newredline && GoodDirection[0] != -1 && GoodDirection[1] == -1) 
    			{
    					barcountend = CurrentBar;
    					endline = Close[0];
    					//newredline = false;
    					
    			}
    			
    			if (newblueline) DrawLine("newlineblue"+CurrentBar,true,(CurrentBar - barcountstart),startline,(CurrentBar - barcountend), endline, Color.Blue,DashStyle.DashDot,3);
    			if (newredline) DrawLine("newlinered"+CurrentBar,true,(CurrentBar - barcountstart),startline,(CurrentBar - barcountend), endline, Color.Red,DashStyle.DashDot,3);
    GoodDirections are DataSeries indicated by backcolors (1 is blue, -1 is orchid/purple, 0 is blank)


    http://screencast.com/t/Dxt256mz

    Please advise what needs to change with the code to plot one red line in the orchid/purple zone, one blue line in the blue zone, and no plots in the blank zone.
    Thanks.
    Kirk
    Attached Files
    Last edited by zeller4; 12-26-2011, 09:24 AM.

    #2
    Hello,

    Thanks for the note.

    Although I cannot offer exact code you would need to change to do this I can point you in the right direction to do this on your own.

    It appears you are using DrawLine() to do this therefor you needed to add code so that you do not start Drawing a Line during this time or that and existing line does not have a start time before the time and an end time after the time. Since you defint the start point and end points of each line you draw you would need to make this change in your code you use to decide to DrawLine() or not to DrawLine().

    Let me know if I can be of further assistance.
    BrettNinjaTrader Product Management

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    579 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    334 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    101 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    554 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    551 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X