Adding crossover arrows to Super Passband Filter

mkhaddou

New member
Hello everyone, I'm testing the built-in Super Passband filter in TOS and wanted to know if there is a way to plot down arrows when SuperPassbandFilter line crosses below +RMS and up arrows when SuperPassbandFilter line crosses over -RMS.

See attached screen!

Also, is there a way to build stock scanner for that please!

#
# TD Ameritrade IP Company, Inc. (c) 2016-2022
#

declare lower;

input length1 = 40;
input length2 = 60;

Assert(length1 >= 3, "'length1' must be greater than or equal to 3: " + length1);
Assert(length2 > length1, "'length2' must be greater than 'length1': " + length2);

def a1 = 5 / length1;
def a2 = 5 / length2;
def PB = (a1 - a2) * close + (a2 * (1 - a1) - a1 * (1 - a2)) * close[1] + ((1 - a1) + (1 - a2)) * PB[1] - (1 - a1) * (1 - a2) * PB[2];
def RMS = Sqrt(Average(Sqr(PB), 50));

plot SuperPassbandFilter = PB;
plot "+RMS" = RMS;
plot "-RMS" = -RMS;
plot ZeroLine = 0;

SuperPassbandFilter.SetDefaultColor(GetColor(5));
"+RMS".SetDefaultColor(GetColor(4));
"-RMS".SetDefaultColor(GetColor(4));
ZeroLine.SetDefaultColor(GetColor(7));
 

Attachments

  • Screenshot 2022-08-07 100223.png
    Screenshot 2022-08-07 100223.png
    214.5 KB · Views: 217
Solution
Hello everyone, I'm testing the built-in Super Passband filter in TOS and wanted to know if there is a way to plot down arrows when SuperPassbandFilter line crosses below +RMS and up arrows when SuperPassbandFilter line crosses over -RMS.

See attached screen!

Also, is there a way to build stock scanner for that please!

#
# TD Ameritrade IP Company, Inc. (c) 2016-2022
#

declare lower;

input length1 = 40;
input length2 = 60;

Assert(length1 >= 3, "'length1' must be greater than or equal to 3: " + length1);
Assert(length2 > length1, "'length2' must be greater than 'length1': " + length2);

def a1 = 5 / length1;
def a2 = 5 / length2;
def PB = (a1 - a2) * close + (a2 * (1 - a1) - a1 * (1 - a2)) * close[1] + ((1 - a1) + (1 - a2)) *...
Hello everyone, I'm testing the built-in Super Passband filter in TOS and wanted to know if there is a way to plot down arrows when SuperPassbandFilter line crosses below +RMS and up arrows when SuperPassbandFilter line crosses over -RMS.

See attached screen!

Also, is there a way to build stock scanner for that please!

#
# TD Ameritrade IP Company, Inc. (c) 2016-2022
#

declare lower;

input length1 = 40;
input length2 = 60;

Assert(length1 >= 3, "'length1' must be greater than or equal to 3: " + length1);
Assert(length2 > length1, "'length2' must be greater than 'length1': " + length2);

def a1 = 5 / length1;
def a2 = 5 / length2;
def PB = (a1 - a2) * close + (a2 * (1 - a1) - a1 * (1 - a2)) * close[1] + ((1 - a1) + (1 - a2)) * PB[1] - (1 - a1) * (1 - a2) * PB[2];
def RMS = Sqrt(Average(Sqr(PB), 50));

plot SuperPassbandFilter = PB;
plot "+RMS" = RMS;
plot "-RMS" = -RMS;
plot ZeroLine = 0;

SuperPassbandFilter.SetDefaultColor(GetColor(5));
"+RMS".SetDefaultColor(GetColor(4));
"-RMS".SetDefaultColor(GetColor(4));
ZeroLine.SetDefaultColor(GetColor(7));

Try this

Capture.jpg
Ruby:
#
# TD Ameritrade IP Company, Inc. (c) 2016-2022
#

declare lower;

input length1 = 40;
input length2 = 60;

Assert(length1 >= 3, "'length1' must be greater than or equal to 3: " + length1);
Assert(length2 > length1, "'length2' must be greater than 'length1': " + length2);

def a1 = 5 / length1;
def a2 = 5 / length2;
def PB = (a1 - a2) * close + (a2 * (1 - a1) - a1 * (1 - a2)) * close[1] + ((1 - a1) + (1 - a2)) * PB[1] - (1 - a1) * (1 - a2) * PB[2];
def RMS = Sqrt(Average(Sqr(PB), 50));

plot SuperPassbandFilter = PB;
plot "+RMS" = RMS;
plot "-RMS" = -RMS;
plot ZeroLine = 0;

SuperPassbandFilter.SetDefaultColor(GetColor(5));
"+RMS".SetDefaultColor(GetColor(4));
"-RMS".SetDefaultColor(GetColor(4));
ZeroLine.SetDefaultColor(GetColor(7));

plot arrowdown = if SuperPassbandFilter crosses below RMS then PB else Double.NaN;
arrowdown.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
arrowdown.SetLineWeight(5);
plot arrowup   = if SuperPassbandFilter crosses above -RMS then PB else Double.NaN;
arrowup.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
arrowup.SetLineWeight(5);
 
Solution

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
170 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top