AGAIG Stochastics Label

csricksdds

Trader Educator
VIP
As an individual who does not like lower indicators, or charts with too much activity, I like my BestTradingChartSetup with some easily visible upper labels indicating possible changes taking place. Merry Day lists Stochastics as number five on her list of indicators and so I have put together the following STOCHASTIC LABEL to let me know Overbought/Oversold conditions.

The code follows:
Ruby:
#Thanks to RG (?) for basic indicator outline
#Revamped by C. Ricks to show as upper label only
#Note: Label will show Yellow in mid zone and say "Stochastic" - Then Label will turn RED if Stochastic Overbought and Green if Stochastic Oversold

input KPeriod = 14;
input DPeriod = 3;
input price = close;

def lowestLow = Lowest(low, KPeriod);
def highestHigh = Highest(high, KPeriod);
def FastK = if highestHigh != lowestLow then (close - lowestLow) / (highestHigh - lowestLow) * 100 else 0;

def SlowK = Average(FastK, DPeriod);
def SlowD = Average(SlowK, DPeriod);

def overbought = SlowK > 80;
def oversold = SlowK < 20;

AddLabel(yes, "Stochastics" + "" +
if overbought then " (Over Bought) " else if oversold then " (Over Sold) " else "",
if overbought then Color.RED else if oversold then Color.GREEN else Color.Yellow);

#End Code
 
Last edited by a moderator:
Solution
As an individual who does not like lower indicators, or charts with too much activity, I like my BestTradingChartSetup with some easily visible upper labels indicating possible changes taking place. Merry Day lists Stochastics as number five on her list of indicators and so I have put together the following STOCHASTIC LABEL to let me know Overbought/Oversold conditions.

The code follows:
Ruby:
#Thanks to RG (?) for basic indicator outline
#Revamped by C. Ricks to show as upper label only
#Note: Label will show Yellow in mid zone and say "Stochastic" - Then Label will turn RED if Stochastic Overbought and Green if Stochastic Oversold

input KPeriod = 14;
input DPeriod = 3;
input price = close;

def lowestLow =...
FYI:
1. Keep in mind that most oscillators are collinear, meaning most measure the same thing.
So the list only shows that some oscillators have a SLIGHT edge over others.

2. Oscillators have issues, as seen here:
https://usethinkscript.com/threads/how-to-read-an-oscillator-in-thinkorswim.11497/
Oscillators have value when used CORRECTLY!
The oscillators on the list were tested with detailed specifications to maximize profitability.

For example, the Stochastics oscillator on the list was refined by volume and a moving average to use as a signal line.

3. The list was found to be the best of the best oscillators when tested on a DAILY chart.
Oscillators look for the cyclical pattern of price movements, which are measured best on higher timeframes.
The use of oscillators on lower timeframes can result in false signals and whipsaws, as the overall trend can be difficult to identify on these smaller aggregations.

Hope this helps.
Feedback is always helpful - I always use multiples for any trades made.
 
As an individual who does not like lower indicators, or charts with too much activity, I like my BestTradingChartSetup with some easily visible upper labels indicating possible changes taking place. Merry Day lists Stochastics as number five on her list of indicators and so I have put together the following STOCHASTIC LABEL to let me know Overbought/Oversold conditions.

The code follows:
Ruby:
#Thanks to RG (?) for basic indicator outline
#Revamped by C. Ricks to show as upper label only
#Note: Label will show Yellow in mid zone and say "Stochastic" - Then Label will turn RED if Stochastic Overbought and Green if Stochastic Oversold

input KPeriod = 14;
input DPeriod = 3;
input price = close;

def lowestLow = Lowest(low, KPeriod);
def highestHigh = Highest(high, KPeriod);
def FastK = if highestHigh != lowestLow then (close - lowestLow) / (highestHigh - lowestLow) * 100 else 0;

def SlowK = Average(FastK, DPeriod);
def SlowD = Average(SlowK, DPeriod);

def overbought = SlowK > 80;
def oversold = SlowK < 20;

AddLabel(yes, "Stochastics" + "" +
if overbought then " (Over Bought) " else if oversold then " (Over Sold) " else "",
if overbought then Color.RED else if oversold then Color.GREEN else Color.Yellow);

#End Code
FYI:
1. Keep in mind that most oscillators are collinear, meaning most measure the same thing.
So the list only shows that some oscillators have a SLIGHT edge over others.

2. Oscillators have issues, as seen here:
https://usethinkscript.com/threads/how-to-read-an-oscillator-in-thinkorswim.11497/
Oscillators have value when used CORRECTLY!
The oscillators on the list were tested with detailed specifications to maximize profitability.
So, it is very important to click on the link below the list, to see how to modify the oscillator to use it correctly!
If you click on the link, you will see that you are not utilizing the Stochastic indicator properly.
For the Stochastic to be profitable, it used a 20-day lookback and was refined by volume and have an added moving average to use as a signal line.

3. The list found that these oscillators were profitable when tested on a DAILY chart.
Oscillators look for the cyclical pattern of price movements, which are measured best on higher timeframes.
The use of oscillators on lower timeframes can result in false signals and whipsaws, as the overall trend can be difficult to identify on these smaller aggregations.

Hope this helps.
 
Last edited by a moderator:
Solution

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

Thread starter Similar threads Forum Replies Date
S McClellan Sum.Index Stochastics RSI Questions 1
G Overlaid Stochastics Questions 5
M Stochastics on the chart Questions 2
B Need RVOL Label Questions 0
M Help with this label Questions 2

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
200 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