MACD divergence script

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #243316 quote
    Adony
    Participant
    New

    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 quote
    jacquesgermain
    Participant
    Senior

    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”

    Iván González thanked this post
    #243330 quote
    Adony
    Participant
    New

    Bonjour @jacquesgermain,

    Super mercipour votre aide. Cela marche bien. 🙏

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

MACD divergence script


ProBuilder : Indicateurs & Outils Personnalisés

New Reply
Author
author-avatar
Adony @adony Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by Adony
1 year ago.

Topic Details
Forum: ProBuilder : Indicateurs & Outils Personnalisés
Language: French
Started: 02/01/2025
Status: Active
Attachments: 1 files
Logo Logo
Loading...