Count Slow Stochastics oversold for previous X day


Category:
0
0

Hi Pete,

Could you please create a count of slow stochastics oversold similar to my RSI post, but this time instead of using bars, is it possible to use “Days” verbiage? The reason is because I use this on a 5-minute scale for scalp/day trading and it would be easier for me to enter days instead of calculating how many 5-min bars are in X amount of days. I would also like the plot data to show percentage.

Thinkorswim Solutions Forum (hahn-tech.com)

Thank you again!

Marked as spam
Posted by (Questions: 20, Answers: 27)
Asked on April 3, 2021 2:15 pm
136 views
0
Private answer

It is not possible to do this for intraday time frames. Period. Sorry. Since the code is only displaying the percent of previous days the stochastic has been overbought you do NOT need to make this work on an intraday time frame. If you think otherwise you are mistaken.

Here is the code for computing these values on a Daily time frame:

declare lower;
input spanOfBars = 100;
input stochOB = 80;
input stochOS = 20;
input kPeriod = 10;
input dPeriod = 10;
input stochPriceHigh = high;
input stochPriceLow = low;
input stochPriceClose = close;
input slowingPeriod = 3;
input stochAverageType = AverageType.SIMPLE;
def lowestK = Lowest(stochPriceLow, kPeriod);
def changeA = stochPriceClose - lowestK;
def changeB = Highest(stochPriceHigh, kPeriod) - lowestK;
def fastK = if changeB != 0 then changeA / changeB * 100 else 0;
def fullK = MovingAverage(stochAverageType, fastK, slowingPeriod);
def countOversold = Sum(fullK > stochOB, spanOfBars);
def countOverbought = Sum(fullK < stochOS, spanOfBars);
plot data = countOversold / spanOfBars;

FYI, StochasticSlow plots exactly the same as StochasticFull. In fact the StochasticSlow is derived directly from the StochasticFull study.

Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on April 3, 2021 4:25 pm
0
Thank you so much again Pete!
( at April 4, 2021 8:36 pm)