There were a few items left out for which I had to make my own choices. On the chart, an “up candle” is determine strictly by the position of the open and the close. If the candle closes higher than it opens, the chart colors that candle green. Even if that candle had gapped down and actually closed lower than the previous candle’s close. So I wrote the code to ensure we capture both. Two green candles, each with higher closes.
The other item you did not specify clearly is: “with the second day candle being at least twice as big as the previous one”. So I was not sure if you wanted to include the high and low in that test or just the body of the candle, the open to close. In this code I chose to use just the candle body.
The requirement for a volume percent change is provided for through a user input in the very first line of code. The default value is 10.0 and that means 10%. So enter whatever whole value percent change you want and the code does the math accordingly.
Here is the code. I have not tested this.
input percentVolumeIncrease = 10.0;
def twoHigherCloses = close[2] < close[1] and close[1] < close; def twoUpCandles = close[1] > open[1] and close > open;
def bodyRange = close - open;
def doubleSize = bodyRange > bodyRange[1] * 2;
def volumeIncrease = volume > volume[1] * (1 + (percentVolumeIncrease * 0.01));
plot scan = twoHigherCloses and twoUpCandles and doubleSize and volumeIncrease;