Pinescript: Plot an entry point where Volume bars are Red, Red, Green

30 Views Asked by At

I am trying to write a Pine script that observes the volume bars on a 3 minute chart and plots a triangleup entry point whenever there is any instance of the following:

Volume bars in the following sequence: A red bar followed by a shorter red bar followed by a taller green bar (in that order)

So FirstRed > Second Red < Green.

Any ideas?

I started with this from a different script and tried to modify it:

``
    //@version=5
    indicator(title="RRG", overlay=true, precision=2)

    // Define input for percentage threshold
    percentageThreshold = input.float(title="Percentage Threshold", defval=60, minval=0)

    // Define green and red bars
    isGreen = close > open
    isRed = close < open

    // Define conditions for the pattern
    isFirstGreen = isGreen and isRed[1]
    isSecondGreen = isGreen and isRed[1] and isGreen[2]
    isFirstGreenTaller = isGreen and high > high[1]
    isLastGreenThresholdMet = volume > volume[1] * (percentageThreshold / 100) and isSecondGreen

    // Plot the pattern
    plotshape(series=isFirstGreenTaller and isLastGreenThresholdMet, style=shape.triangleup,     location=location.belowbar, color=color.green, size=size.small)
``
0

There are 0 best solutions below