AFL - colored bars

Hi Members,

I am trying to code an AFL where the following conditions meet.

1. If close is Greater than previous bar's open - Green Bar
2. If close if Lower than previous bar's open - Red Bar

(Attached image)

I tried much but could not work it out.

Please help with your inputs.

Last edited:
Thanks abhig10,

I plotted the chart with code you provided. It worked, just one thing is missing, if you could look into it.

I have attached chart and encircled the bars. These bars plot in two colors. Ideally if the bar is closing below previous bar's open, it should be complete red.

And if closing above previous bar's open, then complete Green.

Many Thanks,

Surely I will make sure not to post duplicate.
Last edited:

Similar threads