PureBytes Links
Trading Reference Links
|
> Trying to plot:
> if RSI crosses over 30 then plot1(RSI,green)
> else
> if RSI crosses under 70 then plot1(RSI, red)
> else
> plot1(RSI,darkgray);
That will plot darkgray except on/near the bar when the cross
happens, but I think you expected that.
> If plot type is "line" then the conditional colors appear for the
> next bar after the cross condition. If plot type is other than
> "line" (histogram, cross,...), then the conditional colors appear
> for the bar where the cross conditions actually occur.
A histogram or other plot type is "attached" to only one bar. It
plots its data, in the specified color, on the bar when you
specify it.
A line plot is "attached" to two bars, for the two endpoints of
the line. It sets the color, but doesn't use the color until the
NEXT line is drawn. So the color is in effect STARTING on that
bar, not ENDING on that bar.
I don't think that's the right definition, but that's the way it
works.
> I do need to plot it as a line so tried the syntax, setplotcolor,
> and also tried to "twist" the EL in several ways...but no luck!
> Is there a workaround?
If you insist on using lines, you can plot one bar back:
if RSI crosses over 30 then plot1[1](RSI[1],green)
else
if RSI crosses under 70 then plot1[1](RSI[1], red)
else
plot1[1](RSI[1],darkgray);
But that will be delayed a bar. A historic chart will look
right, but the current (rightmost) bar won't get plotted until a
new bar arrives.
The simplest workaround is just to use histograms or dots or
whatever.
Gary
|