How to colour bars green for close up & red for close down??

Rossini

Established member
Messages
916
Likes
132
I am new to TS, just finding my way around. I prefer ohlc bars to candlesticks, but TS does not seem to give me the option to colour the bars according to what the close of that day was. Does anyone know how to do this?

Cheers

R
 
What you need is a paintbar study. The code which I have written for this is used in TS2Ki but should work in yours as well. Here it is:

Inputs: pb(1), sellcolour(red);

{red bar paint condition}
Condition1 = close[1] < open[1];

{Sell Pinbar Alert}
If Condition1 then begin
PlotPaintBar[pb]{(Open[pb],} (High[pb], Low[pb], {Close[pb],} "pb");

SetPlotColor[pb](1, sellcolour);
{SetPlotWidth[pb](1, tk);}
end
Else Begin
{Both NoPlot statements must be included}
NoPlot(1);
NoPlot(2);
End;


Let me know how you get on.


Paul
 
Top