Scanning for when RSI is greater than FilterL

dugafish

New member
I am trying to create a scan (using a Mobius custom indicator called FilterL) that selects for when RSI (any length but I use 9) is greater than FilterL however the scan function doesnt seem to be able to calculate FilterL even though as an indicator it works perfectly in my charts. Any suggestions for how I can the scan function to recognize this custom variable?

#RSI with Laguerre Filter applied at 6 period length
# Mobius
# V02.2012
# Modulation self adjusting with RSI volatility range

declare lower;
input RSIrr = .01;
input length = 6;
input over_Bought = 80;
input over_Sold = 20;
input price = close;
input ZERO_LINE = 50;

def o = open;
def h = high;
def l = low;
def c = close;
def NetChgAvg = WildersAverage(price - price[1], length);
def TotChgAvg = WildersAverage(AbsValue(price - price[1]), length);
def ChgRatio = if TotChgAvg != 0 then NetChgAvg / TotChgAvg else 0;

plot RSI = 50 * (ChgRatio + 1);
RSI.SetDefaultColor(Color.Yellow);
plot OverSold = over_Sold;
plot OverBought = over_Bought;
plot ZEROLINE=ZERO_LINE;


OverSold.SetDefaultColor(GetColor(8));
OverBought.SetDefaultColor(GetColor(8));
def RSIh = highest(RSI, length);
def RSIl = lowest(RSI, length);
def RSIr = RSIrr * Average(RSIh - RSIl, length);
def gamma = if RSIr > .9
then .9
else if RSIr < .2
then .2
else gamma[1];
def bar = barNumber();
def L0 = ((1 - gamma) * RSI) + (gamma * L0[1]);
def L1 = (-gamma * L0) + L0[1] + (gamma * L1[1]);
def L2 = (-gamma * L1) + L1[1] + (gamma * L2[1]);
def L3 = (-gamma * L2) + L2[1] + (gamma * L3[1]);
def L4 = (-gamma * L3) + L3[1] + (gamma * L4[1]);
def L5 = (-gamma * L4) + L4[1] + (gamma * L5[1]);
def Laguerre = (L0 + (2 * L1) + (2 * L2) + L3 + L4 + L5) / 8;

plot FilterL = Laguerre;
FilterL.SetDefaultColor(Color.Cyan);


def condUp = if RSI crosses above FilterL
then 1
else if RSI > RSI[1]
then condUp[1] + 1
else if RSI < FilterL
then 0
else condUp[1];
def condDw = if RSI crosses below FilterL
then 1
else if RSI < RSI[1]
then condDw[1] + 1
else if RSI > FilterL
then 0
else condDw[1];
def CrossUp = RSI crosses above FilterL && FilterL > 50;
def Crossdown = RSI crosses below FilterL && FilterL < 50;
plot condDW1 =CrossUp;
plot condUP1 = Crossdown;
plot confirmUP = filterL crosses above 50;
plot confirmDOWN = filterL crosses below 50;
addCloud(rsi, filterl, Color.GREEN, Color.RED);


# End Code RSI with Laguerre Filter
 
Solution
I am trying to create a scan (using a Mobius custom indicator called FilterL) that selects for when RSI (any length but I use 9) is greater than FilterL however the scan function doesnt seem to be able to calculate FilterL even though as an indicator it works perfectly in my charts. Any suggestions for how I can the scan function to recognize this custom variable?
A few problems.
  • There were several lines of excess non-necessary code. The RSI Laguerre is resource-intensive those extra lines put it over the edge.
  • Your logic doesn't work. You can scan for RSI crosses of FilterL or you can scan for FilterL crosses of 50 but you cannot scan for:
    • RSI crosses above FilterL AND for FilterL to be above 50. It...
I am trying to create a scan (using a Mobius custom indicator called FilterL) that selects for when RSI (any length but I use 9) is greater than FilterL however the scan function doesnt seem to be able to calculate FilterL even though as an indicator it works perfectly in my charts. Any suggestions for how I can the scan function to recognize this custom variable?
A few problems.
  • There were several lines of excess non-necessary code. The RSI Laguerre is resource-intensive those extra lines put it over the edge.
  • Your logic doesn't work. You can scan for RSI crosses of FilterL or you can scan for FilterL crosses of 50 but you cannot scan for:
    • RSI crosses above FilterL AND for FilterL to be above 50. It will seldom occur as you can see from the below chart. there were no crosses happening over 50 because over 50 the trend is already established.
    • Here is one possibility, CHANGE:
      • from yours: plot CrossUp = RSI crosses above FilterL && FilterL > 50 ;
      • to: plot CrossUp = RSI crosses above FilterL && FilterL < 50 ;
    • Another choice is CHANGE:
      • from yours: plot CrossUp = RSI crosses above FilterL && FilterL > 50 ;
      • to: plot CrossUp = FilterL crosses above 50 && RSI > FilterL ;
Where to go from here?
The above changes are just suggestions. Think about what you are looking to do and play with your definition of CrossUp and CrossDown.
Plug different definitions into the strategy and see how it affects your trades.

Keep in mind, that no one indicator can be used in isolation.
You would benefit from looking at multiple time frames and the addition of at least one other non-collinear indicator.
Read more:
https://usethinkscript.com/threads/how-to-read-an-oscillator-in-thinkorswim.11497/#post-99858
https://usethinkscript.com/threads/...nt-to-successful-trading-in-thinkorswim.6114/

Here is a shared chart link with the cleaned up versions of your scripts to get you started: http://tos.mx/frLcxP0 Click here for --> Easiest way to load shared links
mI7rsED.png


Now some bad news. Even with cleaning up the code, the RSI Laquerre is resource intensive. The only way to get it to run in the scan hacker is to stuff the whole thing into it. You can only have one plot. So replace your last line with your CrossUp or your Crossdown calculation. They have to be separate scans.
Here is a shared scanner link: http://tos.mx/LyUZgC2 Click here for --> Easiest way to load shared links
Xk1oxaX.png


To contribute back to the community, keep posting about your experiences with this study. It seems to have potential.
 
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
516 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