Thomas Thornton Indicator

Patshan

New member
VIP
I recently saw Tom Thornton on Bloomberg. In it, he showed an indicator with a 20 period ma crossing a 50 day ma. Being a visual person, I believe the indicator would be very helpful in my trading. I am enclosing a picture of it. Does anyone know if it exists in TOS? I spent many years at Tradestation and learned rudimentary coding. I have not done that here. I believe it would be helpful in any time frame. Any help is greatly appreciated.
  • edited by moderator. media content blocked. Contained commercial content prohibited by Forum's terms & guidelines
 
Last edited by a moderator:
@Patshan Your solution is in post # 2. @skaboy Your solution is correct only on a daily chart for what was requested in post # 1.
What I have said is what it is.
Clearly, the original Chart has two frames, upper and lower.
Plot the same as I have mentioned, one as upper and one as lower.
You will get exactly what Bloomberg has.

To make it easier, combine the MovingAverageTwoLines into one plot, edit as necessary (to remove duplication of the 1 avg line), Then Save one as Upper, and one as Lower( by adding decaler upper, declare lower)
Add color fills.
That is all.
 
@Patshan Your solution is in post # 2. @skaboy Your solution is correct only on a daily chart for what was requested in post # 1.
I just spent a couple of hours trying to get an indicator using the macrossover mentioned in #2. could not get the indicator to plot gray when 20 over 50 and red when 20 below 50. I did the entire tutorial on thinkscript and was a bit overwhelmed and also failed. I believe it is in the look and feel portion but I can not incorporate this with the crossover. I'm trying to learn to fish but am only baiting the hook.
Thanks again,
Steve
 
I just spent a couple of hours trying to get an indicator using the macrossover mentioned in #2. could not get the indicator to plot gray when 20 over 50 and red when 20 below 50. I did the entire tutorial on thinkscript and was a bit overwhelmed and also failed. I believe it is in the look and feel portion but I can not incorporate this with the crossover. I'm trying to learn to fish but am only baiting the hook.
Thanks again,
Steve
Use AddCloud(,)
 
@Patshan People have stated before to be precise in a request for a code. This may be a good example. A method was given to answer the request of "he showed an indicator with a 20 period ma crossing a 50 day ma." A few other methods were given which might be correct for what they do but they did not answer the first request and did not represent the indicator of Tom Thornton. I had curiosity about it and looked further into it.
So I believe this is the indicator described by Thornton. The % diff from the 50 SMA overlaid with a 20 sma of the % diff. Just for kicks I added a deviation for the whole of whatever chart you put it on.
Code:
declare lower;

input length = 50;
input averageType = AverageType. SIMPLE;

def avg = MovingAverage(averageType, close, length);

plot percent = ((close - avg) / close) * 100;

input lengthavg = 20;
plot percentavg = MovingAverage(averageType,percent,lengthavg);

AddCloud(if percentavg < percent then percentavg else Double.NaN, percent, Color.GREEN, Color.GREEN);
AddCloud(if percentavg > percent then percentavg else Double.NaN, percent, Color.RED, Color.RED);

plot zeroline = 0;
zeroline.setDefaultColor(color.white);

plot overbought = absValue(stdevAll(percent));
overbought.setDefaultColor(color.red);

plot oversold = -absValue(stdevAll(percent));
oversold.setDefaultColor(color.red);
 
@Patshan People have stated before to be precise in a request for a code. This may be a good example. A method was given to answer the request of "he showed an indicator with a 20 period ma crossing a 50 day ma." A few other methods were given which might be correct for what they do but they did not answer the first request and did not represent the indicator of Tom Thornton. I had curiosity about it and looked further into it.
So I believe this is the indicator described by Thornton. The % diff from the 50 SMA overlaid with a 20 sma of the % diff. Just for kicks I added a deviation for the whole of whatever chart you put it on.
Code:
declare lower;

input length = 50;
input averageType = AverageType. SIMPLE;

def avg = MovingAverage(averageType, close, length);

plot percent = ((close - avg) / close) * 100;

input lengthavg = 20;
plot percentavg = MovingAverage(averageType,percent,lengthavg);

AddCloud(if percentavg < percent then percentavg else Double.NaN, percent, Color.GREEN, Color.GREEN);
AddCloud(if percentavg > percent then percentavg else Double.NaN, percent, Color.RED, Color.RED);

plot zeroline = 0;
zeroline.setDefaultColor(color.white);

plot overbought = absValue(stdevAll(percent));
overbought.setDefaultColor(color.red);

plot oversold = -absValue(stdevAll(percent));
oversold.setDefaultColor(color.red);

Thank you very much Horserider. This is exactly as shown on Thornton. The overbought/oversold set to a Standard Deviation is a beautiful thing. How would I go about setting the over/under to a 2% standard deviation?
 
@Patshan People have stated before to be precise in a request for a code. This may be a good example. A method was given to answer the request of "he showed an indicator with a 20 period ma crossing a 50 day ma." A few other methods were given which might be correct for what they do but they did not answer the first request and did not represent the indicator of Tom Thornton. I had curiosity about it and looked further into it.
So I believe this is the indicator described by Thornton. The % diff from the 50 SMA overlaid with a 20 sma of the % diff. Just for kicks I added a deviation for the whole of whatever chart you put it on.
Code:
declare lower;

input length = 50;
input averageType = AverageType. SIMPLE;

def avg = MovingAverage(averageType, close, length);

plot percent = ((close - avg) / close) * 100;

input lengthavg = 20;
plot percentavg = MovingAverage(averageType,percent,lengthavg);

AddCloud(if percentavg < percent then percentavg else Double.NaN, percent, Color.GREEN, Color.GREEN);
AddCloud(if percentavg > percent then percentavg else Double.NaN, percent, Color.RED, Color.RED);

plot zeroline = 0;
zeroline.setDefaultColor(color.white);

plot overbought = absValue(stdevAll(percent));
overbought.setDefaultColor(color.red);

plot oversold = -absValue(stdevAll(percent));
oversold.setDefaultColor(color.red);
hello, thank you for sharing this great indicator with us. question can someone help me to add a price color to this indicator, example: if is a bullish cross to paint the candles green and if is a bearish cross to paint the candles red. also if is possible to add the scan. thank you in advance
 
hello, thank you for sharing this great indicator with us. question can someone help me to add a price color to this indicator, example: if is a bullish cross to paint the candles green and if is a bearish cross to paint the candles red. also if is possible to add the scan. thank you in advance
It is not clear what you are asking for. How are you defining bullish cross and bearish cross?

Sounds like something you may have to post a picture of to explain what you are trying to accomplish along with a more detailed explanation.
Unsure of how to upload screenshots to the forum, Here are directions.
 

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