OPEN-SOURCE SCRIPT

Stochastic based on Closing Prices - Identify and Rank Trends

StochClose is a trend indicator that can be used on its own to measure trend strength, in a scan to rank a group of securities according to trend strength or as part of a trend following strategy. Moreover, it acts as a volatility-adjusted trend indicator that puts securities on an equal footing.

StochClose measures the location of the current close relative to the close-only high-low range over a given period of time. In contrast to the traditional Stochastic Oscillator, this indicator only uses closing prices. Traditional Stochastic uses intraday highs and lows to calculate the range. The focus on closing prices reduces signal noise caused by intraday highs and lows, and filters out errant or irrationally exuberant price spikes.

Here are some examples when the high or low was out of proportion and suspect. Perhaps most famously, there were errant spike lows in dozens of ETFs in August 2015 (XLK, IJR, ITB). There were other spikes in VMBS (October 2014), IJR (October 2008) and KRE (May 2011). Elsewhere, there were suspicious spikes in IEI (April 2020), CHD (March 2020), CCRN (March 2020) and FNB (March 2020)

The preferred setting to identify medium and long-term uptrends is 125 days with 5 days smoothing. 125 days covers around six months. Thus, StochClose(125,5) is a 5-day SMA of the 125-day Stochastic based on closing prices. Smoothing with the 5-day SMA introduces a little lag, but reduces whipsaws and signal noise.

StochClose fluctuates between 0 and 100 with 50 as the midpoint. Values above 80 indicate that the current price is near the high end of the 125-day range, while values below 20 indicate that price is near the low end of the range. For signals, a move above 60 puts the indicator firmly in the top half of the range and points to an uptrend. A move below 40 puts the indicator firmly in the bottom half of the range and points to a downtrend.

StochClose values can also be ranked to separate the leaders from the laggards. In contrast to Rate-of-Change and Percentage Above/Below a Moving Average, StochClose acts as a volatility-adjusted indicator that can identify trend strength or weakness. The Consumer Staples SPDR is unlikely to win in a Rate-of-Change contest with the Technology SPDR. However, it is just as easy for the Consumer Staples SPDR to get in the top of its range as it is for the Technology SPDR. StochClose puts securities on an equal footing.

StochClose measures trend direction and trend strength with one number. The indicator value tells us immediately if the security is trending higher or lower. Furthermore, we can compare this value against the values for other securities. Securities with higher StochClose values are stronger than those with lower values.
rankStochastic OscillatorTrend Analysistrendfollowingvolatilityadjusted

開源腳本

在真正的TradingView精神中,這個腳本的作者以開源的方式發佈,這樣交易員可以理解和驗證它。請向作者致敬!您可以免費使用它,但在出版物中再次使用這段程式碼將受到網站規則的約束。 您可以收藏它以在圖表上使用。

想在圖表上使用此腳本?


Choose a Strategy, Develop a Plan and Follow a Process
-Arthur Hill, CMT
更多:

免責聲明