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

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.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by mgco4you, Today, 09:46 PM
    0 responses
    1 view
    0 likes
    Last Post mgco4you  
    Started by Rapine Heihei, Today, 08:19 PM
    1 response
    8 views
    0 likes
    Last Post NinjaTrader_Manfred  
    Started by Rapine Heihei, Today, 08:25 PM
    0 responses
    6 views
    0 likes
    Last Post Rapine Heihei  
    Started by f.saeidi, Today, 08:01 PM
    1 response
    9 views
    0 likes
    Last Post NinjaTrader_Manfred  
    Started by Rapine Heihei, Today, 07:51 PM
    0 responses
    8 views
    0 likes
    Last Post Rapine Heihei  
    Working...
    X