Help me plz .. (Beginner)

#1
I hv a question about the color changing code.

i used this one

// Plots a 20 period Donchian channel

pds=20;
pdss=10;

upper1=HHV(Ref(H,-1),pds);
Lower1 = LLV(Ref(L,-1),pdss);
Middle1 = (upper1+Lower1)/2;
stopline=HHV(C-3*ATR(14),7);

Plot(Upper1,"Upper",colorWhite,styleLine);
Plot(Middle1,"Middle",colorBlue,styleLine);
Plot(Lower1,"Lower",colorRed,styleLine);
Plot(stopline,"stopline",colorBrightGreen,styleLine);



Buy = Cross(C,upper1);
Sell = Cross(C,Lower1);


Color=IIf(BarsSince(Buy)<BarsSince(Sell),ParamColor("Bullish",colorGreen),ParamColor("Bearish",colorRed));
Plot(C,"close",60);
Plot(C,"close",Color,styleCandle);

//Plotarrow//
shape=Buy*shapeUpArrow+Sell*shapeDownArrow;
PlotShapes(shape,IIf(Buy,colorGreen,colorRed),0,IIf(Buy,Low,High));
GraphXSpace=5;

....................................................................................................


In first circle i wonder why this green candle stick not change into red color, close is already cross lower (red line, lower) ?

In second circle , why the candle stick is delay about 2 bars in changing color ?

thank you .
 

Similar threads