# Rate of Change Indicator for Stochastic SlowK

#### 68sooner

##### New member
VIP
I am trying to include an indicator of ROC on the SlowK, when it turns positive. I would like to experiment with different limits. I am lining up the SlowK turning positive and the MACD Histogram beginning to increase. Here is what I have so far...
Code:
``````declare lower;
input fastLength = 12;
input slowLength = 26;
input MACDLength = 9;
input averageTypeMACD = AverageType.EXPONENTIAL;
input showBreakoutSignalsMACD = no;
def Diff = MACD(fastLength, slowLength, MACDLength, averageTypeMACD).Diff;
input over_bought = 80;
input over_sold = 20;
input KPeriod = 10;
input DPeriod = 10;
input priceH = high;
input priceL = low;
input priceC = close;
input averageTypeStoch = AverageType.SIMPLE;
input showBreakoutSignalsStoch = {default "No", "On SlowK", "On SlowD", "On SlowK & SlowD"};
def SlowK = reference StochasticFull(over_bought,over_sold,KPeriod,DPeriod,priceH,priceL,priceC,3,averageTypeStoch).FullK;
def SlowD = reference StochasticFull(over_bought,over_sold,KPeriod,DPeriod,priceH,priceL,priceC,3,averageTypeStoch).FullD;
Plot DataProfile = (SlowK[1] < SlowK) and (lowest(slowK[1],3) <30) and(Diff[1] < Diff);``````

I would like to narrow my results to a sharply turning SlowK. Any thoughts? Thanks,

Last edited by a moderator:
Hi Mark,

Welcome to useThinkscript. @BenTen is building a world wide website here and were glad your here. We need a bit more information to help you. Could you tell us why you have a focus on the ROC of the Slow K turn? I guess that I'm just wonering how using and indicator of an indicator will help because there could be a bit of lag with that @horserider , any thoughts?

Last edited by a moderator:
@markos Well as you have said avoid the same type indicators as they give the same information. Seems to be what is being worked on here. The MACD and stochastic show the same information. Should not be hard to align them but for what purpose. Not sure this will go anywhere.

Hi Mark,

Welcome to useThinkscript. @BenTen is building a world wide website here and were glad your here. We need a bit more information to help you. Could you tell us why you have a focus on the ROC of the Slow K turn? I guess that I'm just wonering how using and indicator of an indicator will help because there could be a bit of lag with that @horserider , any thoughts?
Hey markos, thanks for the reply. So, to be clear, this is more of a ThinkScript learning exercise for me. I have only just started looking into it this week and I have been trying some simple conditional code. I am a data junkie and am spending a lot of time trying different adjustments in scans and studies. Hoping in the near future to get to the point of being a contributing member. ; )

I was looking to study how the stochastic SlowK reversal angle (ROC may have been the wrong terminology) related to the percentage increase in price. Other variables include value prior to the reversal and the MACD Histogram peaking negatively. Haven't figured out how to post an image just yet, but you probably get the idea. Sometimes the SlowK comes in a sharp V shaped reversal and sometimes it is a lazy L. Not quite sure how to quantify the sharpness of the reversal. Thanks in advance!

Maybe calculate slope would help with part of what you want. Never done this but an example of how it might be done. Then you could color the slope plot or make a slope label.

input slopefactor = 10;
def slopebars=1;
def height = (yourstudy - yourstudy[slopebars]) * slopefactor;
def hypotenuse = Sqrt( Sqr(slopebars) + Sqr(height) );
plot slope = Tan(height / hypotenuse) * 180 / Double.Pi;

I'll give it a try, thank you.

@horserider this typically works best on higher time frame charts, than lower time frames to calc this slope. please share your findings.

87k+ Posts
409 Online

## The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
• Exclusive indicators
• Proven strategies & setups
• Private Discord community
• Exclusive members-only content
• 1 full year of unlimited support

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?