RSI Belkhayate

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #254682 quote
    ARLEQUIN49ARLEQUIN49
    Participant
    Veteran

    Bonjour,

    J’aurais besoin  de la conversion de cet indicateur RSI de Métatrader.

    Merci beaucoup d’avance

    #property copyright “Par pheniksss”
    #property link “”

    #property indicator_separate_window
    #property indicator_minimum 0.0
    #property indicator_maximum 100.0
    #property indicator_levelcolor Orange
    #property indicator_levelstyle 0
    #property indicator_buffers 5
    #property indicator_color1 White
    #property indicator_color2 Black
    #property indicator_color3 Black
    #property indicator_color4 Red
    #property indicator_color5 Aqua
    #property indicator_width1 2
    #property indicator_level1 20.0
    #property indicator_level2 40.0
    #property indicator_level3 60.0
    #property indicator_width4 2
    #property indicator_level4 80.0

    extern int RSIPeriod = 14;
    double g_ibuf_80[];
    double g_ibuf_84[];
    double g_ibuf_88[];
    double g_ibuf_92[];
    double g_ibuf_96[];
    bool gi_100;
    bool gi_104;
    bool gi_108;
    int g_window_112;

    int init() {
    string ls_0;
    SetIndexStyle(0, DRAW_LINE, STYLE_SOLID, 2);
    SetIndexBuffer(0, g_ibuf_80);
    SetIndexStyle(1, DRAW_NONE);
    SetIndexBuffer(1, g_ibuf_84);
    SetIndexStyle(2, DRAW_NONE);
    SetIndexBuffer(2, g_ibuf_88);
    SetIndexStyle(3, DRAW_LINE, STYLE_SOLID, 2);
    SetIndexBuffer(3, g_ibuf_92);
    SetIndexStyle(4, DRAW_LINE, STYLE_SOLID, 2);
    SetIndexBuffer(4, g_ibuf_96);
    IndicatorShortName(ls_0);
    SetIndexLabel(0, ls_0);
    ls_0 = “RSI(” + RSIPeriod + “)”;
    g_window_112 = WindowFind(“RSI Belkhayate”);
    gi_108 = FALSE;
    return (0);
    }

    int start() {
    double ld_8;
    double ld_16;
    double ld_24;
    double ld_32;
    double ld_40;
    int l_ind_counted_4 = IndicatorCounted();
    if (Bars <= RSIPeriod) return (0);
    if (l_ind_counted_4 < 1) for (int li_0 = 1; li_0 <= RSIPeriod; li_0++) g_ibuf_80[Bars – li_0] = 0.0;
    li_0 = Bars – RSIPeriod – 1;
    if (l_ind_counted_4 >= RSIPeriod) li_0 = Bars – l_ind_counted_4 – 1;
    while (li_0 >= 0) {
    ld_32 = 0.0;
    ld_40 = 0.0;
    if (li_0 == Bars – RSIPeriod – 1) {
    for (int li_48 = Bars – 2; li_48 >= li_0; li_48–) {
    ld_8 = Close[li_48] – (Close[li_48 + 1]);
    if (ld_8 > 0.0) ld_40 += ld_8;
    else ld_32 -= ld_8;
    }
    ld_24 = ld_40 / RSIPeriod;
    ld_16 = ld_32 / RSIPeriod;
    } else {
    ld_8 = Close[li_0] – (Close[li_0 + 1]);
    if (ld_8 > 0.0) ld_40 = ld_8;
    else ld_32 = -ld_8;
    ld_24 = ((g_ibuf_84[li_0 + 1]) * (RSIPeriod – 1) + ld_40) / RSIPeriod;
    ld_16 = ((g_ibuf_88[li_0 + 1]) * (RSIPeriod – 1) + ld_32) / RSIPeriod;
    }
    g_ibuf_84[li_0] = ld_24;
    g_ibuf_88[li_0] = ld_16;
    if (ld_16 == 0.0) g_ibuf_80[li_0] = 0.0;
    else g_ibuf_80[li_0] = 100.0 – 100.0 / (ld_24 / ld_16 + 1.0);
    li_0–;
    }
    for (li_0 = Bars; li_0 >= 0; li_0–) {
    g_ibuf_92[li_0] = g_ibuf_80[li_0];
    g_ibuf_96[li_0] = g_ibuf_80[li_0];
    if (g_ibuf_80[li_0] < 60.0 && g_ibuf_80[li_0] > 40.0) {
    g_ibuf_96[li_0] = EMPTY_VALUE;
    g_ibuf_92[li_0] = EMPTY_VALUE;
    } else {
    if (g_ibuf_80[li_0] >= 60.0) {
    g_ibuf_96[li_0] = EMPTY_VALUE;
    gi_100 = TRUE;
    gi_104 = FALSE;
    } else {
    if (g_ibuf_80[li_0] <= 40.0) {
    g_ibuf_92[li_0] = EMPTY_VALUE;
    gi_104 = TRUE;
    gi_100 = FALSE;
    }
    }
    }
    }
    if (gi_104 == TRUE) {
    ObjectCreate(“Couloir bas”, OBJ_RECTANGLE, g_window_112, Time[Bars], 60, Time[0], 20, 0, 0);
    ObjectSet(“Couloir bas”, OBJPROP_STYLE, STYLE_SOLID);
    ObjectSet(“Couloir bas”, OBJPROP_COLOR, FireBrick);
    ObjectsRedraw();
    } else {
    if (gi_100 == TRUE) {
    ObjectCreate(“Couloir haut”, OBJ_RECTANGLE, g_window_112, Time[Bars], 40, Time[0], 80, 0, 0);
    ObjectSet(“Couloir haut”, OBJPROP_STYLE, STYLE_SOLID);
    ObjectSet(“Couloir haut”, OBJPROP_COLOR, Green);
    ObjectsRedraw();
    }
    }
    if (g_ibuf_80[0] < 60.0 && g_ibuf_80[0] > 40.0) gi_108 = FALSE;
    if (g_ibuf_80[0] >= 60.0 && g_ibuf_80[1] < 60.0 && gi_108 == FALSE) {
    PlaySound(“tick.wav”);
    Alert(“ACHAT RSI BEL “, Symbol());
    gi_108 = TRUE;
    }
    if (g_ibuf_80[0] <= 40.0 && g_ibuf_80[1] > 40.0 && gi_108 == FALSE) {
    PlaySound(“tick.wav”);
    Alert(“VENTE RSI BEL “, Symbol());
    gi_108 = TRUE;
    }
    ObjectsRedraw();
    return (0);
    }

    int deinit() {
    ObjectsDeleteAll();
    return (0);

    Sans-titre.png Sans-titre.png
    #254692 quote
    jacquesgermainjacquesgermain
    Participant
    Veteran

    Hello par exemple :

    rsiperiod = 14
    // ============================
    // VARIABLES
    // ============================
    ONCE avgGain = 0
    ONCE avgLoss = 0
    gain = 0
    lossaa = 0
    rsia = 0
    rsiHigh = 0
    rsiLow  = 0
    // ============================
    // CALCUL RSI MANUEL
    // ============================
    delta = close - close[1]
    IF delta > 0 THEN
    gain = delta
    lossa = 0
    ELSE
    gain = 0
    lossa = -delta
    ENDIF
    IF barindex = rsiperiod THEN
    sumGain = 0
    sumLoss = 0
    FOR i = 1 TO rsiperiod DO
    d = close[i-1] - close[i]
    IF d > 0 THEN
    sumGain = sumGain + d
    ELSE
    sumLoss = sumLoss - d
    ENDIF
    NEXT
    avgGain = sumGain / rsiperiod
    avgLoss = sumLoss / rsiperiod
    ELSIF barindex > rsiperiod THEN
    avgGain = (avgGain * (rsiperiod - 1) + gain) / rsiperiod
    avgLoss = (avgLoss * (rsiperiod - 1) + lossa) / rsiperiod
    ENDIF
    IF avgLoss = 0 THEN
    rsia = 0
    ELSE
    rsia = 100 - (100 / (1 + avgGain / avgLoss))
    ENDIF
    // ============================
    // FILTRAGE VISUEL
    // ============================
    rsiHigh = rsi
    rsiLow  = rsi
    IF rsia> 40 AND rsia < 60 THEN
    rsiHigh = 0
    rsiLow  = 0
    ELSIF rsia >= 60 THEN
    rsiLow = 0
    ELSIF rsia <= 40 THEN
    rsiHigh = 0
    ENDIF
    
    // ============================
    // ALERTES
    // ============================
    IF rsia >= 60 AND rsia[1] < 60 THEN
    DRAWARROWUP(barindex, rsia)// AFFICHAGE
    ENDIF
    
    IF rsia <= 40 AND rsia[1] > 40 THEN
    //ALERT("ATTENTE RSI BELKHAYATE")
    ENDIF
    // ============================
    // COLORATION SANS HORIZONTALES
    // ============================
    
    
    IF rsia >60  THEN
    r=150
    g=0
    b=0
    ENDIF
    IF rsia >= 40 AND rsia<=60 THEN
    r=250
    g=250
    b=250
    ENDIF
    IF rsia < 40 THEN
    r=0
    g=150
    b=0
    ENDIF
    
    // ============================
    // NIVEAUX
    // ============================
    DRAWLINE(0,40,barindex,40) coloured("darkorange")style(dottedline)
    DRAWLINE(0,60,barindex,60) coloured("darkorange")style(dottedline)
    DRAWLINE(0,20,barindex,20) coloured("darkorange")style(dottedline)
    DRAWLINE(0,80,barindex,80) coloured("darkorange")style(dottedline)
    // ============================
    // AFFICHAGE
    // ============================
    RETURN rsia coloured (r,g,b) as "rsia"
    // ============================
    
    robertogozzi and Iván González thanked this post
    #254699 quote
    ARLEQUIN49ARLEQUIN49
    Participant
    Veteran

    Merci beaucoup, c’est top; j’ai rajouté les signaux de vente qui manquaient.

    IF rsia <= 40 AND rsia[1] > 40 THEN
    DRAWARROWDOWN(barindex, rsia)// AFFICHAGE
    ENDIF

    IF rsia >= 60 AND rsia[1] < 60 THEN
    ENDIF

    //ALERT(“ATTENTE RSI BELKHAYATE”)

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

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

RSI Belkhayate


ProBuilder : Indicateurs & Outils Personnalisés

New Reply
Author
author-avatar
ARLEQUIN49 @arlequin49 Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by ARLEQUIN49ARLEQUIN49
9 months ago.

Topic Details
Forum: ProBuilder : Indicateurs & Outils Personnalisés
Language: French
Started: 12/20/2025
Status: Active
Attachments: 1 files
ProRealCode ProRealCode
Loading...