MACD divergence script

Forums ProRealTime forum Français Support ProBuilder MACD divergence script

  • This topic has 2 replies, 2 voices, and was last updated 3 days ago by avatarAdony.
Viewing 3 posts - 1 through 3 (of 3 total)
  • #243316

    Dear community member,

    I need your help on my scipt for proorealtime.
    I tried a script for detection and sound notification of MACD divergence on multiple timeframe. But upon validation I get the following error message: “Ligne 1:
    caractères manquants. Suggestions: RETURN ”

    See attached file.
    I use the following prorealtime version V11.1-17.0.4.1

    Here is my code

    Cher membre de la communauté,

    J’ai besoin de votre aide sur mon script pour proorealtime.
    J’ai essayé un script pour la détection et la notification sonore d’une divergence MACD sur plusieurs timeframe. Mais lors de la validation, j’obtiens le message d’erreur suivant : « Ligne 1 :
    caractères manquants. Suggestions : RETURN »

    Voir fichier joint.
    J’utilise la version suivante de prorealtime V11.1-17.0.4.1

    Voici mon code

    // Paramètres MACD

    shortLength = 12

    longLength = 26

    signalLength = 9

     

    // Calcul du MACD et de sa ligne de signal

    MACDLine = exponentialAverage[shortLength](close) – exponentialAverage[longLength](close)

    SignalLine = exponentialAverage[signalLength](MACDLine)

     

    // Détection des sommets et creux du prix

    priceHighD = highest[5](close)

    priceLowD = lowest[5](close)

     

    // Détection des sommets et creux du MACD

    macdHighD = highest[5](MACDLine)

    macdLowD = lowest[5](MACDLine)

     

    // Divergence haussière

    if priceLowD < priceLowD[1] and macdLowD > macdLowD[1] then

    DRAWARROW_UP(close)

    DRAWTEXT(“Divergence haussière (Journalière)”, close, color.green)

    SPEAK(“alert1”)

    endif

     

    // Divergence baissière

    if priceHighD > priceHighD[1] and macdHighD < macdHighD[1] then

    DRAWARROW_DOWN(close)

    DRAWTEXT(“Divergence baissière (Journalière)”, close, color.red)

    SPEAK(“alert2”)

    ENDIF

     

    // Retour des valeurs pour affichage sur le graphique

    RETURN MACDLine AS “MACD”, SignalLine AS “Signal”

     

     

    #243320

    Bonjour voici votre indicateur débogué

    // Paramètres MACD
    shortLength = 12
    longLength = 26
    signalLength = 9
    // Calcul du MACD et de sa ligne de signal
    MACDLinea = MACDline[12,26,9](close)
    SignalLine = MACDSignal[12,26,9](close)

    // Détection des sommets et creux du prix
    priceHighD = highest[5](close)
    priceLowD = lowest[5](close)

    // Détection des sommets et creux du MACD
    macdHighD = highest[5](MACDLinea)
    macdLowD = lowest[5](MACDLinea)

    // Divergence haussière
    if priceLowD < priceLowD[1] and macdLowD > macdLowD[1] then
    DRAWARROWUP (barindex,signalline)
    DRAWTEXT(“Divergence haussière”, barindex,signalline) coloured(0,150,0)
    //SPEAK(“alert1”)
    endif
    // Divergence baissière
    if priceHighD > priceHighD[1] and macdHighD < macdHighD[1] then
    DRAWARROWDOWN (barindex,signalline)
    DRAWTEXT(“Divergence baissière”, barindex,signalline)coloured (150,0,0)
    //SPEAK(“alert2”)j
    ENDIF
    // Retour des valeurs pour affichage sur le graphique

    RETURN MACDLinea AS “MACD”, SignalLine AS “Signal”

     

    1 user thanked author for this post.
    #243330

    Bonjour @jacquesgermain,

    Super mercipour votre aide. Cela marche bien. 🙏

Viewing 3 posts - 1 through 3 (of 3 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login