Indicateur de ma strategie

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #218411 quote
    deun74
    Participant
    New
    // Définition des paramètres du code
    DEFPARAM CumulateOrders = false // Cumul des positions désactivé
    
    // Jours de semaine
    daysForbiddenEntry =  OpenDayOfWeek = 6 OR OpenDayOfWeek = 0
    
    
    //variables
    myAngle, mylevel0 = CALL "DR_pente mm vente"[1, 21, 49]
    myVWAP, myupper1STD, mylower1STD, myupper2STD, mylower2STD, myupper3STD, mylower3STD, myyesterdayVWAP = CALL "DR_VWAP Daily"
    smableu = Average[9](TotalPrice )
    smajaune = Average[50](TotalPrice )
    smarouge = Average[11](TotalPrice )
    smaviolette = Average[21](TotalPrice )
    
    /////////////////////////////////////////////////////////////////////////////////////////////////////////
    
    // ACHAT
    
    //BOUCLE generale pour chercher la bougie du dernier signal
    
    e=0
    FOR e=0 to 200 do
    //Conditions d'entrée à l'achat 1
    if not daysForbiddenEntry  then
    if (myAngle >18)and (myangle <27)and (close > myVWAP)and (close > smaviolette)and(smableu > smaviolette)and(smarouge > smaviolette )and(close)[0] > (close)[1]then
    BUY 1 SHARES AT MARKET
    endif
    endif
    
    //Conditions d'entrée à l'achat 2
    if not daysForbiddenEntry  and (myAngle >18)and (myangle < 34)and (close CROSSES OVER  myVWAP) and (close >smaviolette)and(smableu < smaviolette)and (close)[0] > (close)[1]then
    BUY 1 SHARES AT MARKET
    endif
    
    
    //Conditions d'entrée à l'achat 3
    if not daysForbiddenEntry  then
    if (myAngle >56)and (myangle < 58.1)and (close > myVWAP)and (close > smaviolette)and(smableu > smaviolette)and (smarouge > smaviolette) and (smarouge > smableu) and (close)[0] > (close)[2]then
    BUY 1 SHARES AT MARKET
    endif
    endif
    
    
    //Conditions d'entrée à l'achat 4
    if not daysForbiddenEntry  then
    if (myAngle >32)and (myangle <37)and (close > myVWAP)and (close > smaviolette)and(smableu > smaviolette)and (smableu < smarouge ) and (smarouge > smaviolette )and (close)[0] > (close)[1]then
    BUY 1 SHARES AT MARKET
    endif
    endif
    
    
    //Conditions d'entrée à l'achat 5
    if not daysForbiddenEntry  then
    if (myAngle <= 0) and  (myangle >-44)and (close CROSSES OVER smableu )and (close CROSSES OVER  smarouge )and (close > myvwap)and(close < smaviolette)and (close)[0] > (close)[1]then
    BUY 1 SHARES AT MARKET
    endif
    endif
    
    
    //Conditions d'entrée à l'achat 6
    if not daysForbiddenEntry  then
    if (myAngle < -24)and (myangle > -68)and (close CROSSES OVER  myVWAP)and (close > smableu)and(smableu > smaviolette)and (close)[0] > (close)[1]then
    BUY 1 SHARES AT MARKET
    endif
    endif
    
    
    //Conditions d'entrée à l'achat 7
    if not daysForbiddenEntry  then
    if (myAngle < -66.6)and (myangle > -69)and (close > myvwap)and (close > smableu )and (close > smarouge )and (close < smaviolette) and (smableu < smarouge)and (smableu < myVWAP) and(smarouge < smaviolette)and (close)[0] > (close)[3]then
    BUY 1 SHARES AT MARKET
    endif
    endif
    
    
    // Conditions pour fermer une position à l'achat
    if not daysForbiddenEntry  then
    if (myangle < 13) and (close CROSSES UNDER smarouge)THEN
    SELL AT MARKET
    endif
    endif
    
    // Conditions pour fermer une position à l'achat 2
    if not daysForbiddenEntry  then
    if (myangle <7) and (close CROSSES UNDER myvwap)and (smableu CROSSES UNDER smarouge )and(smarouge > smaviolette )then
    SELL AT MARKET
    endif
    endif
    
    
    //////////////////////////////////////////////////////////////////////////////////////////////////////////
    
    
    //VENTE
    // Conditions d'entrée à la vente 1
    if not daysForbiddenEntry  then
    if (myAngle => 60)and (myangle < 100)and(close CROSSES UNDER smableu)and (close < myVWAP) and (smarouge < myVWAP )then
    SELLSHORT 1 SHARES AT MARKET
    ENDIF
    endif
    
    // Conditions d'entrée à la vente 2
    if not daysForbiddenEntry  then
    if (myAngle <= -3)and (myangle > -31)and (close CROSSES UNDER myVWAP)and (smableu < smaviolette)and (close)[0] < (close)[3]then
    SELLSHORT 1 SHARES AT MARKET
    endif
    endif
    
    // Conditions sortie à la vente 1
    if not daysForbiddenEntry  then
    if (close CROSSES OVER smableu) AND(smableu > smaviolette )then
    EXITSHORT AT MARKET
    endif
    endif
    
    // Conditions sortie à la vente 2
    if not daysForbiddenEntry THEN
    if (Close  CROSSES OVER smarouge)and (smableu < smarouge) then
    EXITSHORT AT MARKET
    endif
    endif
    //fin de code de la boucle
    if Signal=e then
    drawtext("Signal",barindex[e],low[e])COLOURED(0,120,1)
    BREAK 
    endif
    NEXT
    
    return e

    Bonjour,

    je suis débutant en codage et voici ce que j’ai fait. Cet indicateur sera appliqué à FCEXXX (cac40 future) en time frame H1. Il fonctionne (sans la bouche que j’ai faite) et me dessine bien les signaux d’entrée et sortie conforme à Probacktest. Mon problème et que j’aimerai que lorsqu’il trouve un des signaux (a l’achat ou à la vente, je précise que je souhaite qu’un Trade ouvert à la fois) qu’il ne me dessine pas les signaux de sortie (fleche rouge=sortie vente et jaune=sortie achat) entre deux bougies de Signaux (bougie Rouge=vente et Jaune=achat). Comme on peut le voir sur la capture d’écran dans les carrés verts, il en dessine de celles qui ne devraient pas. je suis sur que c’est une histoire de boucle, mais je n’y arrive pas.

    Merci de votre aide.

    2.png 2.png
    #218413 quote
    deun74
    Participant
    New

    Désolé, je me suis peut être mal exprimé, dans le sens ou j’aimerai garder les signaux de sorties (flèche jaune achat, rouge vente). Simplement la, par exemple, il dessine (dans le grand mouvement haussier sur le graph qui commence à la bougie achat jaune autour des 7350) deux flèches rouges dans la montée qui n’ont pas lieu d’être.

    j’espère avoir été plus clair cette fois.

    Merci à tous.

    bonne journée

    #218415 quote
    Nicolas
    Keymaster
    Master

    Ta boucle ne sert à rien en l’état car tu ne vas pas chercher les informations de tes variables dans le passé. Tu dois indiquer la valeur entre crochet (donc la période entre 0 et 200 de ta boucle), soit :

    e=0
    FOR e=0 to 200 do
    //Conditions d'entrée à l'achat 1
    if not daysForbiddenEntry  then
     if (myAngle[e] >18)and (myangle[e] <27)and (close[e] > myVWAP[e])and (close[e] > smaviolette[e])and(smableu[e] > smaviolette[e])and(smarouge[e] > smaviolette[e] )and(close)[e] > (close)[e+1]then
      BUY 1 SHARES AT MARKET
      BREAK
     endif
    endif

    Je ne connais pas ta stratégie, mais pour être plus clair, avec cette boucle tu vas chercher dans les 200 dernières bougies (!) un signal qui correspond aux conditions énoncées dans le IF, puis on achète, et je casse la boucle (instruction BREAK) puisque inutile de continuer.

    #218455 quote
    deun74
    Participant
    New

    d’accord compris, mais dans le cas ou la première condition est fausse, le programme va continuer sur la deuxième conditions. je dois alors mettre cette sorte de  boucle après chaque condition?

    Merci

    #218682 quote
    JC_Bywan
    Moderator
    Master

    Bjr, un for e=…, juste les [e] et les break pour chaque jeu de conditions

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

Indicateur de ma strategie


ProBuilder : Indicateurs & Outils Personnalisés

New Reply
Author
author-avatar
deun74 @deun74 Participant
Summary

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

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