Comparing volume bars
Posted: Sun Mar 06, 2022 5:00 pm
Hi everyone. This is my first post. I am quickly working through all the training and trying to get some useful code built. I could use some help from the community. I am trying to identify a pattern for volume only:
- Group volume bars into groups of 3 (3 consecutive bars, starting from most recent closed bar)
- Check if most recent closed volume bar closed higher than the previous volume bar
- Check if the volume bar 3 bars ago closed higher than the volume bar 2 bars ago
- In other words, High-Low-High pattern
- I want to mark the middle bar
- I want this pattern to repeat in groups of 3, looking back in time on the chart
Clearly, I am not succeeding. This is what I have so far:
This community is outstandling. I am so thankful we have something like this.
- Group volume bars into groups of 3 (3 consecutive bars, starting from most recent closed bar)
- Check if most recent closed volume bar closed higher than the previous volume bar
- Check if the volume bar 3 bars ago closed higher than the volume bar 2 bars ago
- In other words, High-Low-High pattern
- I want to mark the middle bar
- I want this pattern to repeat in groups of 3, looking back in time on the chart
Clearly, I am not succeeding. This is what I have so far:
Code: Select all
//@version=5
indicator("volume detector")
highLowHigh= barstate.isconfirmed and (volume[1] > volume[2]) and (volume[3] > volume[2] -1)
bgcolor(color=highLowHigh ? color.green[2] : na)
This community is outstandling. I am so thankful we have something like this.