Le Stochastique RSI
A la demande d’un de nos utilisateurs, nous venons d’ajouter sur botcrypto.io l’indicateur StochRSI (Stochastique RSI) !
Calcul du StochRSI
Etonnamment, nous avons eu de mal à trouver une formule qui intègre tous les paramètres que l’on a sur TradingView pour calculer cet indicateur. Nous nous faisons donc un plaisir de vous partager notre méthode de calcul pour cet indicateur !
Version courte
// -- parameters: lengthRSI = 10 //RSI period lengthStoch = 10 //Stochastic period smoothK = 10 //Smooth signal of stochastic RSI smoothD = 3 //Smooth signal of smoothed stochastic RSI myRSI = RSI[lengthRSI](close) MinRSI = lowest[lengthStoch](myrsi) MaxRSI = highest[lengthStoch](myrsi) StochRSI = (myRSI-MinRSI) / (MaxRSI-MinRSI) K = average[smoothK](stochrsi)*100 D = average[smoothD](K) return K as "K%", D as "D%
Version Python
⚠️ voir le calcul du rsi, il existe plusieurs variantes pour le RSI !
def stochRsi(self, offset, rsi, lengthStoch):
"""
:param offset: int, shift in the past (offset = 0, current candle, offset = 1, previous candle, ...)
:param rsi: list of rsi values previously computed
"""
if offset > 0:
MinRSI = min(rsi[-lengthStoch-offset:-offset])
MaxRSI = max(rsi[-lengthStoch-offset:-offset])
else:
MinRSI = min(rsi[-lengthStoch:])
MaxRSI = max(rsi[-lengthStoch:])
return (rsi[-offset-1] - MinRSI)/(MaxRSI - MinRSI)
def k(self, offset, rsi, lengthStoch, smoothK):
return 100 * (sum([self.stochRsi(offset+i, rsi, lengthStoch) for i in range(smoothK)])) / smoothK
def d(self, offset, rsi, lengthStoch, smoothK, smoothD):
return sum([self.k(offset+i, rsi, lengthStoch, smoothK) for i in range(smoothD)]) / smoothD
Analyse du StochRSI
En cours !… Peut être que nos chers utilisateurs en ont plus à vous apprendre que nous.
Posez vos questions sur notre Discord !





