Indicateur KDJ, conversion code mq4 vers prorealtime
Forums › ProRealTime forum Français › Support ProBuilder › Indicateur KDJ, conversion code mq4 vers prorealtime
- This topic has 8 replies, 3 voices, and was last updated 4 years ago by falco44.
-
-
12/08/2019 at 9:54 PM #11445612/09/2019 at 8:00 AM #114467
Peut-être que ceci peut faire l’affaire ?
12345678910plusHaut = HIGHEST[Period](HIGH)plusBas = LOWEST[Period](LOW)oscillateur = (CLOSE - plusBas) / (plusHaut - plusBas) * 100ligneK = ExponentialAverage[K](oscillateur)ligneD = ExponentialAverage[D](ligneK)ligneJ = 3 * ligneD - 2 * ligneKRETURN ligneK AS "%K", ligneD AS "%D", ligneJ AS "%J", 80 as "Surachat", 20 as "Survente"1 user thanked author for this post.
12/09/2019 at 11:01 AM #11447612/09/2019 at 3:26 PM #11449612/09/2019 at 3:36 PM #114497J’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);12/09/2019 at 3:37 PM #11449812/09/2019 at 3:59 PM #11450012/09/2019 at 4:03 PM #114501Ci-dessous la version issue du code MT4:
1234567891011121314151617181920212223242526272829nPeriod = 9factor1 = 0.6666666factor2 = 0.3333333if barindex>nPeriod thenCn=closeLn=closeHn=closefor k=0 to nPeriod-1 doif ln>low[k] thenln=low[k]endifif hn<high[k] thenhn=high[k]endifnextif hn-ln <>0 thenrsv=(Cn-Ln)/(Hn-Ln)*100elseRSV = 50endifpercentK = factor1 * percentK[1] + factor2 * RSVpercentD = factor1 * percentD[1] + factor2 * percentKpercentJ = 3 * percentD - 2 * percentKendifreturn percentk coloured(255,0,0), percentd coloured(0,0,255) , percentj coloured(0,255,0)1 user thanked author for this post.
12/09/2019 at 9:19 PM #114518 -
AuthorPosts
Find exclusive trading pro-tools on