I am trying to get an exception going where when the plot cant compute, to show a 0 or a 1 instead of blanking the whole indicator chart.
Here I'm attaching my code. Using ticker ACIU on todays , 08/31/2021 , it shows fine for length 5, 50, but blanks when using 5000.
Here I'm attaching my code. Using ticker ACIU on todays , 08/31/2021 , it shows fine for length 5, 50, but blanks when using 5000.
Code:
declare lower;
def price = close;
def length1 = 5000; # 5, 50 work, 5000 blanks it.
def prelrs1 = ( WMA(price, length1) - Average(price, length1) ) ;
plot LRS1 = if isnan(prelrs1) then 1 else prelrs1 ; # here Im trying to catch the exception to make it plot 1 when error.
plot zeroline = 0;