Static graph colour with PlotOHLC function

Hi guys,

I am analysing a third part AFL codes to learn how the developers use some functions and how they work. It is quite useful for me. Studying PlotOHLC function, I am having a little problem and I don't find what I am doing wrong.

I have learned to use it with an array but I am having problems when using it with a static value. Let me show you three simple AFL codes to explain my doubt.

If I use an array to determine the bar colour (as below), it works fine...

UpBar = Ref(C,0) > Ref(O,0);
ChartColor=IIf(UpBar,colorBlue,colorOrange);
PlotOHLC( Open,  High,  Low,  Close, "Price Chart", ChartColor, styleBar);

... but if I try it with static colour value (see two AFL codes below), it doesn't work (I mean, I am doing wrong).

ChartColor = colorBlue;
PlotOHLC( Open, High, Low, Close, "Price chart", ChartColor, styleBar );

or

PlotOHLC( Open, High, Low, Close, "Price chart", colorBlue, styleBar );

In both cases, I see bar colours as default (green and red), not blue. I feel that I am being blinded and I must escape something very obvious ... but, I'm sorry, I do not see it. I don't know if it is about my AFL code or my chart settings. Some help will be appreciated.

Thanks!

Under Preferences -> Bars & Candles ->
barcolor
or else do this....

BarColor = IIf(C>O,colorBlue,colorBlue);
5 Likes

Hi @Fossil,

Thank you very much. I have removed that tick and it works fine in both cases.

I have a lot to learn. More than I expect at the first time, I am afraid. Do you know why this tick (in preferences/Bars & Candles) affects when I use a static value but not when I use a dynamic array?

@BernieTGN
You will find lots of helpful forum members, so nothing to fear :slightly_smiling_face: .

3 Likes

@Fossil I'm sure. Thanks a lot!

1 Like