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

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.
    JimNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by bortz, 11-06-2023, 08:04 AM
    47 responses
    1,607 views
    0 likes
    Last Post aligator  
    Started by jaybedreamin, Today, 05:56 PM
    0 responses
    9 views
    0 likes
    Last Post jaybedreamin  
    Started by DJ888, 04-16-2024, 06:09 PM
    6 responses
    19 views
    0 likes
    Last Post DJ888
    by DJ888
     
    Started by Jon17, Today, 04:33 PM
    0 responses
    6 views
    0 likes
    Last Post Jon17
    by Jon17
     
    Started by Javierw.ok, Today, 04:12 PM
    0 responses
    15 views
    0 likes
    Last Post Javierw.ok  
    Working...
    X