Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

plot crossing zero not plotting

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

    plot crossing zero not plotting

    I have an issue with one of my plots I created 2 plot lines a color for above zero and another color for below zero. when it crosses it sometimes give a blank line. Here is the code and the graphic below.


    dEMA is Close[0] -EMA(50)[0];
    dLastEMA is Close[1] - EMA(50)[1];

    if(dEMA50>0)
    BaseTrend[0] = dEMA50;

    if(dEMA50<0)
    BaseTrend2[0] = dEMA50;

    i added this to check to see if this would work. I still have this error

    if(dEMA50>=0 && dLastEMA50<=0 )
    BaseTrend[0] = dEMA50;

    if(dEMA50<=0 && dLastEMA50>=0)
    BaseTrend[0] = dEMA50;
    Attached Files

    #2
    Hello ballboy11,

    Thanks for opening the thread.

    My advise would be to use one plot and then change the plot's PlotBrushes when the plot is above or below zero.

    For example:
    Code:
    if(Value[0] > 0)
    	PlotBrushes[0] = Brushes.Green;
    else
    	PlotBrushes[0] = Brushes.Red;
    A complete example on multi colored plots can be found here: https://ninjatrader.com/support/foru...ead.php?t=3227

    PlotBrushes can be referenced here: https://ninjatrader.com/support/help...lotbrushes.htm

    Outside of this advise, I would recommend to make sure each plot has a value for each slot, even if that value is 0.

    Please let me know if I may be of further assistance.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    648 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    369 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    108 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    573 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    575 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X