Barros Swing Average Volume (Initial swing)

Hi Everyone,
I am trying to script a show bar to reflect either, the change from Green to red and back, Barros Swing Average Volume (Initial swing), or alternatively to show the days where the tool is green or red.
I have tried variations of BARROSSWING() TurnsUp for green and TurnsDown for red, and have asked the bot which offered many variations, nothing worked.
Any help much appreciated.

Hi,

Try the following:

//Set Barros Swing
bSwing = BARROSSWING();
//Find Down Swing
isDownSwing = SWINGEND(bSwing) > SWINGSTART(bSwing);
//Mark Zone on Chart
isDownSwing

This will mark the Red bars of the Barros Swing Average Volume using the initial swing.

Thank you Matthew. Worked like a charm.

This works perfectly as a show view but as a show bar it only shows the turn, not all the bars. Is that normal?

That’s correct for a Show Bar using swing data as there isn’t a swing value for every day, only when it changes (in a Show View, this data is padded for every bar).

Note that you can colour the bars red using the formula, with the default set to green: