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 CarlTrading, 03-31-2026, 09:41 PM
    1 response
    81 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    42 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    64 views
    2 likes
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    68 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    55 views
    0 likes
    Last Post CarlTrading  
    Working...
    X