Stochastic Watchlist, Scan, Alert, Arrows & Other For ThinkOrSwim

Looking for someone to add crossover arrows to the StochasticMomemtumIndex please. Thank you.

This allows an input option to show crossover arrows.

Ruby:
#
# TD Ameritrade IP Company, Inc. (c) 2008-2022
#

declare lower;

input crossover_arrows = yes;
input over_bought = 40.0;
input over_sold = -40.0;
input percentDLength = 3;
input percentKLength = 5;

def min_low = Lowest(low, percentKLength);
def max_high = Highest(high, percentKLength);
def rel_diff = close - (max_high + min_low) / 2;
def diff = max_high - min_low;

def avgrel = ExpAverage(ExpAverage(rel_diff, percentDLength), percentDLength);
def avgdiff = ExpAverage(ExpAverage(diff, percentDLength), percentDLength);

plot SMI = if avgdiff != 0 then avgrel / (avgdiff / 2) * 100 else 0;
SMI.SetDefaultColor(GetColor(1));

plot AvgSMI = ExpAverage(SMI, percentDLength);
AvgSMI.SetDefaultColor(GetColor(5));

plot overbought = over_bought;
overbought.SetDefaultColor(GetColor(5));

plot oversold = over_sold;
oversold.SetDefaultColor(GetColor(5));

#Arrows
plot uparrow = if !crossover_arrows then Double.NaN       
               else if SMI crosses above AvgSMI
               then SMI
               else Double.NaN;
uparrow.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
uparrow.SetLineWeight(3);
uparrow.SetDefaultColor(GetColor(1));

plot dnarrow = if !crossover_arrows then Double.NaN       
               else if SMI crosses below AvgSMI
               then SMI
               else Double.NaN;
dnarrow.SetPaintingStrategy(PaintingStrategy.ARROW_DoWN);
dnarrow.SetLineWeight(3);
dnarrow.SetDefaultColor(GetColor(5));
 
I am looking for Arrows for buy and sell signals when there is a cross in the up or down move on the Stochastic Slow. Very much appreciate. Thank you.
 
Last edited:
I am looking for Arrows for buy and sell signals when there is a cross in the up or down move on the Stochastic Slow. Very much appreciate. Thank you.
Not sure what you are asking, the ToS Stochastic slow already has buy / sell signals. Perhaps you didn't turn on signals in settings:
hi0UmSY.png
 
Last edited:
I was provided the below script graciously from SleepyZ. I am trying to have it to only provide StochasticMomenutemIndex crossover arrow as an entry and MACD crossover arrow as an exit for both directions in my trades. To be displayed in the Candle chart area as entries and exits. I hope this makes sense. Can someone help created the script for me, I still am not good enough to even figure this out. I appreciate your time and efforts. Thank you. Not sure if the below script will help since this displays below the chart. Thank you.

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

declare lower;

input crossover_arrows = yes;
input over_bought = 40.0;
input over_sold = -40.0;
input percentDLength = 3;
input percentKLength = 5;

def min_low = Lowest(low, percentKLength);
def max_high = Highest(high, percentKLength);
def rel_diff = close - (max_high + min_low) / 2;
def diff = max_high - min_low;

def avgrel = ExpAverage(ExpAverage(rel_diff, percentDLength), percentDLength);
def avgdiff = ExpAverage(ExpAverage(diff, percentDLength), percentDLength);

plot SMI = if avgdiff != 0 then avgrel / (avgdiff / 2) * 100 else 0;
SMI.SetDefaultColor(GetColor(1));

plot AvgSMI = ExpAverage(SMI, percentDLength);
AvgSMI.SetDefaultColor(GetColor(5));

plot overbought = over_bought;
overbought.SetDefaultColor(GetColor(5));

plot oversold = over_sold;
oversold.SetDefaultColor(GetColor(5));

#Arrows
plot uparrow = if !crossover_arrows then Double.NaN
else if SMI crosses above AvgSMI
then SMI
else Double.NaN;
uparrow.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
uparrow.SetLineWeight(3);
uparrow.SetDefaultColor(GetColor(1));

plot dnarrow = if !crossover_arrows then Double.NaN
else if SMI crosses below AvgSMI
then SMI
else Double.NaN;
dnarrow.SetPaintingStrategy(PaintingStrategy.ARROW_DoWN);
dnarrow.SetLineWeight(3);
dnarrow.SetDefaultColor(GetColor(5));
 
Not sure on the MACD what you were intending to crossover: This will get you started.
Code:
#
# TD Ameritrade IP Company, Inc. (c) 2008-2022
#


input SMI_crossover_arrows = yes;
input MACD_crossover_arrows = yes;
input over_bought = 40.0;
input over_sold = -40.0;
input percentDLength = 3;
input percentKLength = 5;

def min_low = Lowest(low, percentKLength);
def max_high = Highest(high, percentKLength);
def rel_diff = close - (max_high + min_low) / 2;
def diff = max_high - min_low;

def avgrel = ExpAverage(ExpAverage(rel_diff, percentDLength), percentDLength);
def avgdiff = ExpAverage(ExpAverage(diff, percentDLength), percentDLength);

def SMI = if avgdiff != 0 then avgrel / (avgdiff / 2) * 100 else 0;


def AvgSMI = ExpAverage(SMI, percentDLength);



input fastLength = 12;
input slowLength = 26;
input macdLength = 9;
input averageType = AverageType.EXPONENTIAL;
input price = close;

def signal = reference MACD(fastLength, slowLength, macdLength, averageType).Avg;
def macd = reference MACD(fastLength, slowLength, macdLength, averageType).Value;
plot buymacd =  MACD_crossover_arrows and macd crosses above signal;
buymacd.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
buymacd.SetLineWeight(3);
buymacd.setDefaultColor(Color.Blue);
plot sellmacd = MACD_crossover_arrows and macd crosses below signal;
sellmacd.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_Down);
sellmacd.SetLineWeight(3);
sellmacd.setDefaultColor(Color.Magenta);

# SMI Arrows
plot uparrow = if !SMI_crossover_arrows then Double.NaN
else if SMI crosses above AvgSMI
then SMI
else Double.NaN;
uparrow.SetPaintingStrategy(PaintingStrategy.BoOLEAN_ARROW_UP);
uparrow.SetLineWeight(3);
uparrow.SetDefaultColor(GetColor(1));

plot dnarrow = if !SMI_crossover_arrows then Double.NaN
else if SMI crosses below AvgSMI
then SMI
else Double.NaN;
dnarrow.SetPaintingStrategy(PaintingStrategy.ARROW_DoWN);
dnarrow.SetLineWeight(3);
dnarrow.SetDefaultColor(GetColor(5));
 
This allows an input option to show crossover arrows.

So I was given the stochastic Momentum Index with buy and sell arrows at the crossovers. But the study shows in the lower section and not for the upper chart windows. I would like the crossover buy and crossover sell arrows from the StochasticMomentumIndex show in the upper chart with the candle sticks so I do not have to look at the lower study. Can someone help me with this please. I hope I explained it well.

Below is what I was given. I am looking to get those arrows into the candle stick chart chart upper area..not the lower study area. And to show the arrows exactly as it hits the crossover..not after it passes. Thank you so much.

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

declare lower;

input crossover_arrows = yes;
input over_bought = 40.0;
input over_sold = -40.0;
input percentDLength = 3;
input percentKLength = 5;

def min_low = Lowest(low, percentKLength);
def max_high = Highest(high, percentKLength);
def rel_diff = close - (max_high + min_low) / 2;
def diff = max_high - min_low;

def avgrel = ExpAverage(ExpAverage(rel_diff, percentDLength), percentDLength);
def avgdiff = ExpAverage(ExpAverage(diff, percentDLength), percentDLength);

plot SMI = if avgdiff != 0 then avgrel / (avgdiff / 2) * 100 else 0;
SMI.SetDefaultColor(GetColor(1));

plot AvgSMI = ExpAverage(SMI, percentDLength);
AvgSMI.SetDefaultColor(GetColor(5));

plot overbought = over_bought;
overbought.SetDefaultColor(GetColor(5));

plot oversold = over_sold;
oversold.SetDefaultColor(GetColor(5));

#Arrows
plot uparrow = if !crossover_arrows then Double.NaN
else if SMI crosses above AvgSMI
then SMI
else Double.NaN;
uparrow.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
uparrow.SetLineWeight(3);
uparrow.SetDefaultColor(GetColor(1));

plot dnarrow = if !crossover_arrows then Double.NaN
else if SMI crosses below AvgSMI
then SMI
else Double.NaN;
dnarrow.SetPaintingStrategy(PaintingStrategy.ARROW_DoWN);
dnarrow.SetLineWeight(3);
dnarrow.SetDefaultColor(GetColor(5));
 
Last edited by a moderator:
So I was given the stochastic Momentum Index with buy and sell arrows at the crossovers. But the study shows in the lower section and not for the upper chart windows. I would like the crossover buy and crossover sell arrows from the StochasticMomentumIndex show in the upper chart with the candle sticks so I do not have to look at the lower study. Can someone help me with this please. I hope I explained it well.

Below is what I was given. I am looking to get those arrows into the candle stick chart chart upper area..not the lower study area. And to show the arrows exactly as it hits the crossover..not after it passes. Thank you so much.

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

declare lower;

input crossover_arrows = yes;
input over_bought = 40.0;
input over_sold = -40.0;
input percentDLength = 3;
input percentKLength = 5;

def min_low = Lowest(low, percentKLength);
def max_high = Highest(high, percentKLength);
def rel_diff = close - (max_high + min_low) / 2;
def diff = max_high - min_low;

def avgrel = ExpAverage(ExpAverage(rel_diff, percentDLength), percentDLength);
def avgdiff = ExpAverage(ExpAverage(diff, percentDLength), percentDLength);

plot SMI = if avgdiff != 0 then avgrel / (avgdiff / 2) * 100 else 0;
SMI.SetDefaultColor(GetColor(1));

plot AvgSMI = ExpAverage(SMI, percentDLength);
AvgSMI.SetDefaultColor(GetColor(5));

plot overbought = over_bought;
overbought.SetDefaultColor(GetColor(5));

plot oversold = over_sold;
oversold.SetDefaultColor(GetColor(5));

#Arrows
plot uparrow = if !crossover_arrows then Double.NaN
else if SMI crosses above AvgSMI
then SMI
else Double.NaN;
uparrow.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
uparrow.SetLineWeight(3);
uparrow.SetDefaultColor(GetColor(1));

plot dnarrow = if !crossover_arrows then Double.NaN
else if SMI crosses below AvgSMI
then SMI
else Double.NaN;
dnarrow.SetPaintingStrategy(PaintingStrategy.ARROW_DoWN);
dnarrow.SetLineWeight(3);
dnarrow.SetDefaultColor(GetColor(5));
ToS SMI Crossover made into an upper chart
DBIdJdQ.png

Ruby:
# ToS SMI Crossover
# made into an upper chart
# @merryday 10/22
#
input crossover_arrows = yes;
input over_bought = 40.0;
input over_sold = -40.0;
input percentDLength = 3;
input percentKLength = 5;

def min_low = Lowest(low, percentKLength);
def max_high = Highest(high, percentKLength);
def rel_diff = close - (max_high + min_low) / 2;
def diff = max_high - min_low;

def avgrel = ExpAverage(ExpAverage(rel_diff, percentDLength), percentDLength);
def avgdiff = ExpAverage(ExpAverage(diff, percentDLength), percentDLength);

def SMI = if avgdiff != 0 then avgrel / (avgdiff / 2) * 100 else 0;
def AvgSMI = ExpAverage(SMI, percentDLength);
# Charting and Formatting

#Arrows
plot uparrow = if !crossover_arrows then Double.NaN
else if SMI crosses above AvgSMI
then low
else Double.NaN;
uparrow.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
uparrow.SetLineWeight(3);
uparrow.SetDefaultColor(GetColor(1));

plot dnarrow = if !crossover_arrows then Double.NaN
else if SMI crosses below AvgSMI
then high
else Double.NaN;
dnarrow.SetPaintingStrategy(PaintingStrategy.ARROW_DoWN);
dnarrow.SetLineWeight(3);
dnarrow.SetDefaultColor(GetColor(5));
 
Last edited:
How to get alert on Stochastic cross over and under 75 and 35.
Thank you in advance.
https://photos.app.goo.gl/hW58Vdwv4CfKyz7J8
Ruby:
plot stoch = reference StochasticFull(75, 35, 14, 3, high, low, close, 3, AverageType.SIMPLE);
     stoch.hide();

Alert(stoch crosses 75, "stoch crosses 75", Alert.Bar, Sound.Bell);
Alert(stoch crosses 35, "stoch crosses 35", Alert.Bar, Sound.Bell);

https://usethinkscript.com/resources/how-to-add-alert-script-to-thinkorswim-indicators.9/
 
Last edited:

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