Moving Average Convergence Indicator For ThinkOrSwim

Angry

New member
I am looking for a scan that will tell me when the:

SMA 7
SMA 10
SMA 20
SMA 35
Hull 8

....are all within a $ 0.15 area on a one minute chart. I have searched high and low on UTS and cannot find it. How difficult is it to learn to make this scan query ? Thank you for reading my post.
 
I am looking for a scan that will tell me when the:

SMA 7
SMA 10
SMA 20
SMA 35
Hull 8

....are all within a $ 0.15 area on a one minute chart. I have searched high and low on UTS and cannot find it. How difficult is it to learn to make this scan query ? Thank you for reading my post.

here is an upper study, that might work as a scan when the last part is deleted

Code:
# ..AverageTypes..
# EXPONENTIAL
# HULL
# SIMPLE
# WEIGHTED
# WILDERS


# SMA 7
# SMA 10
# SMA 20
# SMA 35
# Hull 8

input range = 0.15;
def price = close;

input MA1_len = 7;
input MA1_type =  AverageType.simple;
def ma1 = MovingAverage(ma1_type, price, ma1_len);

input MA2_len = 10;
input MA2_type =  AverageType.simple;
def ma2 = MovingAverage(ma2_type, price, ma2_len);

input MA3_len = 20;
input MA3_type =  AverageType.simple;
def ma3 = MovingAverage(ma3_type, price, ma3_len);

input MA4_len = 35;
input MA4_type =  AverageType.simple;
def ma4 = MovingAverage(ma4_type, price, ma4_len);

input MA5_len = 8;
input MA5_type =  AverageType.hull;
def ma5 = MovingAverage(ma5_type, price, ma5_len);

#------------------------------------------

def minx = min(ma1,min(ma2,min(ma3,min(ma4,ma5))));
def maxx = max(ma1,max(ma2,max(ma3,max(ma4,ma5))));

def sqz = if ((maxx - minx) <= range) then 1 else 0;


# ---------------------------------

plot s = sqz;

# delete code after this line. use above code for a scan

s.SetPaintingStrategy(PaintingStrategy.boolean_ARROW_UP);
s.setdefaultcolor(color.cyan);
s.hidebubble();

# -----------------------------------------------------

input show_lines = yes;
#x.SetHiding(!show_lines);

plot z1 = ma1;
z1.setdefaultcolor(color.cyan);
z1.hidebubble();
z1.SetHiding(!show_lines);

plot z2 = ma2;
z2.setdefaultcolor(color.cyan);
z2.hidebubble();
z2.SetHiding(!show_lines);

plot z3 = ma3;
z3.setdefaultcolor(color.cyan);
z3.hidebubble();
z3.SetHiding(!show_lines);

plot z4 = ma4;
z4.setdefaultcolor(color.cyan);
z4.hidebubble();
z4.SetHiding(!show_lines);

plot z5 = ma5;
z5.setdefaultcolor(color.cyan);
z5.hidebubble();
z5.SetHiding(!show_lines);

#
 
Last edited:
Thank you, @halcyonguy. I will play around with this today and will report back. Thank you again as this is a HUGE help to me. When I copy/paste the code for the scanner it says, " At least one plot should be defined" and will not allow me to use the scan. Ideas ?
 
Last edited:
Thank you, @halcyonguy. I will play around with this today and will report back. Thank you again as this is a HUGE help to me. When I copy/paste the code for the scanner it says, " At least one plot should be defined" and will not allow me to use the scan. Ideas ?
add this to the bottom of your script:
Code:
plot s = sqz;
 
Thank you, @halcyonguy. I will play around with this today and will report back. Thank you again as this is a HUGE help to me. When I copy/paste the code for the scanner it says, " At least one plot should be defined" and will not allow me to use the scan. Ideas ?

sorry, i should have listed an upper and a scan study separetely.

the instructions and plot are in the original. when you copied the code, you accidently deleted the plot line.
thanks merryday
 
input range = 0.15;
def price = close;

input MA1_len = 20;
input MA1_type = AverageType.simple;
def ma1 = MovingAverage(ma1_type, price, ma1_len);

input MA2_len = 50;
input MA2_type = AverageType.simple;
def ma2 = MovingAverage(ma2_type, price, ma2_len);

input MA3_len = 200;
input MA3_type = AverageType.simple;
def ma3 = MovingAverage(ma3_type, price, ma3_len);

#------------------------------------------

def minx = min(ma1,min(ma2,min(ma3,min)));
def maxx = max(ma1,max(ma2,max(ma3,max)));

def sqz = if ((maxx - minx) <= range) then 1 else 0;


# ---------------------------------

plot s = sqz;

wanted to see convergence for 20, 50, and 200 , i tried this scan, getting an error on 1936
 

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
115 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