Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

do not plot if false

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

    do not plot if false

    Hi, I am working with this script from your tutorial. How can I tell it DO NOT PLOT ANYTHING if the expression is false?

    if the condition evaluates to false, then the second expression will be run (the expression on the right side of the colon ":", which will assign the value of the indicator plot to the Low price of the specified bar, less five ticks:

    Values[0][BarsAgo] = (Close[BarsAgo] > Close[(BarsAgo + 1)]) ? (High[BarsAgo] + (5 * TickSize)) : (Low[BarsAgo] - (5 * TickSize));

    #2
    Hi trader3000a, thanks for posting.

    Change the PlotBrushes to Transparent to hide it e.g.

    Values[0][BarsAgo] = (Close[BarsAgo] > Close[(BarsAgo + 1)]) ? (High[BarsAgo] + (5 * TickSize)) : (Low[BarsAgo] - (5 * TickSize));

    if(!(Close[BarsAgo] > Close[(BarsAgo + 1)]))
    PlotBrushes[0][BarsAgo] = Brushes.Transparent;


    Comment


      #3
      thanks, that's very helpful! Is there a way to clean the code up to remove any action after a false test of the expression? Instead of having to print transparent stuff for a false can we just leave it out entirely? I tried just writing in "" after the colon but got an error.

      Comment


        #4
        Hi trader3000a,

        You must give the code to make the plot transparent. The plot should have a value for each slot index. If the plot should have no value you can set it to 0.

        Kind regards.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by charlesugo_1, 05-26-2026, 05:03 PM
        0 responses
        68 views
        0 likes
        Last Post charlesugo_1  
        Started by DannyP96, 05-18-2026, 02:38 PM
        1 response
        150 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 05-11-2026, 05:56 AM
        0 responses
        162 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 05-10-2026, 08:12 PM
        0 responses
        100 views
        0 likes
        Last Post CarlTrading  
        Started by Hwop38, 05-04-2026, 07:02 PM
        0 responses
        288 views
        0 likes
        Last Post Hwop38
        by Hwop38
         
        Working...
        X