OPEN-SOURCE SCRIPT

Prometheus Stochastic

The Stochastic indicator is a popular indicator developed in the 1950s. It is designed to identify overbought and oversold scenarios on different assets. A value above 80 is considered overbought and a value below 20 is considered oversold.

The formula is as follows:

%k = ((Close - Low_i) / (High_i / Low_i)) * 100

Low_i and High_i represent the lowest low and highest high of the selected period.

The Prometheus version takes a slightly different approach:

%k = ((High - Lowest_Close_i) / (High_i / Low_i)) * 100

Using the Current High minus the Lowest Close provides us with a more robust range that can be slightly more sensitive to moves and provide a different perspective.

Code:



This is the function that returns our Stochastic indicator.

What period do we use for the calculation? Let Prometheus handle that, we utilize a Sum of Squared Error calculation to find what lookback values can be most useful for a trader. How we do it is we calculate a Simple Moving Average or SMA and the indicator using a lot of different bars back values. Then if there is an event, characterized by the indicator crossing above 80 or below 20, we subtract the close by the SMA and square it. If there is no event we return a big value, we want the error to be as small as possible. Because we loop over every value for bars back, we get the value with the smallest error. We also do this for the smoothing values.



This is the section where the best lookback values are calculated.

We provide the option to use this self optimizer or to use your own lookback values.

스냅샷

Here is an example on the daily SPY chart. The top Stochastic is the value with the SSE calculation, the bottom is with a fixed 14, 1, 3 input values. We see in the candles with boxes where some potential differences and trades may be.

스냅샷

This is another comparison of the SSE functionality and the fixed lookbacks on the PLTR 1 day chart.

스냅샷

Differences may be more apparent on lower time frame charts.

We encourage traders to not follow indicators blindly, none are 100% accurate. SSE does not guarantee that the values generated will be the best for a given moment in time. Please comment on any desired updates, all criticism is welcome!
Bands and ChannelsChart patternsCycles

오픈 소스 스크립트

진정한 TradingView 정신에 따라, 이 스크립트의 저자는 트레이더들이 이해하고 검증할 수 있도록 오픈 소스로 공개했습니다. 저자에게 박수를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 출판물에서 이 코드를 재사용하는 것은 하우스 룰에 의해 관리됩니다. 님은 즐겨찾기로 이 스크립트를 차트에서 쓸 수 있습니다.

차트에 이 스크립트를 사용하시겠습니까?


또한 다음에서도:

면책사항