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

Set plot line value to EMPTY

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

    Set plot line value to EMPTY

    lets say, we want not to have the plot for specific bars.
    Generally, I was used to just "not plot" on that OnBarUpdate, like:

    Code:
    if (myCondition) 
      myPlot[0] = Close[0];
    so, if not `myCondition` then plot isn't being ploted/shown at all.

    but how can we use in ternary operator, like this?

    Code:
    myPlot[0] = myCondition ? Close[0] : Double.NaN;
    but on this case, it throws error (` Error on calling 'CalculateMinMax' method on bar XXX: The calculation results in unrenderable values.` )

    if i use
    Code:
    myPlot[0] = myCondition ? Close[0] : myPlot[1];
    then it plots at 0.00 on those occassions...
    what is workaround?
    yes, i know that i should not set value at all , or use .Reset(), but is there any value to assing to it, which will just force the chart not to shown line, as it is wasnt set at all on that bar?

    hope my question is simple.

    #2
    Hello TazoTodua, thanks for your post.

    Instead of setting the plot value to null for ignored data points, use Reset() and only plot if IsValidDataPoint() is true. Alternatively, if you are calculating values, and some of those values can be ignored, you can set the PlotBrushes of that bar to Brushes.Transparent to hide them while plotting.

    Best regards.
    Last edited by NinjaTrader_ChrisL; 08-24-2019, 02:50 PM. Reason: Changed BarBrushes to PlotBrushes
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      thanks.
      so, just with NULL value (or .nan) it is not possible to make that on that bar, to become ignored?

      I've not tried NULL, have tried double.nan, but it errors.

      thanks!

      Comment


        #4
        Hello TazoTodua, thanks for your reply.

        Sorry, in my last post I meant PlotBrushes, not BarBrushes.



        If you don't want to plot for some values, set the PlotBrushes[0][0] to Brushes.Transparent.
        Chris L.NinjaTrader 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