 # Boolean Arrows as PaintingStrategy

#### dinodotcom

##### Member
2019 Donor
I am wondering if there is someone out there that can help me do a scan for any study that uses Boolean arrows. I have a few studies that will indicate Boolean arrows that I would like to run scans to see if the arrows are present. I am looking for the generic think script code that I can use. Any help is much appreciated.

The code below has "BOOLEAN_ARROW_UP" and "BOOLEAN_ARROW_DOWN"

Code:
``````input length = 14;
input crossingType = {default above, below};
input threshold = 20;
input averageType = AverageType.WILDERS;

plot signal = crosses(DMI(length, averageType).ADX, threshold, crossingType == CrossingType.above);

signal.DefineColor("Above", GetColor(0));
signal.DefineColor("Below", GetColor(1));
signal.AssignValueColor(if crossingType == CrossingType.above then signal.color("Above") else signal.color("Below"));

signal.SetPaintingStrategy(if crossingType == CrossingType.above
then PaintingStrategy.BOOLEAN_ARROW_UP
else PaintingStrategy.BOOLEAN_ARROW_DOWN);``````

How do I put that into a scanner?

#### markos

##### Well-known member
VIP
In your ThinkorSwim scanner, set the "signal" plot to true. #### dodoei

##### New member
If I have def N=A>B+B>C+C>D how do I convert the result to 3, that is if all three comparisons are true, N will be 3? Thanks!

#### tomsk

##### Well-known member
VIP
Define three conditions and them sum them. If all true, then the value 3 will be returned.

def cond1 = A > B;
def cond2 = B > C;
def cond3 = C > D;

def result = cond1 + cond2 + cond3;

#### dodoei

##### New member
Define three conditions and them sum them. If all true, then the value 3 will be returned.

def cond1 = A > B;
def cond2 = B > C;
def cond3 = C > D;

def result = cond1 + cond2 + cond3;
Thanks a lot! What I plan to do is to rank 4 to 5 variables, there seems no easy way or function to do it except to compare them one by one. So in this case I guess I would need to def all 30 cond? Thanks again!

#### tomsk

##### Well-known member
VIP
Thanks a lot! What I plan to do is to rank 4 to 5 variables, there seems no easy way or function to do it except to compare them one by one. So in this case I guess I would need to def all 30 cond? Thanks again!

I have in the past been asked how to compare the lowest and highest of 3 variables.
Here's one way to do so

def lowest = min(a, min(b,c));
def highest = max(a, max(b,c));

So with 5 variables in your case you can adopt a similar nested approach although that would get rather complex pretty quick

#### dodoei

##### New member
By the way, I found in addchartbubble, I can not use the current value for the price location, for example, Data, I have to use Data
I have in the past been asked how to compare the lowest and highest of 3 variables.
Here's one way to do so

def lowest = min(a, min(b,c));
def highest = max(a, max(b,c));

So with 5 variables in your case you can adopt a similar nested approach although that would get rather complex pretty quick
Thanks!

#### danwilks12

##### New member
New to ThinkScript so I already know this is a dumb question but is it possible to get rid of the extra boolean arrows? 