OPEN-SOURCE SCRIPT
Aktualisiert MAHAR K Stochastic Indicator

What It Does
%K line calculates fast stochastic of _src over length, then re-smoothed twice: sk (smoothK), %D (smoothD), and slower %F (smoothF).
Plots the three lines, draws 80/50/20 bands, and highlights extreme values by drawing red circles when sk hits 100 and green when it hits 0.
Notable Details
sma_signal chooses the smoothing kernel (SMA, EMA, WMA, DEMA). ma() delegates to the selected function and contains a VWMA branch even though VWMA is not listed in the input options.
A custom dema() helper implements the classic double EMA.
stOBOS is always true, so the ternary wrappers around the circle plots can be simplified.
Risk / Edge Cases
If highestHigh == lowestLow (flat price over the window) the %K calculation divides by zero, yielding na. Consider guarding against that or defaulting to previous values.
To actually expose VWMA, add it to the input options; otherwise remove the dead code branch.
Next Steps
Decide whether to safeguard the denominator before plotting.
Align the smoothing options with the available choices and prune the redundant conditionals if desired.
%K line calculates fast stochastic of _src over length, then re-smoothed twice: sk (smoothK), %D (smoothD), and slower %F (smoothF).
Plots the three lines, draws 80/50/20 bands, and highlights extreme values by drawing red circles when sk hits 100 and green when it hits 0.
Notable Details
sma_signal chooses the smoothing kernel (SMA, EMA, WMA, DEMA). ma() delegates to the selected function and contains a VWMA branch even though VWMA is not listed in the input options.
A custom dema() helper implements the classic double EMA.
stOBOS is always true, so the ternary wrappers around the circle plots can be simplified.
Risk / Edge Cases
If highestHigh == lowestLow (flat price over the window) the %K calculation divides by zero, yielding na. Consider guarding against that or defaulting to previous values.
To actually expose VWMA, add it to the input options; otherwise remove the dead code branch.
Next Steps
Decide whether to safeguard the denominator before plotting.
Align the smoothing options with the available choices and prune the redundant conditionals if desired.
Versionshinweise
add custom alertsOpen-source Skript
Ganz im Sinne von TradingView hat dieser Autor sein/ihr Script als Open-Source veröffentlicht. Auf diese Weise können nun auch andere Trader das Script rezensieren und die Funktionalität überprüfen. Vielen Dank an den Autor! Sie können das Script kostenlos verwenden, aber eine Wiederveröffentlichung des Codes unterliegt unseren Hausregeln.
Haftungsausschluss
Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.
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 auch andere Trader das Script rezensieren und die Funktionalität überprüfen. Vielen Dank an den Autor! Sie können das Script kostenlos verwenden, aber eine Wiederveröffentlichung des Codes unterliegt unseren Hausregeln.
Haftungsausschluss
Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.