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 ghoul, Today, 06:02 PM
    3 responses
    14 views
    0 likes
    Last Post NinjaTrader_Manfred  
    Started by jeronymite, 04-12-2024, 04:26 PM
    3 responses
    44 views
    0 likes
    Last Post jeronymite  
    Started by Barry Milan, Yesterday, 10:35 PM
    7 responses
    20 views
    0 likes
    Last Post NinjaTrader_Manfred  
    Started by AttiM, 02-14-2024, 05:20 PM
    10 responses
    180 views
    0 likes
    Last Post jeronymite  
    Started by DanielSanMartin, Yesterday, 02:37 PM
    2 responses
    13 views
    0 likes
    Last Post DanielSanMartin  
    Working...
    X