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 adeelshahzad, Today, 03:54 AM
    5 responses
    31 views
    0 likes
    Last Post NinjaTrader_BrandonH  
    Started by stafe, 04-15-2024, 08:34 PM
    7 responses
    31 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by merzo, 06-25-2023, 02:19 AM
    10 responses
    823 views
    1 like
    Last Post NinjaTrader_ChristopherJ  
    Started by frankthearm, Today, 09:08 AM
    5 responses
    18 views
    0 likes
    Last Post NinjaTrader_Clayton  
    Started by jeronymite, 04-12-2024, 04:26 PM
    3 responses
    43 views
    0 likes
    Last Post jeronymite  
    Working...
    X