CookieCuttr
New member
Hi is there some sort of declaration or function that I can use to keep a plot active once a criteria has been satisfied?
For example, let's say price is > 5% above the 10 moving average, at that point I want to display the 20EMA.
I would use something of the following [abbreviated and condensed]:
#Where P1 is when price > 5% above 10EMA
plot EMA20 = if P1 then MovingAverage(averageType.exponential, close, 20) else double.nan;
EMA20.SetDefaultColor(COLOR.YELLOW);
Now this will display the plot only when price is at least 5% above the MA, but when it goes below, the plot isn't shown. How do I keep the plot displayed once the criteria has been fulfilled?
Kind regards and TIA.
For example, let's say price is > 5% above the 10 moving average, at that point I want to display the 20EMA.
I would use something of the following [abbreviated and condensed]:
#Where P1 is when price > 5% above 10EMA
plot EMA20 = if P1 then MovingAverage(averageType.exponential, close, 20) else double.nan;
EMA20.SetDefaultColor(COLOR.YELLOW);
Now this will display the plot only when price is at least 5% above the MA, but when it goes below, the plot isn't shown. How do I keep the plot displayed once the criteria has been fulfilled?
Kind regards and TIA.