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.

Snapshot

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.

Snapshot

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

Snapshot

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

Open-source Skript

Ganz im Sinne von TradingView hat dieser Autor sein/ihr Script als Open-Source veröffentlicht. Auf diese Weise können nun das Script auch andere Trader verstehen und prüfen. Vielen Dank an den Autor! Sie können das Script kostenlos verwenden. Die Nutzung dieses Codes in einer Veröffentlichung wird in unseren Hausregeln reguliert. Sie können es als Favoriten auswählen, um es in einem Chart zu verwenden.

Möchten Sie dieses Skript auf einem Chart verwenden?


Auch am:

Haftungsausschluss