That code you provided contains some methods which I advise people to avoid. So I do want to take some time to explain this. Please don't take offense. I just want to make sure that folks who are just learning how to write code do not pick up bad habits which will diminish their future success.
The first mistake to avoid is using variable names with single characters. This sort of thing makes it very difficult to modify and maintain large sections of code. Here is what I want the newbies to avoid:
def O = open;
def H = high;
There is no need to do that and it will only make the code more difficult to read and more challenging to update and maintain in the future. Just use 'open', 'high', 'low', 'close' and 'volume' directly. Like this:
volume * (close - low) / (high - low)
The only reason you would ever want to create a separate variable for one of these price types is if you were creating a custom price type, for example the Hieken-Ashi.
The other item I want the newbies to avoid is the pattern of not including spaces between the variable names and the operators. So here is an example of what I want the newbies to avoid doing:
V*(C-L)/(H-L)
If you use that in a large section of code and need to make changes in the future it will be a nightmare. The best way to write that statement is the example I provided above.
Variable names should fully describe their function and purpose within the code. And camelCase should be used, unless you prefer to use underscore_case. In both methods the first character of each variable should be lower case.
Ok, now that we have that out of the way we can get to the solution. Your plot scan statement was just backwards. You had them reversed and the scan was returning results for the exact opposite of what you intended. So that was a pretty easy fix. You also asked for two additional signals which you were not able to figure out. For that, I created a new variable for "sellingPreassurePercent", which I then used to create those other two scan signals.
Here is the full solution (please note I have made several changes to get this code to conform to the most recommended format):
input percentThreshold = 30.0;
def buyingPreassure = volume * (close - low) / (high - low);
def sellingPreassure = volume * (high - close) / (high - low);
def totalVolume = buyingPreassure + sellingPreassure;
def buyingPreassurePercent = buyingPreassure / totalVolume * 100;
def sellingPreassurePercent = sellingPreassure / totalVolume * 100;
# use this to scan for buying preassure greater than percent threshold
plot scan = buyingPreassurePercent >= percentThreshold;
# use this to scan selling preassure greater than percent threshold
# plot scan = sellingPreassurePercent >= percentThreshold;
# use this to scan for buying preassure greater than selling preassure
# plot scan = buyingPreassure > sellingPreassure;
# use this to scan for selling preassure greater than buying preassure