Is there a way to turn custom scanning filters into an indicator?

A

amcno03

New member
Greets everyone!
I have the following filters in the scan tab:
1) Close is greater than SimpleMovingAvg(). "SMA".
2) Close crosses below SimpleMovingAvg ("length" = 5). "SMA"

The length in #1 is 9.



In this image chart the requirements are met. I would like to know if there's a way to create an indicator with a boolean option to plot arrows every time the requirements in a certain chart are met.



Thanks in advance for your help.
ps: English is not my mother tongue; please excuse any errors on my part.

Best regards!
 
Last edited by a moderator:
BenTen

BenTen

Administrative
Staff
VIP
Here you go:



Code:
#
# TD Ameritrade IP Company, Inc. (c) 2017-2019
# Modified by BenTen at useThinkScript.com

input price = close;
input length = 9;
input length2 = 5;
input displace = 0;

plot SMA = Average(price[-displace], length);
plot SMA2 = Average(price[-displace], length2);

def cond1 = close > SMA;
def cond2 = close crosses below SMA2;

plot signal = cond1 and cond2;
signal.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_UP);
signal.SetDefaultColor(Color.CYAN);
signal.SetLineWeight(1);

SMA.SetDefaultColor(GetColor(1));
SMA2.SetDefaultColor(GetColor(0));
 

Similar threads

Top