Poids des criteres dans resultat screener

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #184169 quote
    trading2
    Participant
    Junior

    Bonjour,

    Débutant en programmation j’ai un souci que je n’arrive pas à résoudre dans le code du screener ci attaché.

    Je souhaite ajouter comme critere de tri dans le resultat du screener le poids total des criteres pour chaque titre . j’ai dans ce screener 5 criteres avec un poids = à 1 ou 2 que j’ai qualifie pour chaque critère.

    Si par exemple un titre possede le critere OK 1 alors sa Force sera = à 1

    si un titre possède les critères OK1 et OK4 alors sa Force sera = 1+2 = 3

    si un tire possède les criteres OK 4 et OK 5 alors sa Force sera = à 2 +2 = 4

    J’ai deja une erreur avec les IF ….. ENDIF ( surement toute bete ???? ) et je ne sais pas si je dois initialiser au départ la variable Force à 0 ?

    j’ai mis les lignes de codequi posent problème entre //+++++++++++

    TIMEFRAME(daily)
    userindic1 = CALL "Range Volatilty"
    indicator1 = ExponentialAverage[6](userindic1)
    a1 = (indicator1 >= SeuilVolat/100) AND (Volume > SeuilVolume) AND (Close > SeuilValeur)
    
    // A FAIRE ---> Modifier Seuil Vol et Seuil Valeur par Volume *Close
    
    TIMEFRAME (default)
    //+++++++++++++++++++++++++++++++
    Force = 0
    //+++++++++++++++++++++++++++++++
    
    Indic1 = CALL "LS and Clo xH +Haut15P (LS>Clo"
    b1 = (Indic1 = 1)
    b2 = (Indic1[1] = 1)
    OK1 = (a1 AND b1 ) OR (a1 AND b2)
    
    //+++++++++++++++++++++++++++++++
    IF OK1 THEN Force = Force + 1
    ENDIF
    //+++++++++++++++++++++++++++++++
    
    Indic2 = CALL "Clo xH BBH100"
    c1 = (Indic2 = 1)
    c2 = (Indic2[1] = 1)
    OK2 = (a1 AND c1 ) OR (a1 AND c2)
    
    //+++++++++++++++++++++++++++++++
    IF OK2 THEN Force = Force + 1
    ENDIF
    //+++++++++++++++++++++++++++++++
    
    Indic3 = CALL "LS and Close xH BBH200"(close)
    d1 = (Indic3 = 1)
    d2 = (Indic3[1] = 1)
    OK3 = (a1 AND d1 ) OR (a1 AND d2)
    
    //+++++++++++++++++++++++++++++++
    IF OK3 THEN Force = Force + 1
    ENDIF
    //+++++++++++++++++++++++++++++++
    
    Indic4 = CALL "Squeeze Carter 100 BB14P"
    e1 = (Indic4 = 0)
    e2 = (Indic4[1] = 1)
    OK4 = (a1 AND e1 AND e2) // Squeeze Carter passe à 0
    
    //+++++++++++++++++++++++++++++++
    IF OK4 THEN Force = Force + 2
    ENDIF
    //+++++++++++++++++++++++++++++++
    
    Indic5 = CALL "RSI9 > BBH20"
    f1 = (Indic5 = 1)
    f2 = (Indic5[1] = 1)
    OK5 = (a1 AND f1 ) OR (a1 AND f2)
    
    //+++++++++++++++++++++++++++++++
    IF OK5 THEN Force = Force + 2
    ENDIF
    //+++++++++++++++++++++++++++++++
    
    //+++++++++++++++++++++++++++++++
    criteria = Force
    //+++++++++++++++++++++++++++++++
    
    SCREENER[OK1 OR OK2 OR OK3 OR OK4 OR OK5] (criteria AS "Force")
    
    //criteria = CALL "Range Volatilty"
    //SCREENER[OK1 OR OK2 OR OK3 OR OK4 OR OK5] (criteria AS "Range Volatilty")
    #185299 quote
    JC_Bywan
    Moderator
    Master

    Bonsoir, code remis au format PRT dans le post ci-dessus. Quand le bouton “insert PRT code” n’apparait pas, merci de faire CTRL+F5 cf https://www.prorealcode.com/topic/insert-prt-code-button-ctrlf5-to-bring-it-back-if-missing/

    Tous ces if OK1, if OK2 etc… ont renvoyé une erreur car il manque le retour à la ligne après le “then”. Exemple de syntaxe correcte:

    IF OK1 THEN
      Force = Force + 1
    ENDIF
    #185575 quote
    trading2
    Participant
    Junior

    Merci Beaucoup c’est tres gentil je vais essayer ceci

    #187368 quote
    trading2
    Participant
    Junior

    Bonjour JC,

    je n’avais pas eu le temps de tester. Cela est fait . Merci encore cela fonctionne et correspond à ce  que je cherchais

Viewing 4 posts - 1 through 4 (of 4 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

Poids des criteres dans resultat screener


ProScreener : Scanners de Marché & Détection

New Reply
Author
author-avatar
trading2 @trading2 Participant
Summary

This topic contains 3 replies,
has 3 voices, and was last updated by trading2
4 years, 7 months ago.

Topic Details
Forum: ProScreener : Scanners de Marché & Détection
Language: French
Started: 12/30/2021
Status: Active
Attachments: No files
Logo Logo
Loading...