Bonsoir Nicolas,
Pourrais tu convertir ce code stp ?
Cordialement,
Romain
Peut-être que ceci peut faire l’affaire ?
plusHaut = HIGHEST[Period](HIGH)
plusBas = LOWEST[Period](LOW)
oscillateur = (CLOSE - plusBas) / (plusHaut - plusBas) * 100
ligneK = ExponentialAverage[K](oscillateur)
ligneD = ExponentialAverage[D](ligneK)
ligneJ = 3 * ligneD - 2 * ligneK
RETURN ligneK AS "%K", ligneD AS "%D", ligneJ AS "%J", 80 as "Surachat", 20 as "Survente"
Par ailleurs l’indicateur KDJ est déjà présent dans la plateforme comme indicateur par défaut, bien présent dans la liste des indicateurs.
Bonjour Nicolas,
Merci de ton retour et désolé de t’avoir demandé le code d’un indicateur deja existant
J’ai parlé un peu vite, l’indicateur dont le code a été fourni ne correspond pas à la version que j’ai attaché ….
//+——————————————————————+
//| Custom indicator iteration function |
//+——————————————————————+
int start()
{
int counted_bars=IndicatorCounted();
//—-
int i, k, num;
double Ln, Hn, Cn;
//—-
i = Bars – counted_bars – 1;
num = Bars – nPeriod;
while(i>=0)
{
Cn = iClose(NULL,0,i); Ln = iClose(NULL,0,i); Hn = iClose(NULL,0,i);
for(k=0; k<nPeriod; k++){
if (Ln > iLow(NULL,0,i+k)) Ln = iLow(NULL,0,i+k);
if (Hn < iHigh(NULL,0,i+k)) Hn = iHigh(NULL,0,i+k);
}
if (Hn-Ln != 0) RSV[i] = (Cn-Ln)/(Hn-Ln)*100; else RSV[i] = 50;
if (i >= num) {
percentK[i] = factor_1 * 50 + factor_2 * RSV[i];
percentD[i] = factor_1 * 50 + factor_2 * percentK[i];
} else {
percentK[i] = factor_1 * percentK[i+1] + factor_2 * RSV[i];
percentD[i] = factor_1 * percentD[i+1] + factor_2 * percentK[i];
}
percentJ[i] = 3 * percentD[i] – 2 * percentK[i];
trend[i] = trend[i+1];
if (percentK[i]>percentD[i] && percentK[i]>percentJ[i]) trend[i] = 1;
if (percentK[i]<percentD[i] && percentK[i]<percentJ[i]) trend[i] =-1;
manageArrow(i);
i–;
}
return(0);
Cela s’en approche mais il n’y a pas tous les calculs
Je raconte n’importe quoi, le code est ok !
Merci a toi matriciel
Cordialement,
Romain
Ci-dessous la version issue du code MT4:
nPeriod = 9
factor1 = 0.6666666
factor2 = 0.3333333
if barindex>nPeriod then
Cn=close
Ln=close
Hn=close
for k=0 to nPeriod-1 do
if ln>low[k] then
ln=low[k]
endif
if hn<high[k] then
hn=high[k]
endif
next
if hn-ln <>0 then
rsv=(Cn-Ln)/(Hn-Ln)*100
else
RSV = 50
endif
percentK = factor1 * percentK[1] + factor2 * RSV
percentD = factor1 * percentD[1] + factor2 * percentK
percentJ = 3 * percentD - 2 * percentK
endif
return percentk coloured(255,0,0), percentd coloured(0,0,255) , percentj coloured(0,255,0)
Merci Nicolas, t’es un chef !