Is it possible to plot the a value based on the previous calculation of a DEF calculation?
in the following example I am using the previous definition of a calculated SMA to make a comparison and
create a new plot. But it doesn't work.
If so I would appreciate an example of how to do it.
input price = close;
input length = 9;
DEF SMA = Average(price[-displace], length);
Plot smadif = If SMA[5] < SMA[4] and SMA[4] < SMA[3]
and SMA[3] < SMA[2] and SMA[2] < SMA[1] and
and SMA > SMA[1] Then 1 ELSE Double.NAN;
in the following example I am using the previous definition of a calculated SMA to make a comparison and
create a new plot. But it doesn't work.
If so I would appreciate an example of how to do it.
input price = close;
input length = 9;
DEF SMA = Average(price[-displace], length);
Plot smadif = If SMA[5] < SMA[4] and SMA[4] < SMA[3]
and SMA[3] < SMA[2] and SMA[2] < SMA[1] and
and SMA > SMA[1] Then 1 ELSE Double.NAN;