Pb de code sur indicateur

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #245800 quote
    NICO73
    Participant
    New

    Bonjour

    Je ne suis pas codeur, alors j’essaye comm ej epux d eme débrouiller avec un Gpt spécifique Prorealtime, mais ça à ces limites…. je cherche à comprendre pouqupoi, à chaque fois que j’utilise le code issu du GPT (pourtant spécifiquement oriené sur le code prorealtime), j’ai cette erreur dans PRT: “Le programme de l’indicateur doit se terminer par l’instruction RETURN qui indique les éléments à afficher”, alors que l’instruction RETURN existe bien….
    Pour exemple code intégré:

    // Calcul du MACD
    [macdLine, signalLine, dummy] = MACD[12,26,9](close)
    macdHaussier = macdLine > signalLine
    
    // Calcul des bougies Heikin Ashi
    haClose = (open + high + low + close)/4
    haOpen = (haOpen[1] + haClose[1]) / 2
    haHigh = max(max(high, haOpen), haClose)
    haLow = min(min(low, haOpen), haClose)
    
    // Détection de 2 bougies Heikin Ashi haussières avec plus haut et plus bas croissants
    ha1Bull = haClose > haOpen AND haClose > haClose[1] AND haLow > haLow[1]
    ha2Bull = haClose[1] > haOpen[1] AND haClose[1] > haClose[2] AND haLow[1] > haLow[2]
    
    // Condition finale
    condition = macdHaussier AND ha1Bull AND ha2Bull
    
    // Affichage de la flèche verte
    IF condition THEN
    DRAWARROWUP(barindex, low - AverageTrueRange[14](close)) COLOURED(0,255,0)
    ENDIF
    
    RETURN close

    Quelqu’un a t-il la possibilité de jeter un oeil pour me dire ce qu’il ne va pas ?
    Le script de départ est celui là:
    “Je souhaite coder un indicateur pour prorealtime qui indique avec une fleche vert sur le graphique lorsque le macd (12,26,9) est vert et lorsque l’on a 2 bougies vertes en Heikin Ashi qui respectent la loi de dow.”

    Merci pour vos retours.
    Nicolas

    #245806 quote
    fifi743
    Participant
    Master

    ligne 2 est fausse

    #245807 quote
    fifi743
    Participant
    Master
    // Calcul du MACD
    signalLine= MACD[12,26,9](close)
    macdHaussier = macdLine > signalLine
     
    // Calcul des bougies Heikin Ashi
    haClose = (open + high + low + close)/4
    haOpen = (haOpen[1] + haClose[1]) / 2
    haHigh = max(max(high, haOpen), haClose)
    haLow = min(min(low, haOpen), haClose)
     
    // Détection de 2 bougies Heikin Ashi haussières avec plus haut et plus bas croissants
    ha1Bull = haClose > haOpen AND haClose > haClose[1] AND haLow > haLow[1]
    ha2Bull = haClose[1] > haOpen[1] AND haClose[1] > haClose[2] AND haLow[1] > haLow[2]
     
    // Condition finale
    condition = macdHaussier AND ha1Bull AND ha2Bull
     
    // Affichage de la flèche verte
    IF condition THEN
    DRAWARROWUP(barindex, low - AverageTrueRange[14](close)) COLOURED(0,255,0)
    ENDIF
     
    RETURN 
    
    Iván González thanked this post
    #245808 quote
    NICO73
    Participant
    New

    Merci fifi743.
    Le code s’insère correctement, plus d’erreur lors de l’intégration mais pas de flèche qui se positionne quand lES conditions sont réunies. Peut être la définion du MACD avec macdLine ?

    #245810 quote
    fifi743
    Participant
    Master

    les HA qui ete pas bonne

    // Calcul du MACD
    signalLine= MACDline[12,26,9](close)
    macdHaussier = MACDSignal[12,26,9](close) > signalLine
     
    // Calcul des bougies Heikin Ashi
    once haopen=open
    //=============
    haclose= (open+low+high+close)/4
    if barindex>0 then
    haopen=(haopen+haclose[1])/2
    halow = min(low,min(haopen,haclose))
    hahigh=max(high,max(haopen,haclose))
    endif
     
    // Détection de 2 bougies Heikin Ashi haussières avec plus haut et plus bas croissants
    ha1Bull = haClose > haOpen AND haClose > haClose[1] AND haLow > haLow[1]
    ha2Bull = haClose[1] > haOpen[1] AND haClose[1] > haClose[2] AND haLow[1] > haLow[2]
     
    // Condition finale
    //macdHaussier ANDAND ha2Bull
    condition = macdHaussier and ha1Bull and ha2Bull
     
    // Affichage de la flèche verte
    IF condition THEN
    DRAWARROWUP(barindex, low - AverageTrueRange[14](close)) COLOURED(0,255,0)
    
    ENDIF
     
    RETURN
    
    robertogozzi and Iván González thanked this post
    #245812 quote
    NICO73
    Participant
    New

    Super. Merci beaucoup.

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

Pb de code sur indicateur


ProBuilder : Indicateurs & Outils Personnalisés

New Reply
Author
author-avatar
NICO73 @nico73 Participant
Summary

This topic contains 5 replies,
has 2 voices, and was last updated by NICO73
9 months, 4 weeks ago.

Topic Details
Forum: ProBuilder : Indicateurs & Outils Personnalisés
Language: French
Started: 04/11/2025
Status: Active
Attachments: No files
Logo Logo
Loading...