StochasticSlow k & d crossover study

uTSusr07A

Member
New TOS user here and this community has been immensly helpful, big THANK YOU.

I'm currently using the TOS standard StochasticSlow indicator with arrows plotted when SlowD crossing the overbought & oversold. However I'd like arrows plotted both on the lower study and the chart, under the following conditions:

i) Up arrow(customizable color) when SlowK crosses above SlowD and SlowD is still within customizable oversold area(ie SlowD < Oversold). I'd like to specify the Oversold threshold(eg 20,25 etc)

ii) Down arrow(customizable color) when SlowK crosses below SlowD and SlowD is still within customizable overbought area(ie SlowD > Overbought). I'd like to specify the Overbought threshold(eg 80,75 etc)

Hoping this is possible. My searches for a similar ask/solution wasnt fruitful on this forum but apologize in advance if I didnt look carefully enough. I'm not familar with thinkscript coding.

Seems like this is providing very useful buy/sell signals and would like to add this study to scan/watchlist also,if possible.

Can you please help with this or point me to custom study if it already exists.

Thank you so much

Perhaps a picture will inspire someone to help me with the code:
P8PM7lp.png


Thanks!
 
Last edited by a moderator:
New TOS user here and this community has been immensly helpful, big THANK YOU.

I'm currently using the TOS standard StochasticSlow indicator with arrows plotted when SlowD crossing the overbought & oversold. However I'd like arrows plotted both on the lower study and the chart, under the following conditions:

i) Up arrow(customizable color) when SlowK crosses above SlowD and SlowD is still within customizable oversold area(ie SlowD < Oversold). I'd like to specify the Oversold threshold(eg 20,25 etc)

ii) Down arrow(customizable color) when SlowK crosses below SlowD and SlowD is still within customizable overbought area(ie SlowD > Overbought). I'd like to specify the Overbought threshold(eg 80,75 etc)

Hoping this is possible. My searches for a similar ask/solution wasnt fruitful on this forum but apologize in advance if I didnt look carefully enough. I'm not familar with thinkscript coding.

Seems like this is providing very useful buy/sell signals and would like to add this study to scan/watchlist also,if possible.

here is an upper study to draw your arrows.

my 2 cents, stoch can stay high, while price moves up, giving many false down arrows.

EDIT---- change
KPeriod and DPeriod , from def to input

Code:
#
def na = Double.NaN;

# StochasticSlow
input over_bought = 80.0;
input over_sold = 20.0;
input KPeriod = 10;
input DPeriod = 10;
def priceH = high;
def priceL = low;
def priceC = close;
input averageType = AverageType.SIMPLE;

def SlowK = reference StochasticFull(over_bought, over_sold, KPeriod, DPeriod, priceH, priceL, priceC, 3, if (averageType == 1) then AverageType.SIMPLE else AverageType.EXPONENTIAL).FullK;
def SlowD = reference StochasticFull(over_bought, over_sold, KPeriod, DPeriod, priceH, priceL, priceC, 3, if (averageType == 1) then AverageType.SIMPLE else AverageType.EXPONENTIAL).FullD;

# Up arrow, SlowK crosses above SlowD and SlowD < oversold
def up = SlowK crosses above SlowD and  SlowD < over_sold;

# Down arrow, SlowK crosses below SlowD and SlowD > Overbought
def down = SlowK crosses below SlowD and SlowD > over_bought;

plot upz = if up then low * 0.999 else na;
upz.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
upz.SetDefaultColor(Color.GREEN);
upz.SetLineWeight(3);

plot downz = if down then high * 1.001 else na;
downz.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
downz.SetDefaultColor(Color.RED);
downz.SetLineWeight(3);
#
 
Last edited:

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

here is an upper study to draw your arrows.

my 2 cents, stoch can stay high, while price moves up, giving many false down arrows.

Code:
#
def na = Double.NaN;

# StochasticSlow
input over_bought = 80.0;
input over_sold = 20.0;
def KPeriod = 10;
def DPeriod = 10;
def priceH = high;
def priceL = low;
def priceC = close;
input averageType = AverageType.SIMPLE;

def SlowK = reference StochasticFull(over_bought, over_sold, KPeriod, DPeriod, priceH, priceL, priceC, 3, if (averageType == 1) then AverageType.SIMPLE else AverageType.EXPONENTIAL).FullK;
def SlowD = reference StochasticFull(over_bought, over_sold, KPeriod, DPeriod, priceH, priceL, priceC, 3, if (averageType == 1) then AverageType.SIMPLE else AverageType.EXPONENTIAL).FullD;

# Up arrow, SlowK crosses above SlowD and SlowD < oversold
def up = SlowK crosses above SlowD and  SlowD < over_sold;

# Down arrow, SlowK crosses below SlowD and SlowD > Overbought
def down = SlowK crosses below SlowD and SlowD > over_bought;

plot upz = if up then low * 0.999 else na;
upz.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
upz.SetDefaultColor(Color.GREEN);
upz.SetLineWeight(3);

plot downz = if down then high * 1.001 else na;
downz.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
downz.SetDefaultColor(Color.RED);
downz.SetLineWeight(3);
#
@halcyonguy , Thank you so much, appreciate it!

Yes, good point , agree and am aware of the potential false signals on both directions ( as is with any indicator). I dont rely on a single indicator, but need multiple things (including volume, momentum on multiple timeframes and Level2 ladder) to align before taking a trade. Similar issue arises with RSI where it can remain oversold for a long time and yet the downtrend continues.

I use these crosses/arrows not just for entries but also for taking partial profits or even avoiding entries(for eg on a downtrend, when an uparrow shows up, I know a pullback is coming, prompting me for a partial...or avoid a potential entry(short) until after pullback etc)..

I was able to add the study, works great!
I see you have fixed the Kperiod & Dperiod..,would you be able to make them as inputs as well, please? , so I can match with my StochasticSlow study periods(for eg, 10,3).

Thanks again!
 
@halcyonguy , Thank you so much, appreciate it!

Yes, good point , agree and am aware of the potential false signals on both directions ( as is with any indicator). I dont rely on a single indicator, but need multiple things (including volume, momentum on multiple timeframes and Level2 ladder) to align before taking a trade. Similar issue arises with RSI where it can remain oversold for a long time and yet the downtrend continues.

I use these crosses/arrows not just for entries but also for taking partial profits or even avoiding entries(for eg on a downtrend, when an uparrow shows up, I know a pullback is coming, prompting me for a partial...or avoid a potential entry(short) until after pullback etc)..

I was able to add the study, works great!
I see you have fixed the Kperiod & Dperiod..,would you be able to make them as inputs as well, please? , so I can match with my StochasticSlow study periods(for eg, 10,3).

Thanks again!

i changed my code above.

i had changed several variables to def , to make the settings input screen simpler.
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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