Indicateur KDJ, conversion code mq4 vers prorealtime

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #114456 quote
    falco44
    Participant
    Junior

    Bonsoir Nicolas,

    Pourrais tu convertir ce code stp ?

     

    Cordialement,

    Romain

    KDJ.mq4 KDJ.png KDJ.png
    #114467 quote
    Matriciel
    Participant
    Master

    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"
    falco44 thanked this post
    #114476 quote
    Nicolas
    Keymaster
    Master

    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.

    #114496 quote
    falco44
    Participant
    Junior

    Bonjour Nicolas,

    Merci de ton retour et désolé de t’avoir demandé le code d’un indicateur deja existant

    #114497 quote
    falco44
    Participant
    Junior

    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);

    #114498 quote
    falco44
    Participant
    Junior

    Cela s’en approche mais il n’y a pas tous les calculs

    #114500 quote
    falco44
    Participant
    Junior

    Je raconte n’importe quoi, le code est ok !

    Merci a toi matriciel

    Cordialement,

    Romain

    #114501 quote
    Nicolas
    Keymaster
    Master

    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)
    
    falco44 thanked this post
    KDJ-indicator.png KDJ-indicator.png
    #114518 quote
    falco44
    Participant
    Junior

    Merci Nicolas, t’es un chef !

Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.

Indicateur KDJ, conversion code mq4 vers prorealtime


ProBuilder : Indicateurs & Outils Personnalisés

New Reply
Author
author-avatar
falco44 @falco44 Participant
Summary

This topic contains 8 replies,
has 3 voices, and was last updated by falco44
6 years, 2 months ago.

Topic Details
Forum: ProBuilder : Indicateurs & Outils Personnalisés
Language: French
Started: 12/08/2019
Status: Active
Attachments: 3 files
Logo Logo
Loading...