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 Mindset, 04-21-2026, 06:46 AM
        0 responses
        64 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        93 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        48 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by cmoran13, 04-16-2026, 01:02 PM
        0 responses
        106 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        63 views
        0 likes
        Last Post PaulMohn  
        Working...
        X